From 3b827dc6cfe3aebec16332b6494cb2742757ac71 Mon Sep 17 00:00:00 2001 From: Christian McDonald Date: Fri, 4 Aug 2023 18:07:20 +0000 Subject: [PATCH] net/isc-dhcp44-server: re-introduce running v4 server and v4 relay at the same time --- net/isc-dhcp44-server/Makefile | 4 +-- .../files/patch-common_socket.c | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 net/isc-dhcp44-server/files/patch-common_socket.c diff --git a/net/isc-dhcp44-server/Makefile b/net/isc-dhcp44-server/Makefile index ee9268da03e0..df785bd659f6 100644 --- a/net/isc-dhcp44-server/Makefile +++ b/net/isc-dhcp44-server/Makefile @@ -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 diff --git a/net/isc-dhcp44-server/files/patch-common_socket.c b/net/isc-dhcp44-server/files/patch-common_socket.c new file mode 100644 index 000000000000..79f2de41e5fd --- /dev/null +++ b/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. */