Using DLPI with HP-UX 11
Johannes Berg
johannes at sipsolutions.net
Mon Aug 30 13:12:38 UTC 2004
Johannes Berg said:
> Doing this surfaced a bug in dhcpd -- you can't define USE_SOCKET_RECEIVE
> without USE_SOCKET_SEND because then the fallback interface will screw you
> up. The solution is to add a global variable in common/socket.c to store
> the rfdesc and use that in the fallback logic instead of interface ->
> rfdesc (which points to fallback_interface where rfdesc is still -1)
discover.c gives a spurious warning to the log in aforementioned case, the
following patch should be self-explanatory. And yes, the case of -1 can
happen in a mixed case (raw send, socket receive).
--- dhcp-3.0pl2/common/discover.c 2001-06-21 18:46:09.000000000 +0200
+++ dhcp-3.0pl2-new/common/discover.c 2004-08-30 10:05:21.000000000 +0200
@@ -678,11 +679,14 @@
#if defined (HAVE_SETFD)
if (fallback_interface) {
- if (fcntl (fallback_interface -> rfdesc, F_SETFD, 1) < 0)
- log_error ("Can't set close-on-exec on fallback: %m");
- if (fallback_interface -> rfdesc != fallback_interface ->
wfdesc) {
- if (fcntl (fallback_interface -> wfdesc, F_SETFD, 1) < 0)
+ if ( fallback_interface -> rfdesc != -1)
+ if (fcntl (fallback_interface -> rfdesc, F_SETFD,
1) < 0) {
+ log_error ("Can't set close-on-exec on
fallback: %m");
+ }
+ if ( (fallback_interface -> wfdesc != -1) &&
(fallback_interface -> rfdesc != fallback_interface -> wfdesc) ) {
+ if (fcntl (fallback_interface -> wfdesc, F_SETFD, 1) < 0) {
log_error ("Can't set close-on-exec on fallback: %m");
+ }
}
}
#endif
johannes
More information about the dhcp-hackers
mailing list