Issue with socket communication when specifying IP Alias
Ben Dart
Ben.Dart at adept.com
Wed Jun 8 16:50:38 UTC 2016
The problem
On our system running RTEMS 4.9.2 we are experiencing a very odd issue with socket communications. We are setting up a socket and using the following command to bind:
if (bind( mSocket, (sockaddr *)&localSocketAddress, sizeof(sockaddr_in)) == SOCKET_ERROR)
{
int errorOut = errno;
...
And this works for UDP communications except in a strange specific scenario which is explained below. The problem that we experience is a failure of this bind call even though the setup is correct. We get the error 125 which for RTEMS is EADDRNOTAVAIL:
A nonexistent interface was requested or the requested address was not local.
The Apparent Cause
At boot of the device we can set up our network in 1 of 2 ways:
1. The Network IP and SUBNET is autoconfigured based on what is in the default bootloader (UBOOT), and is set up through the RTEMS OS.
2. The RTEMS interface function rtems_bsdnet_ifconfig is called to set up a custom user defined ethernet interface after boot time.
For clarification, option 2 is called like this:
rtems_bsdnet_ifconfig(eth_interface, SIOCSIFADDR, &ipaddr);
If the network is set up as indicated by option 1, everything works as expected, but if option 2 is used (even in the case where the setup matches the network options defined by option 1) then the socket bind fails.
Is there a known reason or bug for RTEMS that indicates that this bind would fail if you set up your own IP Alias?
Additional Information
We are setting up an IP alias (option 2) using a method found here<https://docs.rtems.org/doc-current/share/rtems/pdf/networking.pdf#page=[23]> under IP Alias (https://docs.rtems.org/doc-current/share/rtems/pdf/networking.pdf ).
If we bind our socket without specifying a local ADDRESS (ie use INADDR_ANY) then it works in any case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160608/4c558e66/attachment.html>
More information about the users
mailing list