From 03603b0c24bc684fbd37d6bd49468335dc3fca95 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Mon, 15 Jan 2024 11:30:33 +0000 Subject: [PATCH 01/14] [dhcp_relay] Update dhcp_relay to bookworm --- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 +- rules/docker-dhcp-relay.mk | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 8b0753f288c3..c566b8a6145b 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 6f1b23ab8031..a40aa00d6e90 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -8,12 +8,12 @@ $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/$(DOCKER_DHCP_RELAY_STEM) $(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_RELAY) $(SONIC_DHCPMON) $(SONIC_DHCPRELAY) $(LIBSWSSCOMMON) $(SONIC_RSYSLOG_PLUGIN) -$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) $(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG) $(SONIC_DHCPRELAY_DBG) $(SONIC_DHCPMON_DBG) $(SONIC_RSYSLOG_PLUGIN) -$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) -$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) +$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BOOKWORM) $(DOCKER_DHCP_RELAY)_INSTALL_PYTHON_WHEELS = $(SONIC_UTILITIES_PY3) $(DOCKER_DHCP_RELAY)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) @@ -29,9 +29,7 @@ $(DOCKER_DHCP_RELAY)_SERVICE_BEFORE = ntp-config $(DOCKER_DHCP_RELAY)_SERVICE_DEPENDENT_OF = swss SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) -SONIC_BULLSEYE_DOCKERS += $(DOCKER_DHCP_RELAY) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) -SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_DHCP_RELAY_DBG) ifeq ($(INCLUDE_KUBERNETES),y) $(DOCKER_DHCP_RELAY)_DEFAULT_FEATURE_OWNER = kube From 0ac96c4044db98a5adc4ee970f0ebaff3a4696e9 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Tue, 16 Jan 2024 01:57:41 +0000 Subject: [PATCH 02/14] Add libbind-export-dev --- .../versions/dockers/sonic-slave-bookworm/versions-deb-bookworm | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm b/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm index 5c5d7f55e4f9..ff10709f8fac 100644 --- a/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm +++ b/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm @@ -384,6 +384,7 @@ libbsd-dev==0.11.7-2 libbsd0==0.11.7-2 libbsh-java==2.0b4-20 libbz2-dev==1.0.8-5+b1 +libbind-export-dev==1:9.11.5 libc-ares-dev==1.18.1-3 libc-ares2==1.18.1-3 libc-dev-bin==2.36-9+deb12u3 From 8ccdc269c380f3ad0ea3ef33070e4525f2f93833 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Tue, 16 Jan 2024 04:32:28 +0000 Subject: [PATCH 03/14] Install libbind-export-dev --- .../versions/dockers/sonic-slave-bookworm/versions-deb-bookworm | 1 - src/isc-dhcp/Makefile | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm b/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm index ff10709f8fac..5c5d7f55e4f9 100644 --- a/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm +++ b/files/build/versions/dockers/sonic-slave-bookworm/versions-deb-bookworm @@ -384,7 +384,6 @@ libbsd-dev==0.11.7-2 libbsd0==0.11.7-2 libbsh-java==2.0b4-20 libbz2-dev==1.0.8-5+b1 -libbind-export-dev==1:9.11.5 libc-ares-dev==1.18.1-3 libc-ares2==1.18.1-3 libc-dev-bin==2.36-9+deb12u3 diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 22d6801ccafe..8d1218b8e641 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -22,6 +22,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : stg init stg import -s ../patch/series + apt-get install libbind-export-dev # Build source and Debian packages ifeq ($(CROSS_BUILD_ENVIRON), y) dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) From a01c01bccf0202f4f02dc1a27caababf893229b7 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Tue, 16 Jan 2024 04:41:56 +0000 Subject: [PATCH 04/14] Add pip.conf to docker-base-bookworm --- dockers/docker-base-bookworm/pip.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 dockers/docker-base-bookworm/pip.conf diff --git a/dockers/docker-base-bookworm/pip.conf b/dockers/docker-base-bookworm/pip.conf new file mode 100644 index 000000000000..9d54ef902835 --- /dev/null +++ b/dockers/docker-base-bookworm/pip.conf @@ -0,0 +1,2 @@ +[global] +break-system-packages = true From 07c26c2fd4f0277326f5a0205748a1f683dcbad4 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Tue, 16 Jan 2024 08:33:11 +0000 Subject: [PATCH 05/14] Add --- sonic-slave-bookworm/Dockerfile.j2 | 1 + src/isc-dhcp/Makefile | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 6bf09c425cd1..d67446a37a7d 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -514,6 +514,7 @@ RUN apt-get install -y xsltproc # Install dependencies for isc-dhcp-relay build RUN apt-get -y build-dep isc-dhcp +RUN apt-get -y install bind9-dev # Install vim RUN apt-get install -y vim diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 8d1218b8e641..22d6801ccafe 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -22,7 +22,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : stg init stg import -s ../patch/series - apt-get install libbind-export-dev # Build source and Debian packages ifeq ($(CROSS_BUILD_ENVIRON), y) dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) From 0ac8b1ec76ed10b75c627c9bcad73ab6030ecaad Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Fri, 26 Jan 2024 10:00:50 +0000 Subject: [PATCH 06/14] Temp --- sonic-slave-bookworm/Dockerfile.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index d67446a37a7d..6bf09c425cd1 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -514,7 +514,6 @@ RUN apt-get install -y xsltproc # Install dependencies for isc-dhcp-relay build RUN apt-get -y build-dep isc-dhcp -RUN apt-get -y install bind9-dev # Install vim RUN apt-get install -y vim From 3651e920b3e04100fa6b3f3b93f78bed36e76b0f Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Fri, 26 Jan 2024 09:58:44 +0000 Subject: [PATCH 07/14] Modify patch --- rules/isc-dhcp.mk | 4 +-- ...ion-82-circuit-ID-and-remote-ID-fiel.patch | 32 ++++++++--------- ...ing-port-alias-map-file-to-replace-p.patch | 36 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 5dc98d5d5653..37d0e4c67d85 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,7 +1,7 @@ # isc-dhcp packages -ISC_DHCP_VERSION = 4.4.1 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2.3+deb11u2 +ISC_DHCP_VERSION = 4.4.3 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-P1-4 export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL diff --git a/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch b/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch index e6d09dedc711..7eafe3b7790e 100644 --- a/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch +++ b/src/isc-dhcp/patch/0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch @@ -4,11 +4,11 @@ Date: Thu, 25 Apr 2019 22:07:20 +0000 Subject: [PATCH] Customizable Option 82 circuit ID and remote ID fields --- - relay/dhcrelay.c | 171 ++++++++++++++++++++++++++++++++++++++++------- - 1 file changed, 147 insertions(+), 24 deletions(-) + relay/dhcrelay.c | 178 +++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 150 insertions(+), 28 deletions(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 0cb2ef6..418b943 100644 +index 3b9c71b..19843f7 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -75,6 +75,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option @@ -20,7 +20,7 @@ index 0cb2ef6..418b943 100644 int max_hop_count = 10; /* Maximum hop count */ int no_daemon = 0; -@@ -151,10 +153,20 @@ static const char url[] = +@@ -160,10 +162,20 @@ static const char url[] = char *progname; @@ -42,7 +42,7 @@ index 0cb2ef6..418b943 100644 " [-A ] [-c ]\n" \ " [-p | -rp ]\n" \ " [-pf ] [--no-pid]\n"\ -@@ -171,11 +183,11 @@ char *progname; +@@ -180,11 +192,11 @@ char *progname; " -l lower0 [ ... -l lowerN]\n" \ " -u upper0 [ ... -u upperN]\n" \ " lower (client link): [address%%]interface[#index]\n" \ @@ -56,7 +56,7 @@ index 0cb2ef6..418b943 100644 " [-A ] [-c ] [-p ]\n" \ " [-pf ] [--no-pid]\n"\ " [-m append|replace|forward|discard]\n" \ -@@ -190,13 +202,13 @@ char *progname; +@@ -199,13 +211,13 @@ char *progname; " -l lower0 [ ... -l lowerN]\n" \ " -u upper0 [ ... -u upperN]\n" \ " lower (client link): [address%%]interface[#index]\n" \ @@ -72,10 +72,10 @@ index 0cb2ef6..418b943 100644 " [-p | -rp ]\n" \ " [-pf ] [--no-pid]\n" \ " [-m append|replace|forward|discard]\n" \ -@@ -204,18 +216,18 @@ char *progname; +@@ -213,18 +225,18 @@ char *progname; " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ -" server0 [ ... serverN]\n\n" \ +" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \ " %s {--version|--help|-h}" @@ -88,13 +88,13 @@ index 0cb2ef6..418b943 100644 " [-i interface0 [ ... -i interfaceN]\n" \ " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ -" server0 [ ... serverN]\n\n" \ +" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \ " %s {--version|--help|-h}" #endif #endif -@@ -471,6 +483,15 @@ main(int argc, char **argv) { +@@ -480,6 +492,15 @@ main(int argc, char **argv) { local_family_set = 1; local_family = AF_INET; #endif @@ -110,7 +110,7 @@ index 0cb2ef6..418b943 100644 add_agent_options = 1; } else if (!strcmp(argv[i], "-A")) { #ifdef DHCPv6 -@@ -1171,6 +1192,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet, +@@ -1207,6 +1228,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet, return (-1); } @@ -192,7 +192,7 @@ index 0cb2ef6..418b943 100644 /* * Examine a packet to see if it's a candidate to have a Relay * Agent Information option tacked onto its tail. If it is, tack -@@ -1180,9 +1276,12 @@ static int +@@ -1216,9 +1312,12 @@ int add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, unsigned length, struct in_addr giaddr) { int is_dhcp = 0, mms; @@ -206,7 +206,7 @@ index 0cb2ef6..418b943 100644 /* If we're not adding agent options to packets, we can skip this. */ -@@ -1316,17 +1415,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1357,17 +1456,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, op = sp; #endif @@ -258,7 +258,7 @@ index 0cb2ef6..418b943 100644 } if (adding_link_select) { -@@ -1351,7 +1473,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1392,7 +1514,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, * If not, forward without adding the option. */ if (max - sp >= optlen + 3) { @@ -267,7 +267,7 @@ index 0cb2ef6..418b943 100644 /* Okay, cons up *our* Relay Agent Information option. */ *sp++ = DHO_DHCP_AGENT_OPTIONS; -@@ -1359,16 +1481,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1400,16 +1522,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, /* Copy in the circuit id... */ *sp++ = RAI_CIRCUIT_ID; @@ -292,5 +292,5 @@ index 0cb2ef6..418b943 100644 /* RFC3527: Use the inbound packet's interface address in -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch index f26871019b63..8d24737ca22d 100644 --- a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch +++ b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -9,10 +9,10 @@ Subject: [PATCH] Support for loading port alias map file to replace port name 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 00c81d3..54f132a 100644 +index 0d9b2e7..b72b1bc 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c -@@ -129,6 +129,14 @@ static void setup_streams(void); +@@ -133,6 +133,14 @@ static void setup_streams(void); char *dhcrelay_sub_id = NULL; #endif @@ -24,11 +24,11 @@ index 00c81d3..54f132a 100644 +static struct interface_name_alias_tuple *g_interface_name_alias_map = NULL; +static size_t g_interface_name_alias_map_size = 0; + + #ifndef UNIT_TEST static void do_relay4(struct interface_info *, struct dhcp_packet *, unsigned int, unsigned int, struct iaddr, - struct hardware *); -@@ -143,6 +151,10 @@ static int strip_relay_agent_options(struct interface_info *, - +@@ -152,6 +160,10 @@ extern int strip_relay_agent_options(struct interface_info *, + #ifndef UNIT_TEST static void request_v4_interface(const char* name, int flags); +static int load_interface_alias_map(const char *port_alias_map_file_path); @@ -36,9 +36,9 @@ index 00c81d3..54f132a 100644 +static void free_interface_alias_map(void); + static const char copyright[] = - "Copyright 2004-2018 Internet Systems Consortium."; + "Copyright 2004-2022 Internet Systems Consortium."; static const char arr[] = "All rights reserved."; -@@ -158,7 +170,7 @@ char *progname; +@@ -167,7 +179,7 @@ char *progname; "\n" \ " %%%% A single %%\n" \ " %%h Hostname of device\n" \ @@ -47,7 +47,7 @@ index 00c81d3..54f132a 100644 " %%P Hardware address of interface that generated the request\n" \ " %%C Client hardware address\n" \ " %%I DHCP relay agent IP Address\n" \ -@@ -171,6 +183,7 @@ char *progname; +@@ -180,6 +192,7 @@ char *progname; " [-p | -rp ]\n" \ " [-pf ] [--no-pid]\n"\ " [-m append|replace|forward|discard]\n" \ @@ -55,7 +55,7 @@ index 00c81d3..54f132a 100644 " [-i interface0 [ ... -i interfaceN]\n" \ " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ -@@ -179,6 +192,7 @@ char *progname; +@@ -188,6 +201,7 @@ char *progname; " %s -6 [-d] [-q] [-I] [-c ]\n" \ " [-p | -rp ]\n" \ " [-pf ] [--no-pid]\n" \ @@ -63,7 +63,7 @@ index 00c81d3..54f132a 100644 " [-s ]\n" \ " -l lower0 [ ... -l lowerN]\n" \ " -u upper0 [ ... -u upperN]\n" \ -@@ -619,6 +633,11 @@ main(int argc, char **argv) { +@@ -643,6 +657,11 @@ main(int argc, char **argv) { no_dhcrelay_pid = ISC_TRUE; } else if (!strcmp(argv[i], "--no-pid")) { no_pid_file = ISC_TRUE; @@ -75,7 +75,7 @@ index 00c81d3..54f132a 100644 } else if (argv[i][0] == '-') { usage("Unknown command: %s", argv[i]); } else { -@@ -841,6 +860,7 @@ main(int argc, char **argv) { +@@ -865,6 +884,7 @@ main(int argc, char **argv) { dispatch(); /* In fact dispatch() never returns. */ @@ -83,7 +83,7 @@ index 00c81d3..54f132a 100644 return (0); } -@@ -1271,6 +1291,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack +@@ -1307,6 +1327,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack */ if (packet->htype && !packet->giaddr.s_addr) { int ret = 0, vlanid = 0; @@ -91,10 +91,11 @@ index 00c81d3..54f132a 100644 ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr), ifname, -@@ -1287,6 +1308,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack +@@ -1322,6 +1343,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack + strncpy(ifname, ip->name, IFNAMSIZ); } - ++ + // Attempt to translate SONiC interface name to vendor alias + ret = get_interface_alias_by_name(ifname, ifalias); + if (ret < 0) { @@ -106,11 +107,10 @@ index 00c81d3..54f132a 100644 + + strncpy(ifname, ifalias, IFNAMSIZ); + } -+ + str = ifname; } - break; -@@ -2313,3 +2346,73 @@ void request_v4_interface(const char* name, int flags) { +@@ -2361,3 +2394,73 @@ void request_v4_interface(const char* name, int flags) { interface_snorf(tmp, (INTERFACE_REQUESTED | flags)); interface_dereference(&tmp, MDL); } @@ -185,5 +185,5 @@ index 00c81d3..54f132a 100644 + g_interface_name_alias_map_size = 0; +} -- -2.17.1 +2.25.1 From 8e50fbf2b0364578578ff3fb3d69f33d72712210 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Fri, 26 Jan 2024 10:03:32 +0000 Subject: [PATCH 08/14] Skip patch --- src/isc-dhcp/patch/series | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index 5a58b41b1552..8f1ec7f1a0fe 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -3,15 +3,15 @@ 0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch 0003-Support-for-obtaining-name-of-physical-interface-tha.patch 0004-Support-for-loading-port-alias-map-file-to-replace-p.patch -0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch -0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch -0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch -0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch -0009-Support-for-dual-tor-scenario.patch -0010-Bugfix-correctly-set-interface-netmask.patch -0011-dhcp-relay-Prevent-Buffer-Overrun.patch -0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch -0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch -0014-enable-parallel-build.patch -0015-option-to-set-primary-address-in-interface.patch -0016-Don-t-look-up-the-ifindex-for-fallback.patch +# 0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch +# 0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +# 0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch +# 0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch +# 0009-Support-for-dual-tor-scenario.patch +# 0010-Bugfix-correctly-set-interface-netmask.patch +# 0011-dhcp-relay-Prevent-Buffer-Overrun.patch +# 0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch +# 0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch +# 0014-enable-parallel-build.patch +# 0015-option-to-set-primary-address-in-interface.patch +# 0016-Don-t-look-up-the-ifindex-for-fallback.patch From 6df14e0d6b12289c8c84c18feb95d4d39b518e66 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Mon, 29 Jan 2024 09:33:36 +0000 Subject: [PATCH 09/14] Modify patch --- rules/isc-dhcp.mk | 4 +- src/isc-dhcp/Makefile | 2 +- ...ing-port-alias-map-file-to-replace-p.patch | 2 +- ...ockets-to-configure-flags-in-debian-.patch | 12 +- ...VE_SO_BINDTODEVICE-has-a-chance-to-b.patch | 452 +++++++++--------- ...f-BOOTREQUEST-is-directed-broadcast-.patch | 76 ++- ...interfaces-when-discovering-interfac.patch | 8 +- .../0009-Support-for-dual-tor-scenario.patch | 60 ++- ...o-support-using-src-intf-ip-in-relay.patch | 25 +- .../patch/0014-enable-parallel-build.patch | 23 +- ...-to-set-primary-address-in-interface.patch | 25 +- src/isc-dhcp/patch/series | 22 +- 12 files changed, 360 insertions(+), 351 deletions(-) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 37d0e4c67d85..d3505ec8e40b 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,8 +1,10 @@ # isc-dhcp packages ISC_DHCP_VERSION = 4.4.3 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-P1-4 +ISC_DHCP_VERSION_MID = ${ISC_DHCP_VERSION}-P1 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION_MID}-4 +export ISC_DHCP_VERSION_MID export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION_FULL)_$(CONFIGURED_ARCH).deb diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 22d6801ccafe..5d8fe0137595 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -11,7 +11,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Get isc-dhcp release, debian files dget -u http://deb.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp_$(ISC_DHCP_VERSION_FULL).dsc - pushd ./isc-dhcp-$(ISC_DHCP_VERSION) + pushd ./isc-dhcp-$(ISC_DHCP_VERSION_MID) # Create a git repository here for stg to apply patches git init diff --git a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch index 8d24737ca22d..ec12771524b1 100644 --- a/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch +++ b/src/isc-dhcp/patch/0004-Support-for-loading-port-alias-map-file-to-replace-p.patch @@ -95,7 +95,7 @@ index 0d9b2e7..b72b1bc 100644 strncpy(ifname, ip->name, IFNAMSIZ); } -+ ++ + // Attempt to translate SONiC interface name to vendor alias + ret = get_interface_alias_by_name(ifname, ifalias); + if (ret < 0) { diff --git a/src/isc-dhcp/patch/0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch b/src/isc-dhcp/patch/0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch index 7e9bcc30fb89..48e7f5d20fac 100644 --- a/src/isc-dhcp/patch/0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch +++ b/src/isc-dhcp/patch/0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch @@ -9,18 +9,18 @@ Subject: [PATCH 1/3] Add --enable-use-sockets to configure flags in 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules -index d3fcc1d..2a7219d 100755 +index dc2a9b1..3d12fb5 100755 --- a/debian/rules +++ b/debian/rules -@@ -24,7 +24,7 @@ CFLAGS+=-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"' +@@ -23,7 +23,7 @@ CFLAGS+=-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"' CFLAGS+=-D_PATH_DHCLIENT_DB='\"$(LEASE_PATH)/dhclient.leases\"' CFLAGS+=-D_PATH_DHCLIENT6_DB='\"$(LEASE_PATH)/dhclient6.leases\"' --CONFFLAGS=--prefix=/usr --with-libbind=/usr --enable-log-pid --enable-paranoia -+CONFFLAGS=--prefix=/usr --with-libbind=/usr --enable-log-pid --enable-paranoia --enable-use-sockets +-CONFFLAGS+=--prefix=/usr --enable-log-pid --enable-paranoia ++CONFFLAGS+=--prefix=/usr --enable-log-pid --enable-paranoia --enable-use-sockets + include /usr/share/dpkg/buildtools.mk # cross-architecture building - ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch index 5553180f40e2..7e7d585a7d8f 100644 --- a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +++ b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch @@ -5,271 +5,277 @@ Subject: [PATCH 2/3] Bugfix: Ensure HAVE_SO_BINDTODEVICE has a chance to be defined before it is referenced --- - includes/osdep.h | 239 ++++++++++++++++++++++++----------------------- - 1 file changed, 120 insertions(+), 119 deletions(-) + includes/osdep.h | 237 +++++++++++++++++++++++------------------------ + 1 file changed, 117 insertions(+), 120 deletions(-) diff --git a/includes/osdep.h b/includes/osdep.h -index cfae90b..f07c43c 100644 +index 0742858..29c5328 100644 --- a/includes/osdep.h +++ b/includes/osdep.h -@@ -48,37 +48,6 @@ +@@ -47,6 +47,123 @@ #define BYTE_ORDER DHCP_BYTE_ORDER #endif /* BYTE_ORDER */ --/* Porting:: -- -- If you add a new network API, you must add a check for it below: */ ++#if !defined (TIME_MAX) ++# define TIME_MAX 2147483647 ++#endif ++ ++/* snprintf/vsnprintf hacks. for systems with no libc versions only. */ ++#ifdef NO_SNPRINTF ++ extern int isc_print_snprintf(char *, size_t, const char *, ...); ++ extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); ++# define snprintf isc_print_snprintf ++# define vsnprintf isc_print_vsnprintf ++#endif ++ ++/* If we don't have a DLPI packet filter, we have to filter in userland. ++ Probably not worth doing, actually. */ ++#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) ++# define USERLAND_FILTER ++#endif ++ ++/* jmp_buf is assumed to be a struct unless otherwise defined in the ++ system header. */ ++#ifndef jbp_decl ++# define jbp_decl(x) jmp_buf *x ++#endif ++#ifndef jref ++# define jref(x) (&(x)) ++#endif ++#ifndef jdref ++# define jdref(x) (*(x)) ++#endif ++#ifndef jrefproto ++# define jrefproto jmp_buf * ++#endif ++ ++#ifndef BPF_FORMAT ++# define BPF_FORMAT "/dev/bpf%d" ++#endif ++ ++#if defined (F_SETFD) && !defined (HAVE_SETFD) ++# define HAVE_SETFD ++#endif ++ ++#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) ++# define HAVE_IFF_POINTOPOINT ++#endif ++ ++#if defined (AF_LINK) && !defined (HAVE_AF_LINK) ++# define HAVE_AF_LINK ++#endif ++ ++#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) ++# define HAVE_ARPHRD_TUNNEL ++#endif ++ ++#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) ++# define HAVE_ARPHRD_LOOPBACK ++#endif ++ ++#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) ++# define HAVE_ARPHRD_ROSE ++#endif ++ ++#if defined (ARPHRD_IRDA) && !defined (HAVE_ARPHRD_IRDA) ++# define HAVE_ARPHRD_IRDA ++#endif ++ ++#if defined (ARPHRD_SIT) && !defined (HAVE_ARPHRD_SIT) ++# define HAVE_ARPHRD_SIT ++#endif ++ ++#if defined (ARPHRD_IEEE1394) & !defined (HAVE_ARPHRD_IEEE1394) ++# define HAVE_ARPHRD_IEEE1394 ++#endif ++ ++#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) ++# define HAVE_ARPHRD_IEEE802 ++#endif ++ ++#if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR) ++# define HAVE_ARPHRD_IEEE802_TR ++#endif ++ ++#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) ++# define HAVE_ARPHRD_FDDI ++#endif ++ ++#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) ++# define HAVE_ARPHRD_AX25 ++#endif ++ ++#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) ++# define HAVE_ARPHRD_NETROM ++#endif ++ ++#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) ++# define HAVE_ARPHRD_METRICOM ++#endif ++ ++#if defined (AF_LINK) && !defined (HAVE_AF_LINK) ++# define HAVE_AF_LINK ++#endif ++ ++/* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */ ++#if !defined (SHUT_RD) ++# define SHUT_RD 0 ++#endif ++ ++#if !defined (SOCKLEN_T) ++# define SOCKLEN_T socklen_t ++#elif defined(_AIX) ++#undef SOCKLEN_T ++#define SOCKLEN_T socklen_t ++#endif ++ ++#if !defined (STDERR_FILENO) ++# define STDERR_FILENO 2 ++#endif ++ + /* Porting:: + + If you add a new network API, you must add a check for it below: */ +@@ -78,18 +195,6 @@ + # endif + #endif + +-#if !defined (TIME_MAX) +-# define TIME_MAX 2147483647 +-#endif - --#if !defined (USE_SOCKETS) && \ -- !defined (USE_SOCKET_SEND) && \ -- !defined (USE_SOCKET_RECEIVE) && \ -- !defined (USE_RAW_SOCKETS) && \ -- !defined (USE_RAW_SEND) && \ -- !defined (USE_SOCKET_RECEIVE) && \ -- !defined (USE_BPF) && \ -- !defined (USE_BPF_SEND) && \ -- !defined (USE_BPF_RECEIVE) && \ -- !defined (USE_LPF) && \ -- !defined (USE_LPF_SEND) && \ -- !defined (USE_LPF_RECEIVE) && \ -- !defined (USE_NIT) && \ -- !defined (USE_NIT_SEND) && \ -- !defined (USE_NIT_RECEIVE) && \ -- !defined (USE_DLPI_SEND) && \ -- !defined (USE_DLPI_RECEIVE) --/* Determine default socket API to USE. */ --# if defined(HAVE_BPF) --# define USE_BPF 1 --# elif defined(HAVE_LPF) --# define USE_LPF 1 --# elif defined(HAVE_DLPI) --# define USE_DLPI 1 --# endif +-/* snprintf/vsnprintf hacks. for systems with no libc versions only. */ +-#ifdef NO_SNPRINTF +- extern int isc_print_snprintf(char *, size_t, const char *, ...); +- extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); +-# define snprintf isc_print_snprintf +-# define vsnprintf isc_print_vsnprintf -#endif - - #if !defined (TIME_MAX) - # define TIME_MAX 2147483647 + /* Porting:: + + If you add a new network API, and have it set up so that it can be +@@ -138,10 +243,6 @@ + # define USE_UPF_RECEIVE #endif -@@ -91,94 +60,6 @@ - # define vsnprintf isc_print_vsnprintf + +-#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) +-# define HAVE_SO_BINDTODEVICE +-#endif +- + /* Porting:: + + If you add support for sending packets directly out an interface, +@@ -182,109 +283,5 @@ + # define PACKET_DECODING #endif --/* Porting:: +-/* If we don't have a DLPI packet filter, we have to filter in userland. +- Probably not worth doing, actually. */ +-#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) +-# define USERLAND_FILTER +-#endif +- +-/* jmp_buf is assumed to be a struct unless otherwise defined in the +- system header. */ +-#ifndef jbp_decl +-# define jbp_decl(x) jmp_buf *x +-#endif +-#ifndef jref +-# define jref(x) (&(x)) +-#endif +-#ifndef jdref +-# define jdref(x) (*(x)) +-#endif +-#ifndef jrefproto +-# define jrefproto jmp_buf * +-#endif +- +-#ifndef BPF_FORMAT +-# define BPF_FORMAT "/dev/bpf%d" +-#endif +- +-#if defined (F_SETFD) && !defined (HAVE_SETFD) +-# define HAVE_SETFD +-#endif - -- If you add a new network API, and have it set up so that it can be -- used for sending or receiving, but doesn't have to be used for both, -- then set up an ifdef like the ones below: */ +-#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) +-# define HAVE_IFF_POINTOPOINT +-#endif - --#ifdef USE_SOCKETS --# define USE_SOCKET_SEND --# define USE_SOCKET_RECEIVE --# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) --# define USE_DLPI_HWADDR --# elif defined(HAVE_LPF) --# define USE_LPF_HWADDR --# elif defined(HAVE_BPF) --# define USE_BPF_HWADDR --# endif +-#if defined (AF_LINK) && !defined (HAVE_AF_LINK) +-# define HAVE_AF_LINK -#endif - --#ifdef USE_RAW_SOCKETS --# define USE_RAW_SEND --# define USE_SOCKET_RECEIVE +-#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) +-# define HAVE_ARPHRD_TUNNEL -#endif - --#ifdef USE_BPF --# define USE_BPF_SEND --# define USE_BPF_RECEIVE +-#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) +-# define HAVE_ARPHRD_LOOPBACK -#endif - --#ifdef USE_LPF --# define USE_LPF_SEND --# define USE_LPF_RECEIVE +-#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) +-# define HAVE_ARPHRD_ROSE -#endif - --#ifdef USE_NIT --# define USE_NIT_SEND --# define USE_NIT_RECEIVE +-#if defined (ARPHRD_IRDA) && !defined (HAVE_ARPHRD_IRDA) +-# define HAVE_ARPHRD_IRDA -#endif - --#ifdef USE_DLPI --# define USE_DLPI_SEND --# define USE_DLPI_RECEIVE +-#if defined (ARPHRD_SIT) && !defined (HAVE_ARPHRD_SIT) +-# define HAVE_ARPHRD_SIT -#endif - --#ifdef USE_UPF --# define USE_UPF_SEND --# define USE_UPF_RECEIVE +-#if defined (ARPHRD_IEEE1394) & !defined (HAVE_ARPHRD_IEEE1394) +-# define HAVE_ARPHRD_IEEE1394 -#endif - --/* Porting:: +-#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) +-# define HAVE_ARPHRD_IEEE802 +-#endif - -- If you add support for sending packets directly out an interface, -- and your support does not do ARP or routing, you must use a fallback -- mechanism to deal with packets that need to be sent to routers. -- Currently, all low-level packet interfaces use BSD sockets as a -- fallback. */ +-#if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR) +-# define HAVE_ARPHRD_IEEE802_TR +-#endif - --#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ -- defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ -- defined (USE_LPF_SEND) || \ -- (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) --# define USE_SOCKET_FALLBACK --# define USE_FALLBACK +-#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) +-# define HAVE_ARPHRD_FDDI -#endif - --/* Porting:: +-#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) +-# define HAVE_ARPHRD_AX25 +-#endif - -- If you add support for sending packets directly out an interface -- and need to be able to assemble packets, add the USE_XXX_SEND -- definition for your interface to the list tested below. */ +-#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) +-# define HAVE_ARPHRD_NETROM +-#endif - --#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ -- defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ -- defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) --# define PACKET_ASSEMBLY +-#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) +-# define HAVE_ARPHRD_METRICOM -#endif - --/* Porting:: +-#if defined (AF_LINK) && !defined (HAVE_AF_LINK) +-# define HAVE_AF_LINK +-#endif - -- If you add support for receiving packets directly from an interface -- and need to be able to decode raw packets, add the USE_XXX_RECEIVE -- definition for your interface to the list tested below. */ +-/* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */ +-#if !defined (SHUT_RD) +-# define SHUT_RD 0 +-#endif - --#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ -- defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ -- defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) --# define PACKET_DECODING +-#if !defined (SOCKLEN_T) +-# define SOCKLEN_T socklen_t +-#elif defined(_AIX) +-#undef SOCKLEN_T +-#define SOCKLEN_T socklen_t -#endif - - /* If we don't have a DLPI packet filter, we have to filter in userland. - Probably not worth doing, actually. */ - #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) -@@ -288,4 +169,124 @@ - # define STDERR_FILENO 2 - #endif +-#if !defined (STDERR_FILENO) +-# define STDERR_FILENO 2 +-#endif -+/* Porting:: -+ -+ If you add a new network API, you must add a check for it below: */ -+ -+#if !defined (USE_SOCKETS) && \ -+ !defined (USE_SOCKET_SEND) && \ -+ !defined (USE_SOCKET_RECEIVE) && \ -+ !defined (USE_RAW_SOCKETS) && \ -+ !defined (USE_RAW_SEND) && \ -+ !defined (USE_SOCKET_RECEIVE) && \ -+ !defined (USE_BPF) && \ -+ !defined (USE_BPF_SEND) && \ -+ !defined (USE_BPF_RECEIVE) && \ -+ !defined (USE_LPF) && \ -+ !defined (USE_LPF_SEND) && \ -+ !defined (USE_LPF_RECEIVE) && \ -+ !defined (USE_NIT) && \ -+ !defined (USE_NIT_SEND) && \ -+ !defined (USE_NIT_RECEIVE) && \ -+ !defined (USE_DLPI_SEND) && \ -+ !defined (USE_DLPI_RECEIVE) -+/* Determine default socket API to USE. */ -+# if defined(HAVE_BPF) -+# define USE_BPF 1 -+# elif defined(HAVE_LPF) -+# define USE_LPF 1 -+# elif defined(HAVE_DLPI) -+# define USE_DLPI 1 -+# endif -+#endif -+ -+/* Porting:: -+ -+ If you add a new network API, and have it set up so that it can be -+ used for sending or receiving, but doesn't have to be used for both, -+ then set up an ifdef like the ones below: */ -+ -+#ifdef USE_SOCKETS -+# define USE_SOCKET_SEND -+# define USE_SOCKET_RECEIVE -+# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) -+# define USE_DLPI_HWADDR -+# elif defined(HAVE_LPF) -+# define USE_LPF_HWADDR -+# elif defined(HAVE_BPF) -+# define USE_BPF_HWADDR -+# endif -+#endif -+ -+#ifdef USE_RAW_SOCKETS -+# define USE_RAW_SEND -+# define USE_SOCKET_RECEIVE -+#endif -+ -+#ifdef USE_BPF -+# define USE_BPF_SEND -+# define USE_BPF_RECEIVE -+#endif -+ -+#ifdef USE_LPF -+# define USE_LPF_SEND -+# define USE_LPF_RECEIVE -+#endif -+ -+#ifdef USE_NIT -+# define USE_NIT_SEND -+# define USE_NIT_RECEIVE -+#endif -+ -+#ifdef USE_DLPI -+# define USE_DLPI_SEND -+# define USE_DLPI_RECEIVE -+#endif -+ -+#ifdef USE_UPF -+# define USE_UPF_SEND -+# define USE_UPF_RECEIVE -+#endif -+ -+/* Porting:: -+ -+ If you add support for sending packets directly out an interface, -+ and your support does not do ARP or routing, you must use a fallback -+ mechanism to deal with packets that need to be sent to routers. -+ Currently, all low-level packet interfaces use BSD sockets as a -+ fallback. */ -+ -+#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ -+ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ -+ defined (USE_LPF_SEND) || \ -+ (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) -+# define USE_SOCKET_FALLBACK -+# define USE_FALLBACK -+#endif -+ -+/* Porting:: -+ -+ If you add support for sending packets directly out an interface -+ and need to be able to assemble packets, add the USE_XXX_SEND -+ definition for your interface to the list tested below. */ -+ -+#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ -+ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ -+ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) -+# define PACKET_ASSEMBLY -+#endif -+ -+/* Porting:: -+ -+ If you add support for receiving packets directly from an interface -+ and need to be able to decode raw packets, add the USE_XXX_RECEIVE -+ definition for your interface to the list tested below. */ -+ -+#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ -+ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ -+ defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) -+# define PACKET_DECODING -+#endif -+ -+ #endif /* __ISC_DHCP_OSDEP_H__ */ -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch b/src/isc-dhcp/patch/0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch index bf24e448ea1a..63d14701fe9a 100644 --- a/src/isc-dhcp/patch/0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch +++ b/src/isc-dhcp/patch/0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch @@ -6,16 +6,16 @@ Subject: [PATCH 3/3] If destination of BOOTREQUEST is directed broadcast, interfaces --- - common/discover.c | 46 +++++++++++++++++++--- + common/discover.c | 40 +++++++++++++++++++-- includes/dhcpd.h | 3 ++ - relay/dhcrelay.c | 98 +++++++++++++++++++++++++++++++++++++++++------ - 3 files changed, 131 insertions(+), 16 deletions(-) + relay/dhcrelay.c | 90 +++++++++++++++++++++++++++++++++++++++++++---- + 3 files changed, 123 insertions(+), 10 deletions(-) diff --git a/common/discover.c b/common/discover.c -index 98ac46a..53afecc 100644 +index 0c5ad39..32f2516 100644 --- a/common/discover.c +++ b/common/discover.c -@@ -236,6 +236,7 @@ struct iface_conf_list { +@@ -239,6 +239,7 @@ struct iface_conf_list { struct iface_info { char name[IF_NAMESIZE+1]; /* name of the interface, e.g. "bge0" */ struct sockaddr_storage addr; /* address information */ @@ -23,7 +23,7 @@ index 98ac46a..53afecc 100644 isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ }; -@@ -367,6 +368,17 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { +@@ -370,6 +371,17 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { } info->flags = tmp.lifr_flags; @@ -41,7 +41,7 @@ index 98ac46a..53afecc 100644 ifaces->next++; *err = 0; return 1; -@@ -410,6 +422,7 @@ struct iface_conf_list { +@@ -413,6 +425,7 @@ struct iface_conf_list { struct iface_info { char name[IFNAMSIZ]; /* name of the interface, e.g. "bge0" */ struct sockaddr_storage addr; /* address information */ @@ -49,17 +49,17 @@ index 98ac46a..53afecc 100644 isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ }; -@@ -487,7 +500,8 @@ end_iface_scan(struct iface_conf_list *ifaces) { +@@ -490,7 +503,8 @@ end_iface_scan(struct iface_conf_list *ifaces) { /* XXX: perhaps create drealloc() rather than do it manually */ void - add_ipv4_addr_to_interface(struct interface_info *iface, + add_ipv4_addr_to_interface(struct interface_info *iface, - const struct in_addr *addr) { + const struct in_addr *addr, + const struct in_addr *netmask) { /* * We don't expect a lot of addresses per IPv4 interface, so * we use 4, as our "chunk size" for collecting addresses. -@@ -498,6 +512,11 @@ add_ipv4_addr_to_interface(struct interface_info *iface, +@@ -501,6 +515,11 @@ add_ipv4_addr_to_interface(struct interface_info *iface, log_fatal("Out of memory saving IPv4 address " "on interface."); } @@ -71,7 +71,7 @@ index 98ac46a..53afecc 100644 iface->address_count = 0; iface->address_max = 4; } else if (iface->address_count >= iface->address_max) { -@@ -515,9 +534,23 @@ add_ipv4_addr_to_interface(struct interface_info *iface, +@@ -518,9 +537,23 @@ add_ipv4_addr_to_interface(struct interface_info *iface, iface->address_max * sizeof(struct in_addr)); dfree(iface->addresses, MDL); iface->addresses = tmp; @@ -96,15 +96,15 @@ index 98ac46a..53afecc 100644 } #ifdef DHCPv6 -@@ -656,6 +689,7 @@ discover_interfaces(int state) { - if ((info.addr.ss_family == AF_INET) && +@@ -661,6 +694,7 @@ discover_interfaces(int state) { + if ((info.addr.ss_family == AF_INET) && (local_family == AF_INET)) { struct sockaddr_in *a = (struct sockaddr_in*)&info.addr; + struct sockaddr_in *n = (struct sockaddr_in*)&info.netmask; struct iaddr addr; /* We don't want the loopback interface. */ -@@ -670,7 +704,7 @@ discover_interfaces(int state) { +@@ -675,7 +709,7 @@ discover_interfaces(int state) { if (a->sin_addr.s_addr != htonl(INADDR_ANY)) tmp->configured = 1; @@ -114,10 +114,10 @@ index 98ac46a..53afecc 100644 /* invoke the setup hook */ addr.len = 4; diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index df3da59..2c7f059 100644 +index 20f9bfb..b54a36e 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -1369,6 +1369,9 @@ struct interface_info { +@@ -1380,6 +1380,9 @@ struct interface_info { struct in_addr *addresses; /* Addresses associated with this * interface. */ @@ -128,7 +128,7 @@ index df3da59..2c7f059 100644 int address_max; /* Size of addresses buffer. */ struct in6_addr *v6addresses; /* IPv6 addresses associated with diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 54f132a..beae977 100644 +index b72b1bc..9143e85 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -30,6 +30,7 @@ @@ -139,7 +139,7 @@ index 54f132a..beae977 100644 #include TIME default_lease_time = 43200; /* 12 hours... */ -@@ -1001,20 +1002,95 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1030,20 +1031,95 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, /* Otherwise, it's a BOOTREQUEST, so forward it to all the servers. */ for (sp = servers; sp; sp = sp->next) { @@ -147,7 +147,6 @@ index 54f132a..beae977 100644 - ? fallback_interface : interfaces), - NULL, packet, length, ip->addresses[0], - &sp->to, NULL) < 0) { -- ++client_packet_errors; + int packet_relay_attempted = 0; + + log_debug("Server IP: %s", inet_ntoa(sp->to.sin_addr)); @@ -180,14 +179,16 @@ index 54f132a..beae977 100644 + log_debug("Packet destined for broadcast IP of %s", out->name); + if (send_packet(out, NULL, packet, + length, ip->addresses[0],&sp->to, NULL) < 0) { -+ ++client_packet_errors; -+ } else { -+ log_debug("Forwarded BOOTREQUEST for %s to %s on interface %s", -+ print_hw_addr(packet->htype, packet->hlen, -+ packet->chaddr), -+ inet_ntoa(sp->to.sin_addr), out->name); -+ -+ ++client_packets_relayed; + ++client_packet_errors; + } else { +- log_debug("Forwarded BOOTREQUEST for %s to %s", ++ log_debug("Forwarded BOOTREQUEST for %s to %s on interface %s", + print_hw_addr(packet->htype, packet->hlen, + packet->chaddr), +- inet_ntoa(sp->to.sin_addr)); ++ inet_ntoa(sp->to.sin_addr), out->name); ++ + ++client_packets_relayed; + } + + packet_relay_attempted = 1; @@ -198,8 +199,9 @@ index 54f132a..beae977 100644 + + if (packet_relay_attempted) + break; -+ } -+ + } +- } + + if (packet_relay_attempted) + continue; + @@ -217,12 +219,7 @@ index 54f132a..beae977 100644 + + ++client_packets_relayed; + } - } else { -- log_debug("Forwarded BOOTREQUEST for %s to %s", -- print_hw_addr(packet->htype, packet->hlen, -- packet->chaddr), -- inet_ntoa(sp->to.sin_addr)); -- ++client_packets_relayed; ++ } else { + for (out = interfaces; out; out = out->next) { + // Only relay BOOTREQUEST on upstream interfaces + if (!(out->flags & INTERFACE_UPSTREAM)) @@ -240,12 +237,11 @@ index 54f132a..beae977 100644 + ++client_packets_relayed; + } + } - } - } -- ++ } ++ } } - /* Strip any Relay Agent Information options from the DHCP packet + #endif /* UNIT_TEST */ -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch b/src/isc-dhcp/patch/0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch index f088b035edb4..212445307e38 100644 --- a/src/isc-dhcp/patch/0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch +++ b/src/isc-dhcp/patch/0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch @@ -14,10 +14,10 @@ didn't discover the interface(s) when it started up. 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/discover.c b/common/discover.c -index 8d5b958..5efff49 100644 +index 32f2516..31dae3c 100644 --- a/common/discover.c +++ b/common/discover.c -@@ -1016,7 +1016,8 @@ discover_interfaces(int state) { +@@ -668,7 +668,8 @@ discover_interfaces(int state) { info.flags & IFF_LOOPBACK || info.flags & IFF_POINTOPOINT) && !tmp) || (!(info.flags & IFF_UP) && @@ -25,8 +25,8 @@ index 8d5b958..5efff49 100644 + state != DISCOVER_UNCONFIGURED && + state != DISCOVER_RELAY)) continue; - + /* If there isn't already an interface by this name, -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch b/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch index 0f7495f49e7c..2fa3f0ed71de 100644 --- a/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch +++ b/src/isc-dhcp/patch/0009-Support-for-dual-tor-scenario.patch @@ -4,11 +4,11 @@ Date: Tue, 1 Dec 2020 16:33:34 -0800 Subject: [PATCH] support for dual tor scenario --- - relay/dhcrelay.c | 117 +++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 98 insertions(+), 19 deletions(-) + relay/dhcrelay.c | 115 +++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 97 insertions(+), 18 deletions(-) diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index e158efe..055d97f 100644 +index 9143e85..4134a58 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -56,6 +56,8 @@ int bogus_agent_drops = 0; /* Packets dropped because agent option @@ -34,52 +34,51 @@ index e158efe..055d97f 100644 #ifdef DHCPv6 /* Force use of DHCPv6 interface-id option. */ isc_boolean_t use_if_id = ISC_FALSE; -@@ -156,6 +165,8 @@ static int load_interface_alias_map(const char *port_alias_map_file_path); +@@ -165,6 +174,8 @@ static int load_interface_alias_map(const char *port_alias_map_file_path); static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); static void free_interface_alias_map(void); +static void free_downstream_intfs(void); + static const char copyright[] = - "Copyright 2004-2018 Internet Systems Consortium."; + "Copyright 2004-2022 Internet Systems Consortium."; static const char arr[] = "All rights reserved."; -@@ -189,6 +200,7 @@ char *progname; +@@ -198,6 +209,7 @@ char *progname; " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ +" [-dt]\n"\ " server0 [ ... serverN]\n\n" \ " %s -6 [-d] [-q] [-I] [-c ]\n" \ " [-p | -rp ]\n" \ -@@ -210,6 +222,7 @@ char *progname; +@@ -219,6 +231,7 @@ char *progname; " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ +" [-dt]\n"\ " server0 [ ... serverN]\n\n" \ " %s -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ " [-pf ] [--no-pid]\n" \ -@@ -231,6 +244,7 @@ char *progname; +@@ -240,6 +253,7 @@ char *progname; " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ +" [-dt]\n"\ " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \ " %s {--version|--help|-h}" #else -@@ -242,6 +256,7 @@ char *progname; +@@ -251,6 +265,7 @@ char *progname; " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ +" [-dt]\n"\ " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \ " %s {--version|--help|-h}" #endif -@@ -639,7 +654,16 @@ main(int argc, char **argv) { +@@ -663,6 +678,15 @@ main(int argc, char **argv) { usage(use_noarg, argv[i-1]); if (load_interface_alias_map(argv[i]) != 0) log_fatal("Failed to load interface name-alias map."); -- } else if (argv[i][0] == '-') { + } else if (!strcmp(argv[i], "-dt")) { +#ifdef DHCPv6 + if (local_family_set && (local_family == AF_INET6)) { @@ -89,11 +88,10 @@ index e158efe..055d97f 100644 + local_family = AF_INET; +#endif + enable_support_for_dual_tor = 1; -+ } else if (argv[i][0] == '-') { + } else if (argv[i][0] == '-') { usage("Unknown command: %s", argv[i]); } else { - struct hostent *he; -@@ -747,7 +771,6 @@ main(int argc, char **argv) { +@@ -771,7 +795,6 @@ main(int argc, char **argv) { log_fatal("No servers specified."); } @@ -101,7 +99,7 @@ index e158efe..055d97f 100644 /* Set up the server sockaddrs. */ for (sp = servers; sp; sp = sp->next) { sp->to.sin_port = local_port; -@@ -862,6 +885,8 @@ main(int argc, char **argv) { +@@ -886,6 +909,8 @@ main(int argc, char **argv) { /* In fact dispatch() never returns. */ free_interface_alias_map(); @@ -110,7 +108,7 @@ index e158efe..055d97f 100644 return (0); } -@@ -885,25 +910,50 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, +@@ -909,25 +934,50 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, return; } @@ -174,7 +172,7 @@ index e158efe..055d97f 100644 } /* If it's a bootreply, forward it to the client. */ -@@ -913,6 +963,10 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, +@@ -937,6 +987,10 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, return; } @@ -182,10 +180,10 @@ index e158efe..055d97f 100644 + if (enable_support_for_dual_tor && !out) + return; + + log_debug("BOOTREPLY giaddr: %s\n", inet_ntoa(packet->giaddr)); if (!(packet->flags & htons(BOOTP_BROADCAST)) && can_unicast_without_arp(out)) { - to.sin_addr = packet->yiaddr; -@@ -945,9 +999,13 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, +@@ -970,9 +1024,13 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, return; if (!out) { @@ -202,7 +200,7 @@ index e158efe..055d97f 100644 return; } -@@ -989,6 +1047,7 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1023,6 +1081,7 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, that set giaddr, so we won't see it. */ if (!packet->giaddr.s_addr) packet->giaddr = ip->addresses[0]; @@ -210,7 +208,7 @@ index e158efe..055d97f 100644 if (packet->hops < max_hop_count) packet->hops = packet->hops + 1; else -@@ -1264,7 +1323,6 @@ find_interface_by_agent_option(struct dhcp_packet *packet, +@@ -1305,7 +1364,6 @@ find_interface_by_agent_option(struct dhcp_packet *packet, /* Scan the interface list looking for an interface whose name matches the one specified in circuit_id. */ @@ -218,7 +216,7 @@ index e158efe..055d97f 100644 for (ip = interfaces; ip; ip = ip->next) { if (ip->circuit_id && ip->circuit_id_len == circuit_id_len && -@@ -1668,6 +1726,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, +@@ -1714,6 +1772,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, *sp++ = 4u; memcpy(sp, &giaddr.s_addr, 4); sp += 4; @@ -226,7 +224,7 @@ index e158efe..055d97f 100644 packet->giaddr = uplink->addresses[0]; log_debug ("Adding link selection suboption" " with addr: %s", inet_ntoa(giaddr)); -@@ -2398,6 +2457,7 @@ void request_v4_interface(const char* name, int flags) { +@@ -2451,6 +2510,7 @@ void request_v4_interface(const char* name, int flags) { struct interface_info *tmp = NULL; int len = strlen(name); isc_result_t status; @@ -234,7 +232,7 @@ index e158efe..055d97f 100644 if (len >= sizeof(tmp->name)) { log_fatal("%s: interface name too long (is %d)", name, len); -@@ -2413,6 +2473,15 @@ void request_v4_interface(const char* name, int flags) { +@@ -2466,6 +2526,15 @@ void request_v4_interface(const char* name, int flags) { (flags & INTERFACE_UPSTREAM ? 'Y' : 'N'), (flags & INTERFACE_DOWNSTREAM ? 'Y' : 'N')); @@ -247,10 +245,10 @@ index e158efe..055d97f 100644 + ci->interface = tmp; + } + - strncpy(tmp->name, name, len); + memcpy(tmp->name, name, len); interface_snorf(tmp, (INTERFACE_REQUESTED | flags)); interface_dereference(&tmp, MDL); -@@ -2487,3 +2556,13 @@ free_interface_alias_map(void) { +@@ -2540,3 +2609,13 @@ free_interface_alias_map(void) { free(g_interface_name_alias_map); g_interface_name_alias_map_size = 0; } @@ -265,5 +263,5 @@ index e158efe..055d97f 100644 + } +} -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch b/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch index 19a1192032db..039c4479e23c 100644 --- a/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch +++ b/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch @@ -4,13 +4,13 @@ Date: Fri, 12 Mar 2021 23:30:56 -0800 Subject: [PATCH] add option -si to support using src intf ip in relay --- - common/socket.c | 119 ++++++++++++++++++++++++++++++++++++----------- + common/socket.c | 120 +++++++++++++++++++++++++++++++++++------------ includes/dhcpd.h | 1 + - relay/dhcrelay.c | 8 ++++ - 3 files changed, 100 insertions(+), 28 deletions(-) + relay/dhcrelay.c | 2 + + 3 files changed, 94 insertions(+), 29 deletions(-) diff --git a/common/socket.c b/common/socket.c -index 483eb9c..da9f501 100644 +index 3953eac..eae86e8 100644 --- a/common/socket.c +++ b/common/socket.c @@ -83,6 +83,29 @@ static unsigned int global_v4_socket_references = 0; @@ -43,7 +43,7 @@ index 483eb9c..da9f501 100644 /* * If we can't bind() to a specific interface, then we can only have * a single socket. This variable insures that we don't try to listen -@@ -712,37 +735,77 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) +@@ -722,38 +745,77 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct hardware *hto; { int result; @@ -59,8 +59,9 @@ index 483eb9c..da9f501 100644 - pktinfo.ipi_ifindex = interface->ifp->ifr_index; - if (setsockopt(interface->wfdesc, IPPROTO_IP, - IP_PKTINFO, (char *)&pktinfo, -- sizeof(pktinfo)) < 0) -- log_fatal("setsockopt: IP_PKTINFO: %m"); +- sizeof(pktinfo)) < 0) +- log_fatal("setsockopt: IP_PKTINFO for %s: %m", +- (char*)(interface->ifp)); + struct msghdr m; + struct iovec v; + struct sockaddr_in dst; @@ -150,10 +151,10 @@ index 483eb9c..da9f501 100644 } diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index 36cd518..0c25582 100644 +index b54a36e..68d44cf 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -2660,6 +2660,7 @@ ssize_t send_fallback6(struct interface_info *, struct packet *, +@@ -2676,6 +2676,7 @@ ssize_t send_fallback6(struct interface_info *, struct packet *, #endif #ifdef USE_SOCKET_SEND @@ -162,10 +163,10 @@ index 36cd518..0c25582 100644 void if_register_send (struct interface_info *); void if_deregister_send (struct interface_info *); diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 221106a..c44a79d 100644 +index ccf7417..6aa1179 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c -@@ -431,6 +431,8 @@ main(int argc, char **argv) { +@@ -440,6 +440,8 @@ main(int argc, char **argv) { #endif } else if (!strcmp(argv[i], "-d")) { /* no_daemon = 1; */ @@ -175,5 +176,5 @@ index 221106a..c44a79d 100644 quiet = 1; quiet_interface_discovery = 1; -- -2.17.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0014-enable-parallel-build.patch b/src/isc-dhcp/patch/0014-enable-parallel-build.patch index 4b451b910c15..a4b4091eae91 100644 --- a/src/isc-dhcp/patch/0014-enable-parallel-build.patch +++ b/src/isc-dhcp/patch/0014-enable-parallel-build.patch @@ -1,8 +1,8 @@ diff --git a/debian/rules b/debian/rules -index 3c8318f..28f4657 100755 +index 3d12fb5..f9962ac 100755 --- a/debian/rules +++ b/debian/rules -@@ -37,6 +37,13 @@ export DO_LPF=1 +@@ -38,6 +38,13 @@ export DO_LPF=1 CONFFLAGS+=--enable-use-sockets endif @@ -14,29 +14,32 @@ index 3c8318f..28f4657 100755 +endif + %: - dh $@ --parallel --with autoreconf + dh $@ --with autoreconf -@@ -46,17 +53,17 @@ override_dh_auto_build: +@@ -62,19 +69,19 @@ override_dh_auto_build: # ldap-enabled build test -f Makefile && $(MAKE) distclean || true - ./configure --with-ldap --with-ldapcrypto CFLAGS="$(CFLAGS) -DNSUPDATE" LIBS="-lirs-export $(LIBS)" $(CONFFLAGS) + ./configure --with-ldap --with-ldapcrypto CFLAGS="$(CFLAGS) -DNSUPDATE" $(CONFFLAGS) LIBS="$(LIBS) -latomic" - $(MAKE) + $(MAKE) $(PARALLEL) mv server/dhcpd dhcpd # ddns-disabled build test -f Makefile && $(MAKE) distclean || true - ./configure CFLAGS="$(CFLAGS)" $(CONFFLAGS) + ./configure CFLAGS="$(CFLAGS)" $(CONFFLAGS) LIBS="$(LIBS) -latomic" - $(MAKE) + $(MAKE) $(PARALLEL) mv client/dhclient dhclient # ldap-disabled build test -f Makefile && $(MAKE) distclean || true - ./configure CFLAGS="$(CFLAGS) -DNSUPDATE" LIBS="-lirs-export $(LIBS)" $(CONFFLAGS) + ./configure CFLAGS="$(CFLAGS) -DNSUPDATE" $(CONFFLAGS) LIBS="$(LIBS) -latomic" - $(MAKE) + $(MAKE) $(PARALLEL) + # keama build +- $(MAKE) -C keama ++ $(MAKE) $(PARALLEL) -C keama - override_dh_install: - # rename some upstream files + override_dh_auto_test: + /bin/sh keama/tests/runall.sh 2> /tmp/keama-test-errors -- -2.34.1 +2.25.1 diff --git a/src/isc-dhcp/patch/0015-option-to-set-primary-address-in-interface.patch b/src/isc-dhcp/patch/0015-option-to-set-primary-address-in-interface.patch index 67283ba02c0a..b68ce0cb2db3 100644 --- a/src/isc-dhcp/patch/0015-option-to-set-primary-address-in-interface.patch +++ b/src/isc-dhcp/patch/0015-option-to-set-primary-address-in-interface.patch @@ -1,8 +1,8 @@ diff --git a/common/discover.c b/common/discover.c -index ab50234..40e13f5 100644 +index 20d7c54..9ee8bc2 100644 --- a/common/discover.c +++ b/common/discover.c -@@ -1614,3 +1614,16 @@ void interface_snorf (struct interface_info *tmp, int ir) +@@ -1619,3 +1619,16 @@ void interface_snorf (struct interface_info *tmp, int ir) } interface_reference (&interfaces, tmp, MDL); } @@ -21,10 +21,10 @@ index ab50234..40e13f5 100644 +} \ No newline at end of file diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index 257b31e..e7f9f06 100644 +index 68d44cf..8c307b6 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -2873,6 +2873,7 @@ extern int interface_count; +@@ -2885,6 +2885,7 @@ extern int interface_count; extern int interface_max; isc_result_t interface_initialize(omapi_object_t *, const char *, int); void discover_interfaces(int); @@ -33,7 +33,7 @@ index 257b31e..e7f9f06 100644 int if_readsocket (omapi_object_t *); void reinitialize_interfaces (void); diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index ff0ad17..31fe61b 100644 +index 6aa1179..a1aa234 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -92,6 +92,11 @@ struct downstream_intf_list { @@ -48,23 +48,23 @@ index ff0ad17..31fe61b 100644 #ifdef DHCPv6 /* Force use of DHCPv6 interface-id option. */ isc_boolean_t use_if_id = ISC_FALSE; -@@ -199,6 +204,7 @@ char *progname; +@@ -208,6 +213,7 @@ char *progname; " [-i interface0 [ ... -i interfaceN]\n" \ " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ +" [-pg ip-address0 [ ... -pg ip-addressN]]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ " [-dt]\n"\ " server0 [ ... serverN]\n\n" \ -@@ -221,6 +227,7 @@ char *progname; +@@ -230,6 +236,7 @@ char *progname; " [-i interface0 [ ... -i interfaceN]\n" \ " [-iu interface0 [ ... -iu interfaceN]\n" \ " [-id interface0 [ ... -id interfaceN]\n" \ +" [-pg ip-address0 [ ... -pg ip-addressN]]\n" \ - " [-U interface]\n" \ + " [-U interface] [-g ]\n" \ " [-dt]\n"\ " server0 [ ... serverN]\n\n" \ -@@ -649,6 +656,34 @@ main(int argc, char **argv) { +@@ -673,6 +680,34 @@ main(int argc, char **argv) { usage(use_noarg, argv[i-1]); path_dhcrelay_pid = argv[i]; no_dhcrelay_pid = ISC_TRUE; @@ -99,7 +99,7 @@ index ff0ad17..31fe61b 100644 } else if (!strcmp(argv[i], "--no-pid")) { no_pid_file = ISC_TRUE; } else if (!strcmp(argv[i], "--name-alias-map-file")) { -@@ -818,6 +853,12 @@ main(int argc, char **argv) { +@@ -842,6 +877,12 @@ main(int argc, char **argv) { /* Discover all the network interfaces. */ discover_interfaces(DISCOVER_RELAY); @@ -112,3 +112,6 @@ index ff0ad17..31fe61b 100644 #ifdef DHCPv6 if (local_family == AF_INET6) setup_streams(); +-- +2.25.1 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index 8f1ec7f1a0fe..e0d6d9a3a73a 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -3,15 +3,15 @@ 0002-Customizable-Option-82-circuit-ID-and-remote-ID-fiel.patch 0003-Support-for-obtaining-name-of-physical-interface-tha.patch 0004-Support-for-loading-port-alias-map-file-to-replace-p.patch -# 0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch -# 0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch -# 0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch -# 0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch -# 0009-Support-for-dual-tor-scenario.patch -# 0010-Bugfix-correctly-set-interface-netmask.patch -# 0011-dhcp-relay-Prevent-Buffer-Overrun.patch -# 0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch +0005-Add-enable-use-sockets-to-configure-flags-in-debian-.patch +0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +0007-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch +0008-Don-t-skip-down-interfaces-when-discovering-interfac.patch +0009-Support-for-dual-tor-scenario.patch +0010-Bugfix-correctly-set-interface-netmask.patch +0011-dhcp-relay-Prevent-Buffer-Overrun.patch +0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch # 0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch -# 0014-enable-parallel-build.patch -# 0015-option-to-set-primary-address-in-interface.patch -# 0016-Don-t-look-up-the-ifindex-for-fallback.patch +0014-enable-parallel-build.patch +0015-option-to-set-primary-address-in-interface.patch +0016-Don-t-look-up-the-ifindex-for-fallback.patch From c32c03e9b4f5a214b0c36cdc3bb59bb6b1a4a86e Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Mon, 29 Jan 2024 23:10:10 -0500 Subject: [PATCH 10/14] Fix sonic-dhcp-relay --- rules/isc-dhcp.mk | 6 ++---- sonic-slave-bookworm/Dockerfile.j2 | 4 +++- src/isc-dhcp/Makefile | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index d3505ec8e40b..308367b25198 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,10 +1,8 @@ # isc-dhcp packages -ISC_DHCP_VERSION = 4.4.3 -ISC_DHCP_VERSION_MID = ${ISC_DHCP_VERSION}-P1 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION_MID}-4 +ISC_DHCP_VERSION = 4.4.3-P1 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-4 -export ISC_DHCP_VERSION_MID export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION_FULL)_$(CONFIGURED_ARCH).deb diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 6bf09c425cd1..8ebb1b2b01f1 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -418,7 +418,9 @@ RUN apt-get update && apt-get install -y \ auditd \ # For protobuf protobuf-compiler \ - libprotobuf-dev + libprotobuf-dev \ +# For sonic-dhcp6relay build + libjsoncpp-dev {%- if CROSS_BUILD_ENVIRON == "y" %} # Arm vs. amd64 versions conflict - remove amd64 packages diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 5d8fe0137595..22d6801ccafe 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -11,7 +11,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Get isc-dhcp release, debian files dget -u http://deb.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp_$(ISC_DHCP_VERSION_FULL).dsc - pushd ./isc-dhcp-$(ISC_DHCP_VERSION_MID) + pushd ./isc-dhcp-$(ISC_DHCP_VERSION) # Create a git repository here for stg to apply patches git init From c38dd8f2f68ee2f3d2cfefe9f31ef8a97b0d2f66 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Mon, 29 Jan 2024 23:30:15 -0500 Subject: [PATCH 11/14] Remove patch13 --- ...ay-agent-option-buffer-pointer-logic.patch | 53 ------------------- src/isc-dhcp/patch/series | 1 - 2 files changed, 54 deletions(-) delete mode 100644 src/isc-dhcp/patch/0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch diff --git a/src/isc-dhcp/patch/0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch b/src/isc-dhcp/patch/0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch deleted file mode 100644 index 051b58966cae..000000000000 --- a/src/isc-dhcp/patch/0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0a2f9a62bceb90b0d30461add2e25c4ce7a24547 Mon Sep 17 00:00:00 2001 -From: Thomas Markwalder -Date: Fri, 20 Dec 2019 10:11:54 -0500 -Subject: [PATCH] [#71] Fix dhcrelay agent option buffer pointer logic - -relay/dhcrelay.c - strip_relay_agent_options() - strip_relay_agent_options() - - corrected buffer pointer logic - ---- - relay/dhcrelay.c | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - -diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index 896e1e2e..980dacae 100644 ---- a/relay/dhcrelay.c -+++ b/relay/dhcrelay.c -@@ -1238,8 +1238,13 @@ strip_relay_agent_options(struct interface_info *in, - return (0); - - if (sp != op) { -- memmove(sp, op, op[1] + 2); -- sp += op[1] + 2; -+ size_t mlen = op[1] + 2; -+ memmove(sp, op, mlen); -+ sp += mlen; -+ if (sp > max) { -+ return (0); -+ } -+ - op = nextop; - } else - op = sp = nextop; -@@ -1620,8 +1620,13 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, - end_pad = NULL; - - if (sp != op) { -- memmove(sp, op, op[1] + 2); -- sp += op[1] + 2; -+ size_t mlen = op[1] + 2; -+ memmove(sp, op, mlen); -+ sp += mlen; -+ if (sp > max) { -+ return (0); -+ } -+ - op = nextop; - } else - op = sp = nextop; --- -2.17.1 - diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index e0d6d9a3a73a..755200d9eb99 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -11,7 +11,6 @@ 0010-Bugfix-correctly-set-interface-netmask.patch 0011-dhcp-relay-Prevent-Buffer-Overrun.patch 0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch -# 0013-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch 0014-enable-parallel-build.patch 0015-option-to-set-primary-address-in-interface.patch 0016-Don-t-look-up-the-ifindex-for-fallback.patch From 9915c71a2d232d63e40fbdbf06e423cc26122bcf Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Wed, 31 Jan 2024 08:42:44 +0000 Subject: [PATCH 12/14] Update patch6 --- ...VE_SO_BINDTODEVICE-has-a-chance-to-b.patch | 456 +++++++++--------- 1 file changed, 227 insertions(+), 229 deletions(-) diff --git a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch index 7e7d585a7d8f..e6cb53aca035 100644 --- a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +++ b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch @@ -5,276 +5,274 @@ Subject: [PATCH 2/3] Bugfix: Ensure HAVE_SO_BINDTODEVICE has a chance to be defined before it is referenced --- - includes/osdep.h | 237 +++++++++++++++++++++++------------------------ - 1 file changed, 117 insertions(+), 120 deletions(-) + includes/osdep.h | 239 ++++++++++++++++++++++++----------------------- + 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/includes/osdep.h b/includes/osdep.h -index 0742858..29c5328 100644 +index 0742858..1ed5293 100644 --- a/includes/osdep.h +++ b/includes/osdep.h -@@ -47,6 +47,123 @@ +@@ -47,37 +47,6 @@ #define BYTE_ORDER DHCP_BYTE_ORDER #endif /* BYTE_ORDER */ -+#if !defined (TIME_MAX) -+# define TIME_MAX 2147483647 -+#endif -+ -+/* snprintf/vsnprintf hacks. for systems with no libc versions only. */ -+#ifdef NO_SNPRINTF -+ extern int isc_print_snprintf(char *, size_t, const char *, ...); -+ extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); -+# define snprintf isc_print_snprintf -+# define vsnprintf isc_print_vsnprintf -+#endif -+ -+/* If we don't have a DLPI packet filter, we have to filter in userland. -+ Probably not worth doing, actually. */ -+#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) -+# define USERLAND_FILTER -+#endif -+ -+/* jmp_buf is assumed to be a struct unless otherwise defined in the -+ system header. */ -+#ifndef jbp_decl -+# define jbp_decl(x) jmp_buf *x -+#endif -+#ifndef jref -+# define jref(x) (&(x)) -+#endif -+#ifndef jdref -+# define jdref(x) (*(x)) -+#endif -+#ifndef jrefproto -+# define jrefproto jmp_buf * -+#endif -+ -+#ifndef BPF_FORMAT -+# define BPF_FORMAT "/dev/bpf%d" -+#endif -+ -+#if defined (F_SETFD) && !defined (HAVE_SETFD) -+# define HAVE_SETFD -+#endif -+ -+#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) -+# define HAVE_IFF_POINTOPOINT -+#endif -+ -+#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -+# define HAVE_AF_LINK -+#endif -+ -+#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) -+# define HAVE_ARPHRD_TUNNEL -+#endif -+ -+#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) -+# define HAVE_ARPHRD_LOOPBACK -+#endif -+ -+#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) -+# define HAVE_ARPHRD_ROSE -+#endif -+ -+#if defined (ARPHRD_IRDA) && !defined (HAVE_ARPHRD_IRDA) -+# define HAVE_ARPHRD_IRDA -+#endif -+ -+#if defined (ARPHRD_SIT) && !defined (HAVE_ARPHRD_SIT) -+# define HAVE_ARPHRD_SIT -+#endif -+ -+#if defined (ARPHRD_IEEE1394) & !defined (HAVE_ARPHRD_IEEE1394) -+# define HAVE_ARPHRD_IEEE1394 -+#endif -+ -+#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) -+# define HAVE_ARPHRD_IEEE802 -+#endif -+ -+#if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR) -+# define HAVE_ARPHRD_IEEE802_TR -+#endif -+ -+#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) -+# define HAVE_ARPHRD_FDDI -+#endif -+ -+#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) -+# define HAVE_ARPHRD_AX25 -+#endif -+ -+#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) -+# define HAVE_ARPHRD_NETROM -+#endif -+ -+#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) -+# define HAVE_ARPHRD_METRICOM -+#endif -+ -+#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -+# define HAVE_AF_LINK -+#endif -+ -+/* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */ -+#if !defined (SHUT_RD) -+# define SHUT_RD 0 -+#endif -+ -+#if !defined (SOCKLEN_T) -+# define SOCKLEN_T socklen_t -+#elif defined(_AIX) -+#undef SOCKLEN_T -+#define SOCKLEN_T socklen_t -+#endif -+ -+#if !defined (STDERR_FILENO) -+# define STDERR_FILENO 2 -+#endif -+ - /* Porting:: - - If you add a new network API, you must add a check for it below: */ -@@ -78,18 +195,6 @@ - # endif - #endif - --#if !defined (TIME_MAX) --# define TIME_MAX 2147483647 --#endif +-/* Porting:: - --/* snprintf/vsnprintf hacks. for systems with no libc versions only. */ --#ifdef NO_SNPRINTF -- extern int isc_print_snprintf(char *, size_t, const char *, ...); -- extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); --# define snprintf isc_print_snprintf --# define vsnprintf isc_print_vsnprintf --#endif +- If you add a new network API, you must add a check for it below: */ - - /* Porting:: - - If you add a new network API, and have it set up so that it can be -@@ -138,10 +243,6 @@ - # define USE_UPF_RECEIVE - #endif - --#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) --# define HAVE_SO_BINDTODEVICE +-#if !defined (USE_SOCKETS) && \ +- !defined (USE_SOCKET_SEND) && \ +- !defined (USE_SOCKET_RECEIVE) && \ +- !defined (USE_RAW_SOCKETS) && \ +- !defined (USE_RAW_SEND) && \ +- !defined (USE_SOCKET_RECEIVE) && \ +- !defined (USE_BPF) && \ +- !defined (USE_BPF_SEND) && \ +- !defined (USE_BPF_RECEIVE) && \ +- !defined (USE_LPF) && \ +- !defined (USE_LPF_SEND) && \ +- !defined (USE_LPF_RECEIVE) && \ +- !defined (USE_NIT) && \ +- !defined (USE_NIT_SEND) && \ +- !defined (USE_NIT_RECEIVE) && \ +- !defined (USE_DLPI_SEND) && \ +- !defined (USE_DLPI_RECEIVE) +-/* Determine default socket API to USE. */ +-# if defined(HAVE_BPF) +-# define USE_BPF 1 +-# elif defined(HAVE_LPF) +-# define USE_LPF 1 +-# elif defined(HAVE_DLPI) +-# define USE_DLPI 1 +-# endif -#endif - - /* Porting:: - - If you add support for sending packets directly out an interface, -@@ -182,109 +283,5 @@ - # define PACKET_DECODING + #if !defined (TIME_MAX) + # define TIME_MAX 2147483647 #endif - --/* If we don't have a DLPI packet filter, we have to filter in userland. -- Probably not worth doing, actually. */ --#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) --# define USERLAND_FILTER +@@ -88,98 +57,10 @@ + extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); + # define snprintf isc_print_snprintf + # define vsnprintf isc_print_vsnprintf -#endif - --/* jmp_buf is assumed to be a struct unless otherwise defined in the -- system header. */ --#ifndef jbp_decl --# define jbp_decl(x) jmp_buf *x --#endif --#ifndef jref --# define jref(x) (&(x)) --#endif --#ifndef jdref --# define jdref(x) (*(x)) --#endif --#ifndef jrefproto --# define jrefproto jmp_buf * --#endif +-/* Porting:: - --#ifndef BPF_FORMAT --# define BPF_FORMAT "/dev/bpf%d" --#endif +- If you add a new network API, and have it set up so that it can be +- used for sending or receiving, but doesn't have to be used for both, +- then set up an ifdef like the ones below: */ - --#if defined (F_SETFD) && !defined (HAVE_SETFD) --# define HAVE_SETFD +-#ifdef USE_SOCKETS +-# define USE_SOCKET_SEND +-# define USE_SOCKET_RECEIVE +-# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) +-# define USE_DLPI_HWADDR +-# elif defined(HAVE_LPF) +-# define USE_LPF_HWADDR +-# elif defined(HAVE_BPF) +-# define USE_BPF_HWADDR +-# endif -#endif - --#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) --# define HAVE_IFF_POINTOPOINT +-#ifdef USE_RAW_SOCKETS +-# define USE_RAW_SEND +-# define USE_SOCKET_RECEIVE -#endif - --#if defined (AF_LINK) && !defined (HAVE_AF_LINK) --# define HAVE_AF_LINK +-#ifdef USE_BPF +-# define USE_BPF_SEND +-# define USE_BPF_RECEIVE -#endif - --#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) --# define HAVE_ARPHRD_TUNNEL +-#ifdef USE_LPF +-# define USE_LPF_SEND +-# define USE_LPF_RECEIVE -#endif - --#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) --# define HAVE_ARPHRD_LOOPBACK +-#ifdef USE_NIT +-# define USE_NIT_SEND +-# define USE_NIT_RECEIVE -#endif - --#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) --# define HAVE_ARPHRD_ROSE +-#ifdef USE_DLPI +-# define USE_DLPI_SEND +-# define USE_DLPI_RECEIVE -#endif - --#if defined (ARPHRD_IRDA) && !defined (HAVE_ARPHRD_IRDA) --# define HAVE_ARPHRD_IRDA +-#ifdef USE_UPF +-# define USE_UPF_SEND +-# define USE_UPF_RECEIVE -#endif + + #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) + # define HAVE_SO_BINDTODEVICE + #endif - --#if defined (ARPHRD_SIT) && !defined (HAVE_ARPHRD_SIT) --# define HAVE_ARPHRD_SIT --#endif +-/* Porting:: - --#if defined (ARPHRD_IEEE1394) & !defined (HAVE_ARPHRD_IEEE1394) --# define HAVE_ARPHRD_IEEE1394 --#endif +- If you add support for sending packets directly out an interface, +- and your support does not do ARP or routing, you must use a fallback +- mechanism to deal with packets that need to be sent to routers. +- Currently, all low-level packet interfaces use BSD sockets as a +- fallback. */ - --#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) --# define HAVE_ARPHRD_IEEE802 +-#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ +- defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ +- defined (USE_LPF_SEND) || \ +- (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) +-# define USE_SOCKET_FALLBACK +-# define USE_FALLBACK -#endif - --#if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR) --# define HAVE_ARPHRD_IEEE802_TR --#endif +-/* Porting:: - --#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) --# define HAVE_ARPHRD_FDDI --#endif +- If you add support for sending packets directly out an interface +- and need to be able to assemble packets, add the USE_XXX_SEND +- definition for your interface to the list tested below. */ - --#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) --# define HAVE_ARPHRD_AX25 +-#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ +- defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ +- defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) +-# define PACKET_ASSEMBLY -#endif - --#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) --# define HAVE_ARPHRD_NETROM --#endif +-/* Porting:: - --#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) --# define HAVE_ARPHRD_METRICOM --#endif +- If you add support for receiving packets directly from an interface +- and need to be able to decode raw packets, add the USE_XXX_RECEIVE +- definition for your interface to the list tested below. */ - --#if defined (AF_LINK) && !defined (HAVE_AF_LINK) --# define HAVE_AF_LINK --#endif -- --/* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */ --#if !defined (SHUT_RD) --# define SHUT_RD 0 --#endif -- --#if !defined (SOCKLEN_T) --# define SOCKLEN_T socklen_t --#elif defined(_AIX) --#undef SOCKLEN_T --#define SOCKLEN_T socklen_t --#endif -- --#if !defined (STDERR_FILENO) --# define STDERR_FILENO 2 --#endif +-#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ +- defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ +- defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) +-# define PACKET_DECODING + #endif + + /* If we don't have a DLPI packet filter, we have to filter in userland. +@@ -287,4 +168,124 @@ + # define STDERR_FILENO 2 + #endif ++/* Porting:: ++ ++ If you add a new network API, you must add a check for it below: */ ++ ++#if !defined (USE_SOCKETS) && \ ++ !defined (USE_SOCKET_SEND) && \ ++ !defined (USE_SOCKET_RECEIVE) && \ ++ !defined (USE_RAW_SOCKETS) && \ ++ !defined (USE_RAW_SEND) && \ ++ !defined (USE_SOCKET_RECEIVE) && \ ++ !defined (USE_BPF) && \ ++ !defined (USE_BPF_SEND) && \ ++ !defined (USE_BPF_RECEIVE) && \ ++ !defined (USE_LPF) && \ ++ !defined (USE_LPF_SEND) && \ ++ !defined (USE_LPF_RECEIVE) && \ ++ !defined (USE_NIT) && \ ++ !defined (USE_NIT_SEND) && \ ++ !defined (USE_NIT_RECEIVE) && \ ++ !defined (USE_DLPI_SEND) && \ ++ !defined (USE_DLPI_RECEIVE) ++/* Determine default socket API to USE. */ ++# if defined(HAVE_BPF) ++# define USE_BPF 1 ++# elif defined(HAVE_LPF) ++# define USE_LPF 1 ++# elif defined(HAVE_DLPI) ++# define USE_DLPI 1 ++# endif ++#endif ++ ++/* Porting:: ++ ++ If you add a new network API, and have it set up so that it can be ++ used for sending or receiving, but doesn't have to be used for both, ++ then set up an ifdef like the ones below: */ ++ ++#ifdef USE_SOCKETS ++# define USE_SOCKET_SEND ++# define USE_SOCKET_RECEIVE ++# if defined(HAVE_DLPI) && !defined(sun) && !defined(USE_V4_PKTINFO) ++# define USE_DLPI_HWADDR ++# elif defined(HAVE_LPF) ++# define USE_LPF_HWADDR ++# elif defined(HAVE_BPF) ++# define USE_BPF_HWADDR ++# endif ++#endif ++ ++#ifdef USE_RAW_SOCKETS ++# define USE_RAW_SEND ++# define USE_SOCKET_RECEIVE ++#endif ++ ++#ifdef USE_BPF ++# define USE_BPF_SEND ++# define USE_BPF_RECEIVE ++#endif ++ ++#ifdef USE_LPF ++# define USE_LPF_SEND ++# define USE_LPF_RECEIVE ++#endif ++ ++#ifdef USE_NIT ++# define USE_NIT_SEND ++# define USE_NIT_RECEIVE ++#endif ++ ++#ifdef USE_DLPI ++# define USE_DLPI_SEND ++# define USE_DLPI_RECEIVE ++#endif ++ ++#ifdef USE_UPF ++# define USE_UPF_SEND ++# define USE_UPF_RECEIVE ++#endif ++ ++/* Porting:: ++ ++ If you add support for sending packets directly out an interface, ++ and your support does not do ARP or routing, you must use a fallback ++ mechanism to deal with packets that need to be sent to routers. ++ Currently, all low-level packet interfaces use BSD sockets as a ++ fallback. */ ++ ++#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ ++ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ ++ defined (USE_LPF_SEND) || \ ++ (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) ++# define USE_SOCKET_FALLBACK ++# define USE_FALLBACK ++#endif ++ ++/* Porting:: ++ ++ If you add support for sending packets directly out an interface ++ and need to be able to assemble packets, add the USE_XXX_SEND ++ definition for your interface to the list tested below. */ ++ ++#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ ++ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ ++ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) ++# define PACKET_ASSEMBLY ++#endif ++ ++/* Porting:: ++ ++ If you add support for receiving packets directly from an interface ++ and need to be able to decode raw packets, add the USE_XXX_RECEIVE ++ definition for your interface to the list tested below. */ ++ ++#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ ++ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ ++ defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) ++# define PACKET_DECODING ++#endif ++ ++ #endif /* __ISC_DHCP_OSDEP_H__ */ -- 2.25.1 From aa3df68bddca52b0dd4b358d920506f48a91b860 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Tue, 6 Feb 2024 12:51:35 +0000 Subject: [PATCH 13/14] Update patch --- ...VE_SO_BINDTODEVICE-has-a-chance-to-b.patch | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch index e6cb53aca035..f0e06b692e1b 100644 --- a/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +++ b/src/isc-dhcp/patch/0006-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch @@ -9,7 +9,7 @@ Subject: [PATCH 2/3] Bugfix: Ensure HAVE_SO_BINDTODEVICE has a chance to be 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/includes/osdep.h b/includes/osdep.h -index 0742858..1ed5293 100644 +index 0742858..dfccb8c 100644 --- a/includes/osdep.h +++ b/includes/osdep.h @@ -47,37 +47,6 @@ @@ -50,12 +50,10 @@ index 0742858..1ed5293 100644 #if !defined (TIME_MAX) # define TIME_MAX 2147483647 #endif -@@ -88,98 +57,10 @@ - extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap); - # define snprintf isc_print_snprintf +@@ -90,98 +59,10 @@ # define vsnprintf isc_print_vsnprintf --#endif -- + #endif + -/* Porting:: - - If you add a new network API, and have it set up so that it can be @@ -103,11 +101,11 @@ index 0742858..1ed5293 100644 -# define USE_UPF_SEND -# define USE_UPF_RECEIVE -#endif - +- #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) # define HAVE_SO_BINDTODEVICE #endif -- + -/* Porting:: - - If you add support for sending packets directly out an interface, @@ -146,9 +144,11 @@ index 0742858..1ed5293 100644 - defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ - defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) -# define PACKET_DECODING - #endif - +-#endif +- /* If we don't have a DLPI packet filter, we have to filter in userland. + Probably not worth doing, actually. */ + #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) @@ -287,4 +168,124 @@ # define STDERR_FILENO 2 #endif From 0ac4f7c9b93e25c10ef708f6ca04b638c518a1c3 Mon Sep 17 00:00:00 2001 From: yaqiangz Date: Mon, 11 Mar 2024 06:58:56 +0000 Subject: [PATCH 14/14] Update version --- rules/isc-dhcp.mk | 2 +- src/isc-dhcp/patch/0014-enable-parallel-build.patch | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 308367b25198..803ffba7a0d1 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,7 +1,7 @@ # isc-dhcp packages ISC_DHCP_VERSION = 4.4.3-P1 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-4 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2 export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL diff --git a/src/isc-dhcp/patch/0014-enable-parallel-build.patch b/src/isc-dhcp/patch/0014-enable-parallel-build.patch index a4b4091eae91..38860e21d94e 100644 --- a/src/isc-dhcp/patch/0014-enable-parallel-build.patch +++ b/src/isc-dhcp/patch/0014-enable-parallel-build.patch @@ -1,5 +1,5 @@ diff --git a/debian/rules b/debian/rules -index 3d12fb5..f9962ac 100755 +index 0906e53..6e96ffe 100755 --- a/debian/rules +++ b/debian/rules @@ -38,6 +38,13 @@ export DO_LPF=1 @@ -14,9 +14,9 @@ index 3d12fb5..f9962ac 100755 +endif + %: - dh $@ --with autoreconf + dh $@ --parallel --with autoreconf -@@ -62,19 +69,19 @@ override_dh_auto_build: +@@ -59,17 +66,17 @@ override_dh_auto_build: # ldap-enabled build test -f Makefile && $(MAKE) distclean || true ./configure --with-ldap --with-ldapcrypto CFLAGS="$(CFLAGS) -DNSUPDATE" $(CONFFLAGS) LIBS="$(LIBS) -latomic" @@ -34,12 +34,9 @@ index 3d12fb5..f9962ac 100755 ./configure CFLAGS="$(CFLAGS) -DNSUPDATE" $(CONFFLAGS) LIBS="$(LIBS) -latomic" - $(MAKE) + $(MAKE) $(PARALLEL) - # keama build -- $(MAKE) -C keama -+ $(MAKE) $(PARALLEL) -C keama - override_dh_auto_test: - /bin/sh keama/tests/runall.sh 2> /tmp/keama-test-errors + override_dh_install: + # rename some upstream files -- 2.25.1