Kinsey Moore created an issue: 
https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/issues/10

Assignee: Trac Migrate

Reproduction:
* Install lwIP on top of a compatible BSP
* Modify the existing ntp01 test to use the broadcast client
 * Set NTP_DEBUG to 1
 * Replace the first two lines of etc_ntp_conf with:
  * broadcastclient
  * disable auth
* Build rtems-net-services against the installed BSP with lwIP network stack
* Run the modified ntp01 test

Expected result:
NTP opens broadcast listener successfully.

Actual result:
NTP fails to open broadcast listener with error message:
bind(37) AF_INET 0.0.0.0#123 flags 0x409 failed: Address already in use

Workaround:
In open_socket() in bsd/freebsd/contrib/ntp/ntpd/ntp_io.c, there is a test for 
wildcard addresses inside a OS_NEEDS_REUSEADDR_FOR_IFADDRBIND conditional. If 
the set_wildcard_reuse() call is made unconditional, the socket creation 
succeeds.

The root cause is that behavior differs between LibBSD and lwIP. On lwIP, 
early-bound wildcard and non-wildcard address bindings succeed, but late-bound 
wildcard address bindings fail. Once any any address is bound, lwIP will fail 
to bind any further wildcard sockets. Either we can change lwIP's behavior to 
be closer to LibBSD or we can alter the NTP client to check for lwIP or blindly 
apply the address reuse flags.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/issues/10
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to