Skip to content

Commit

Permalink
net/isc-dhcp44-server: re-introduce running v4 server and v4 relay at…
Browse files Browse the repository at this point in the history
… the same time
  • Loading branch information
rcmcdonald91 committed Aug 4, 2023
1 parent 8b1e418 commit 3b827dc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/isc-dhcp44-server/Makefile
Expand Up @@ -19,9 +19,9 @@ USES= cpe gmake

CPE_VENDOR= isc

PORTREVISION_SERVER= 2
PORTREVISION_SERVER= 3
PORTREVISION_CLIENT= 0
PORTREVISION_RELAY= 2
PORTREVISION_RELAY= 3

SUBSYS?= server

Expand Down
29 changes: 29 additions & 0 deletions net/isc-dhcp44-server/files/patch-common_socket.c
@@ -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. */

0 comments on commit 3b827dc

Please sign in to comment.