Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/isc-dhcp44-server: re-introduce running v4 server and v4 relay at…
… the same time
- Loading branch information
1 parent
8b1e418
commit 3b827dc
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- common/socket.c.orig 2023-08-04 16:44:50 UTC | ||
+++ common/socket.c | ||
@@ -254,8 +254,17 @@ if_register_socket(struct interface_info *info, int fa | ||
} | ||
#endif | ||
|
||
+/* | ||
+ * We only need to bind the socket for the DHCPv6 case. | ||
+ * DHCPv4 receives exlusively using the packet filter and only | ||
+ * uses this UDP socket for sending routed (with ARP) unicast. | ||
+ * This is the so-called, "fallback" interface. There is no | ||
+ * need in binding INADDR_ANY for DHCPv4. | ||
+ */ | ||
+#if defined(DHCPv6) | ||
/* Bind the socket to this interface's IP address. */ | ||
- if (bind(sock, (struct sockaddr *)&name, name_len) < 0) { | ||
+ if ((local_family == AF_INET6) && | ||
+ bind(sock, (struct sockaddr *)&name, name_len) < 0) { | ||
log_error("Can't bind to dhcp address: %m"); | ||
log_error("Please make sure there is no other dhcp server"); | ||
log_error("running and that there's no entry for dhcp or"); | ||
@@ -263,6 +272,7 @@ if_register_socket(struct interface_info *info, int fa | ||
log_error("are not running HP JetAdmin software, which"); | ||
log_fatal("includes a bootp server."); | ||
} | ||
+#endif | ||
|
||
#if defined(SO_BINDTODEVICE) | ||
/* Bind this socket to this interface. */ |