From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH] dnsmasq: Update to 2.76rc1 - added latest patches (001-002) Date: Fri, 13 May 2016 19:06:10 +0200 Message-ID: <1463159170-1234-1-git-send-email-matthias.fischer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4187721659467489114==" List-Id: --===============4187721659467489114== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update, added latest patches and deleted obsolete patch files. Signed-off-by: Matthias Fischer --- lfs/dnsmasq | 12 +- ...q-Add-support-to-read-ISC-DHCP-lease-file.patch | 23 +- .../dnsmasq/001-Debian_init_d_script_fix.patch | 74 --- ...in_PXE_arch_names_and_add_ARM32_and_ARM64.patch | 62 +++ .../dnsmasq/002-Add_--help_to_manpage.patch | 66 --- ...CSAs_affected_by_UEFI_PXE_workaround_code.patch | 25 + ...nd_dhcp_lease_time_to_contrib_lease_tools.patch | 73 --- ...004-Add_contrib_lease-tools_dhcp_release6.patch | 528 -------------------= -- ...am_nameservers_when_logging_configuration.patch | 85 ---- ..._interface_when_--bridge-interface_in_use.patch | 70 --- 10 files changed, 110 insertions(+), 908 deletions(-) delete mode 100644 src/patches/dnsmasq/001-Debian_init_d_script_fix.patch create mode 100644 src/patches/dnsmasq/001-Fix_error_in_PXE_arch_names_and_a= dd_ARM32_and_ARM64.patch delete mode 100644 src/patches/dnsmasq/002-Add_--help_to_manpage.patch create mode 100644 src/patches/dnsmasq/002-Tweak_CSAs_affected_by_UEFI_PXE_w= orkaround_code.patch delete mode 100644 src/patches/dnsmasq/003-Move_dhcp_release_and_dhcp_lease_= time_to_contrib_lease_tools.patch delete mode 100644 src/patches/dnsmasq/004-Add_contrib_lease-tools_dhcp_rele= ase6.patch delete mode 100644 src/patches/dnsmasq/005-Limit_number_of_upstream_nameserv= ers_when_logging_configuration.patch delete mode 100644 src/patches/dnsmasq/006-Fix_for_DHCP_in_transmission_inte= rface_when_--bridge-interface_in_use.patch diff --git a/lfs/dnsmasq b/lfs/dnsmasq index feb1789..dc4da18 100644 --- a/lfs/dnsmasq +++ b/lfs/dnsmasq @@ -24,7 +24,7 @@ =20 include Config =20 -VER =3D 2.76test13 +VER =3D 2.76rc1 =20 THISAPP =3D dnsmasq-$(VER) DL_FILE =3D $(THISAPP).tar.xz @@ -43,7 +43,7 @@ objects =3D $(DL_FILE) =20 $(DL_FILE) =3D $(DL_FROM)/$(DL_FILE) =20 -$(DL_FILE)_MD5 =3D bb66cef5b41e0cddf8272b0911855568 +$(DL_FILE)_MD5 =3D 08c203ee2e0d3ed8babf056b69a6265e =20 install : $(TARGET) =20 @@ -73,12 +73,8 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/001-Debian_in= it_d_script_fix.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/002-Add_--hel= p_to_manpage.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/003-Move_dhcp= _release_and_dhcp_lease_time_to_contrib_lease_tools.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/004-Add_contr= ib_lease-tools_dhcp_release6.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/005-Limit_num= ber_of_upstream_nameservers_when_logging_configuration.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/006-Fix_for_D= HCP_in_transmission_interface_when_--bridge-interface_in_use.patch + cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/001-Fix_error= _in_PXE_arch_names_and_add_ARM32_and_ARM64.patch + cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq/002-Tweak_CSA= s_affected_by_UEFI_PXE_workaround_code.patch cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq-Add-support-t= o-read-ISC-DHCP-lease-file.patch =20 cd $(DIR_APP) && sed -i src/config.h \ diff --git a/src/patches/dnsmasq-Add-support-to-read-ISC-DHCP-lease-file.patc= h b/src/patches/dnsmasq-Add-support-to-read-ISC-DHCP-lease-file.patch index 703e94f..25feb8d 100644 --- a/src/patches/dnsmasq-Add-support-to-read-ISC-DHCP-lease-file.patch +++ b/src/patches/dnsmasq-Add-support-to-read-ISC-DHCP-lease-file.patch @@ -42,7 +42,7 @@ =20 --- a/src/dnsmasq.c Thu Jul 30 20:59:06 2015 +++ b/src/dnsmasq.c Wed Dec 16 19:38:32 2015 -@@ -1013,6 +1013,11 @@ +@@ -1016,6 +1016,11 @@ =20 poll_resolv(0, daemon->last_resolv !=3D 0, now); =20 daemon->last_resolv =3D now; @@ -72,7 +72,7 @@ - --- /dev/null Wed Dec 16 19:48:08 2015 +++ b/src/isc.c Wed Dec 16 19:41:35 2015 -@@ -0,0 +1,251 @@ +@@ -0,0 +1,266 @@ +/* dnsmasq is Copyright (c) 2014 John Volpe, Simon Kelley and + Michael Tremer + @@ -94,6 +94,12 @@ + Michael Tremer. +*/ + ++ ++#define _GNU_SOURCE ++ ++#include ++#include ++ +#include "dnsmasq.h" + +#ifdef HAVE_ISC_READER @@ -109,10 +115,18 @@ + +static struct isc_dhcp_lease* dhcp_lease_new(const char* hostname) { + struct isc_dhcp_lease* lease =3D whine_malloc(sizeof(*lease)); ++ if (!lease) ++ return NULL; + + lease->name =3D strdup(hostname); + if (daemon->domain_suffix) { -+ asprintf(&lease->fqdn, "%s.%s", hostname, daemon->domain_suffix); ++ int r =3D asprintf(&lease->fqdn, "%s.%s", hostname, daemon->= domain_suffix); ++ ++ // Handle OOM ++ if (r < 0) { ++ free(lease); ++ return NULL; ++ } + } + lease->expires =3D 0; + lease->next =3D NULL; @@ -285,6 +299,7 @@ + // and append it to the list. + if (!lease) { + lease =3D dhcp_lease_new(hostname); ++ assert(lease); + + lease->next =3D leases; + leases =3D lease; @@ -326,7 +341,7 @@ +#endif --- a/src/option.c Wed Dec 16 19:24:12 2015 +++ b/src/option.c Wed Dec 16 19:42:48 2015 -@@ -1769,7 +1769,7 @@ +@@ -1770,7 +1770,7 @@ ret_err(_("bad MX target")); break; =20 diff --git a/src/patches/dnsmasq/001-Debian_init_d_script_fix.patch b/src/pat= ches/dnsmasq/001-Debian_init_d_script_fix.patch deleted file mode 100644 index 86d0480..0000000 --- a/src/patches/dnsmasq/001-Debian_init_d_script_fix.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 332c41e2ff533649dc48b6bab00804d795f348f5 Mon Sep 17 00:00:00 2001 -From: Simon Kelley -Date: Sun, 1 May 2016 22:36:46 +0100 -Subject: [PATCH] Debian init.d script fix. - ---- - debian/changelog | 8 +++++--- - debian/init | 14 +++++++------- - 2 files changed, 12 insertions(+), 10 deletions(-) - -diff --git a/debian/changelog b/debian/changelog -index e727406..8a0341c 100644 ---- a/debian/changelog -+++ b/debian/changelog -@@ -3,19 +3,21 @@ dnsmasq (2.76-1) unstable; urgency=3Dlow - * New upstream. (closes: #798586) - * Use /run/dnsmasq directly, rather than relying on link from /var/run - to avoid problems before /var is mounted. (closes: #800351) --=09 -+ * Test for the existance of /usr/share/doc/dnsmasq rather then -+ /etc/dnsmasq.d/README in the daemon startup script. (closes: #819856) -+ - -- Simon Kelley Thur, 10 Sep 2015 23:07:21 +0= 000 -=20 - dnsmasq (2.75-1) unstable; urgency=3Dlow -=20 - * New upstream. (closes: #794095) --=09 -+ - -- Simon Kelley Thur, 30 Jul 2015 20:58:31 +0= 000 -=20 - dnsmasq (2.74-1) unstable; urgency=3Dlow -=20 - * New upstream. (LP: #1468611) --=09 -+ - -- Simon Kelley Wed, 15 Jul 2015 21:54:11 +00= 00 -=20 - dnsmasq (2.73-2) unstable; urgency=3Dlow -diff --git a/debian/init b/debian/init -index 6afe191..10b277c 100644 ---- a/debian/init -+++ b/debian/init -@@ -8,7 +8,8 @@ - # Description: DHCP and DNS server - ### END INIT INFO -=20 --set +e # Don't exit on error status -+# Don't exit on error status -+set +e -=20 - PATH=3D/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - DAEMON=3D/usr/sbin/dnsmasq -@@ -29,12 +30,11 @@ if [ -r /etc/default/locale ]; then - export LANG - fi -=20 --# /etc/dnsmasq.d/README is a non-conffile installed by the dnsmasq package. --# Should the dnsmasq package be removed, the following test ensures that --# the daemon is no longer started, even if the dnsmasq-base package is --# still in place. --test -e /etc/dnsmasq.d/README || exit 0 -- -+# The following test ensures the dnsmasq service is not started, when the -+# package 'dnsmasq' is removed but not purged, even if the dnsmasq-base=20 -+# package is still in place. -+test -d /usr/share/doc/dnsmasq || exit 0 -+=20 - test -x $DAEMON || exit 0 -=20 - # Provide skeleton LSB log functions for backports which don't have LSB fun= ctions. ---=20 -2.5.5 - diff --git a/src/patches/dnsmasq/001-Fix_error_in_PXE_arch_names_and_add_ARM3= 2_and_ARM64.patch b/src/patches/dnsmasq/001-Fix_error_in_PXE_arch_names_and_a= dd_ARM32_and_ARM64.patch new file mode 100644 index 0000000..85a38f6 --- /dev/null +++ b/src/patches/dnsmasq/001-Fix_error_in_PXE_arch_names_and_add_ARM32_and_A= RM64.patch @@ -0,0 +1,62 @@ +From 68bea10bbfbd5e9ff158ab163c15d8982620d0d3 Mon Sep 17 00:00:00 2001 +From: Simon Kelley +Date: Wed, 11 May 2016 22:15:06 +0100 +Subject: [PATCH] Fix error in PXE arch names and add ARM32 and ARM64. + +--- + CHANGELOG | 10 +++++++++- + man/dnsmasq.8 | 2 +- + src/option.c | 3 ++- + 3 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index f3220d8..7012918 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -74,7 +74,15 @@ version 2.76 + To avoid filling logs in configurations which define + many upstream nameservers, don't log more that 30 servers. + The number to be logged can be changed as SERVERS_LOGGED +- in src/config.h.=20 ++ in src/config.h. ++ ++ Swap the values if BC_EFI and x86-64_EFI in --pxe-service.=20 ++ These were previously wrong due to an error in RFC 4578. ++ If you're using BC_EFI to boot 64-bit EFI machines, you ++ will need to update your config. ++ ++ Add ARM32_EFI and ARM64_EFI as valid architectures in ++ --pxe-service. +=20 +=20 + version 2.75 +diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 +index dacd9ce..68d77a2 100644 +--- a/man/dnsmasq.8 ++++ b/man/dnsmasq.8 +@@ -1358,7 +1358,7 @@ functions when supported by a suitable DHCP server. + This specifies a boot option which may appear in a PXE boot menu. is + client system type, only services of the correct type will appear in a + menu. The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86, +-Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI; an ++Intel_Lean_Client, IA32_EFI, X86-64_EFI, Xscale_EFI, BC_EFI, ARM32_EFI and= ARM64_EFI; an + integer may be used for other types. The + parameter after the menu text may be a file name, in which case dnsmasq act= s as a + boot server and directs the PXE client to download the file by TFTP, +diff --git a/src/option.c b/src/option.c +index 0b35500..d8c57d6 100644 +--- a/src/option.c ++++ b/src/option.c +@@ -3298,7 +3298,8 @@ static int one_opt(int option, char *arg, char *errstr= , char *gen_err, int comma + { + struct pxe_service *new =3D opt_malloc(sizeof(struct pxe_service)); + char *CSA[] =3D { "x86PC", "PC98", "IA64_EFI", "Alpha", "Arc_x86", "Intel= _Lean_Client", +- "IA32_EFI", "BC_EFI", "Xscale_EFI", "x86-64_EFI", NULL }; =20 ++ "IA32_EFI", "x86-64_EFI", "Xscale_EFI", "BC_EFI", ++ "ARM32_EFI", "ARM64_EFI", NULL }; =20 + static int boottype =3D 32768; + =20 + new->netid =3D NULL; +--=20 +1.7.10.4 + diff --git a/src/patches/dnsmasq/002-Add_--help_to_manpage.patch b/src/patche= s/dnsmasq/002-Add_--help_to_manpage.patch deleted file mode 100644 index 82de3ee..0000000 --- a/src/patches/dnsmasq/002-Add_--help_to_manpage.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 09217a1a874c654bfd4d29a1097f44435b4c632d Mon Sep 17 00:00:00 2001 -From: Simon Kelley -Date: Tue, 3 May 2016 17:04:35 +0100 -Subject: [PATCH] Add --help to manpage . - ---- - debian/changelog | 1 + - man/dnsmasq.8 | 9 ++++++++- - src/option.c | 2 +- - 3 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/debian/changelog b/debian/changelog -index 8a0341c..e028f57 100644 ---- a/debian/changelog -+++ b/debian/changelog -@@ -5,6 +5,7 @@ dnsmasq (2.76-1) unstable; urgency=3Dlow - to avoid problems before /var is mounted. (closes: #800351) - * Test for the existance of /usr/share/doc/dnsmasq rather then - /etc/dnsmasq.d/README in the daemon startup script. (closes: #819856) -+ * Add --help to manpage and mention dhcp6 in summary. (closes: #821226) -=20 - -- Simon Kelley Thur, 10 Sep 2015 23:07:21 +0= 000 -=20 -diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 -index fd4b7c5..dacd9ce 100644 ---- a/man/dnsmasq.8 -+++ b/man/dnsmasq.8 -@@ -42,6 +42,13 @@ the configuration file. - Read and syntax check configuration file(s). Exit with code 0 if all - is OK, or a non-zero code otherwise. Do not start up dnsmasq. - .TP -+.B \-w, --help -+Display all command-line options.=20 -+.B --help dhcp=20 -+will display known DHCPv4 configuration options, and=20 -+.B --help dhcp6=20 -+will display DHCPv6 options. -+.TP - .B \-h, --no-hosts - Don't read the hostnames in /etc/hosts. - .TP -@@ -317,7 +324,7 @@ instead of the correct NXDOMAIN response. This option te= lls dnsmasq to - fake the correct response when it sees this behaviour. As at Sept 2003 - the IP address being returned by Verisign is 64.94.110.11 - .TP=20 --.B \-B, --ignore-address=3D -+.B --ignore-address=3D - Ignore replies to A-record queries which include the specified address.=20 - No error is generated, dnsmasq simply continues to listen for another reply= .=20 - This is useful to defeat blocking strategies which rely on quickly supplyin= g a -diff --git a/src/option.c b/src/option.c -index c66f401..0b35500 100644 ---- a/src/option.c -+++ b/src/option.c -@@ -402,7 +402,7 @@ static struct { - { 'v', 0, NULL, gettext_noop("Display dnsmasq version and copyright infor= mation."), NULL }, - { 'V', ARG_DUP, ",,", gettext_noop("Translate IP= v4 addresses from upstream servers."), NULL }, - { 'W', ARG_DUP, ",,...", gettext_noop("Specify a SRV record= ."), NULL }, -- { 'w', 0, NULL, gettext_noop("Display this message. Use --help dhcp for k= nown DHCP options."), NULL }, -+ { 'w', 0, NULL, gettext_noop("Display this message. Use --help dhcp or --= help dhcp6 for known DHCP options."), NULL }, - { 'x', ARG_ONE, "", gettext_noop("Specify path of PID file (default= s to %s)."), RUNFILE }, - { 'X', ARG_ONE, "", gettext_noop("Specify maximum number of DHCP= leases (defaults to %s)."), "&" }, - { 'y', OPT_LOCALISE, NULL, gettext_noop("Answer DNS queries based on the = interface a query was sent to."), NULL }, ---=20 -2.5.5 - diff --git a/src/patches/dnsmasq/002-Tweak_CSAs_affected_by_UEFI_PXE_workarou= nd_code.patch b/src/patches/dnsmasq/002-Tweak_CSAs_affected_by_UEFI_PXE_worka= round_code.patch new file mode 100644 index 0000000..ef85b3c --- /dev/null +++ b/src/patches/dnsmasq/002-Tweak_CSAs_affected_by_UEFI_PXE_workaround_code= .patch @@ -0,0 +1,25 @@ +From cbc100fc81183e136f5ed72fec277677d55f9334 Mon Sep 17 00:00:00 2001 +From: Simon Kelley +Date: Wed, 11 May 2016 22:17:18 +0100 +Subject: [PATCH] Tweak CSAs affected by UEFI PXE workaround code. + +--- + src/rfc2131.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/rfc2131.c b/src/rfc2131.c +index 42d1ba8..d952e03 100644 +--- a/src/rfc2131.c ++++ b/src/rfc2131.c +@@ -1994,7 +1994,7 @@ static int pxe_uefi_workaround(int pxe_arch, struct dh= cp_netid *netid, struct dh + struct pxe_service *service, *found; +=20 + /* Only workaround UEFI archs. */ +- if (pxe_arch !=3D 6 && pxe_arch !=3D 7 && pxe_arch !=3D 8 && pxe_arch != =3D 9) ++ if (pxe_arch < 6) + return 0; + =20 + for (found =3D NULL, service =3D daemon->pxe_services; service; service = =3D service->next) +--=20 +1.7.10.4 + diff --git a/src/patches/dnsmasq/003-Move_dhcp_release_and_dhcp_lease_time_to= _contrib_lease_tools.patch b/src/patches/dnsmasq/003-Move_dhcp_release_and_dh= cp_lease_time_to_contrib_lease_tools.patch deleted file mode 100644 index 6065904..0000000 --- a/src/patches/dnsmasq/003-Move_dhcp_release_and_dhcp_lease_time_to_contri= b_lease_tools.patch +++ /dev/null @@ -1,73 +0,0 @@ -From c6cdf6bbee27d1127847ce7bdff2a22a785f9723 Mon Sep 17 00:00:00 2001 -From: Simon Kelley -Date: Tue, 3 May 2016 21:14:14 +0100 -Subject: [PATCH] Move dhcp_release and dhcp_lease_time to contrib/lease_tool= s. - ---- - contrib/{wrt =3D> lease-tools}/Makefile | 0 - contrib/{wrt =3D> lease-tools}/dhcp_lease_time.1 | 0 - contrib/{wrt =3D> lease-tools}/dhcp_lease_time.c | 0 - contrib/{wrt =3D> lease-tools}/dhcp_release.1 | 0 - contrib/{wrt =3D> lease-tools}/dhcp_release.c | 0 - debian/rules | 12 ++++++------ - 6 files changed, 6 insertions(+), 6 deletions(-) - rename contrib/{wrt =3D> lease-tools}/Makefile (100%) - rename contrib/{wrt =3D> lease-tools}/dhcp_lease_time.1 (100%) - rename contrib/{wrt =3D> lease-tools}/dhcp_lease_time.c (100%) - rename contrib/{wrt =3D> lease-tools}/dhcp_release.1 (100%) - rename contrib/{wrt =3D> lease-tools}/dhcp_release.c (100%) - -diff --git a/contrib/wrt/Makefile b/contrib/lease-tools/Makefile -similarity index 100% -rename from contrib/wrt/Makefile -rename to contrib/lease-tools/Makefile -diff --git a/contrib/wrt/dhcp_lease_time.1 b/contrib/lease-tools/dhcp_lease_= time.1 -similarity index 100% -rename from contrib/wrt/dhcp_lease_time.1 -rename to contrib/lease-tools/dhcp_lease_time.1 -diff --git a/contrib/wrt/dhcp_lease_time.c b/contrib/lease-tools/dhcp_lease_= time.c -similarity index 100% -rename from contrib/wrt/dhcp_lease_time.c -rename to contrib/lease-tools/dhcp_lease_time.c -diff --git a/contrib/wrt/dhcp_release.1 b/contrib/lease-tools/dhcp_release.1 -similarity index 100% -rename from contrib/wrt/dhcp_release.1 -rename to contrib/lease-tools/dhcp_release.1 -diff --git a/contrib/wrt/dhcp_release.c b/contrib/lease-tools/dhcp_release.c -similarity index 100% -rename from contrib/wrt/dhcp_release.c -rename to contrib/lease-tools/dhcp_release.c -diff --git a/debian/rules b/debian/rules -index 8612092..193b30c 100755 ---- a/debian/rules -+++ b/debian/rules -@@ -93,7 +93,7 @@ clean: - $(checkdir) - rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debia= n/substvars debian/utils-substvars - make clean -- make -C contrib/wrt clean -+ make -C contrib/lease-tools clean -=20 - binary-indep: checkroot - $(checkdir) -@@ -184,12 +184,12 @@ ifeq ($(DEB_HOST_ARCH_OS),linux) - -d debian/utils/usr/share/man/man1 \ - -d debian/utils/usr/bin \ - -d debian/utils/usr/share/doc/dnsmasq-utils -- make -C contrib/wrt PREFIX=3D/usr DESTDIR=3D`pwd`/debian/utils CFLAGS=3D"$= (CFLAGS)" LDFLAGS=3D"$(LDFLAGS)" COPTS=3D"$(DEB_COPTS)" CC=3Dgcc -- install -m 755 contrib/wrt/dhcp_release debian/utils/usr/bin/dhcp_release -- install -m 644 contrib/wrt/dhcp_release.1 debian/utils/usr/share/man/man1/= dhcp_release.1 -+ make -C contrib/lease-tools PREFIX=3D/usr DESTDIR=3D`pwd`/debian/utils CFL= AGS=3D"$(CFLAGS)" LDFLAGS=3D"$(LDFLAGS)" COPTS=3D"$(DEB_COPTS)" CC=3Dgcc -+ install -m 755 contrib/lease-tools/dhcp_release debian/utils/usr/bin/dhcp_= release -+ install -m 644 contrib/lease-tools/dhcp_release.1 debian/utils/usr/share/m= an/man1/dhcp_release.1 - gzip -9n debian/utils/usr/share/man/man1/dhcp_release.1 -- install -m 755 contrib/wrt/dhcp_lease_time debian/utils/usr/bin/dhcp_lease= _time -- install -m 644 contrib/wrt/dhcp_lease_time.1 debian/utils/usr/share/man/ma= n1/dhcp_lease_time.1 -+ install -m 755 contrib/lease-tools/dhcp_lease_time debian/utils/usr/bin/dh= cp_lease_time =09 -+ install -m 644 contrib/lease-tools/dhcp_lease_time.1 debian/utils/usr/shar= e/man/man1/dhcp_lease_time.1 - install -m 644 debian/copyright debian/utils/usr/share/doc/dnsmasq-utils/c= opyright - install -m 644 debian/changelog debian/utils/usr/share/doc/dnsmasq-utils/c= hangelog.Debian - gzip -9n debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian ---=20 -2.5.5 - diff --git a/src/patches/dnsmasq/004-Add_contrib_lease-tools_dhcp_release6.pa= tch b/src/patches/dnsmasq/004-Add_contrib_lease-tools_dhcp_release6.patch deleted file mode 100644 index 6426d39..0000000 --- a/src/patches/dnsmasq/004-Add_contrib_lease-tools_dhcp_release6.patch +++ /dev/null @@ -1,528 +0,0 @@ -From 69cbf78bb676e493f0a4cd6dc7ffec0fcafafed5 Mon Sep 17 00:00:00 2001 -From: Simon Kelley -Date: Tue, 3 May 2016 21:33:38 +0100 -Subject: [PATCH] Add contrib/lease-tools/dhcp_release6 - ---- - CHANGELOG | 6 + - contrib/lease-tools/Makefile | 4 +- - contrib/lease-tools/dhcp_release6.1 | 38 ++++ - contrib/lease-tools/dhcp_release6.c | 416 +++++++++++++++++++++++++++++++++= +++ - debian/rules | 3 + - 5 files changed, 465 insertions(+), 2 deletions(-) - create mode 100644 contrib/lease-tools/dhcp_release6.1 - create mode 100644 contrib/lease-tools/dhcp_release6.c - -diff --git a/CHANGELOG b/CHANGELOG -index aa53fba..7d4a061 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -65,6 +65,12 @@ version 2.76 - --servers-file to define upstream DNS servers. Thanks to - Scott Bonar for the bug report. -=20 -+ Move the dhcp_release and dhcp_lease_time tools from=20 -+ contrib/wrt to contrib/lease-tools. -+ -+ Add dhcp_release6 to contrib/lease-tools. Many thanks=20 -+ to Sergey Nechaev for this code. -+ -=20 - version 2.75 - Fix reversion on 2.74 which caused 100% CPU use when a=20 -diff --git a/contrib/lease-tools/Makefile b/contrib/lease-tools/Makefile -index 68e8d32..f38f2ed 100644 ---- a/contrib/lease-tools/Makefile -+++ b/contrib/lease-tools/Makefile -@@ -1,6 +1,6 @@ - CFLAGS?=3D -O2 -Wall -W -=20 --all: dhcp_release dhcp_lease_time -+all: dhcp_release dhcp_release6 dhcp_lease_time -=20 - clean: -- rm -f *~ *.o core dhcp_release dhcp_lease_time -+ rm -f *~ *.o core dhcp_release dhcp_release6 dhcp_lease_time -diff --git a/contrib/lease-tools/dhcp_release6.1 b/contrib/lease-tools/dhcp_= release6.1 -new file mode 100644 -index 0000000..763e01c ---- /dev/null -+++ b/contrib/lease-tools/dhcp_release6.1 -@@ -0,0 +1,38 @@ -+.TH DHCP_RELEASE 1 -+.SH NAME -+dhcp_release6 \- Release a DHCPv6 lease on a the local dnsmasq DHCP server. -+.SH SYNOPSIS -+.B dhcp_release6 --iface --client-id --server-id -+server-id --iaid --ip [--dry-run] [--help] -+.SH "DESCRIPTION" -+A utility which forces the DHCP server running on this machine to release a= =20 -+DHCPv6 lease. -+.SS OPTIONS -+.IP "-a, --ip" -+IPv6 address to release. -+.IP "-c, --client-id" -+Colon-separated hex string representing DHCPv6 client id. Normally -+it can be found in leases file both on client and server. -+.IP "-d, --dry-run" -+Print hexadecimal representation of generated DHCPv6 release packet to stan= dard -+output and exit. -+.IP "-h, --help" -+print usage information to standard output and exit. -+.IP "-i, --iaid" -+Decimal representation of DHCPv6 IAID. Normally it can be found in leases f= ile -+both on client and server. -+.IP "-n, --iface" -+Network interface to send a DHCPv6 release packet from. -+.IP "-s, --server-id" -+Colon-separated hex string representing DHCPv6 server id. Normally -+it can be found in leases file both on client and server. -+.SH NOTES -+MUST be run as root - will fail otherwise. -+.SH LIMITATIONS -+Only usable on IPv6 DHCP leases. -+.SH SEE ALSO -+.BR dnsmasq (8) -+.SH AUTHOR -+This manual page was written by Simon Kelley . -+ -+ -diff --git a/contrib/lease-tools/dhcp_release6.c b/contrib/lease-tools/dhcp_= release6.c -new file mode 100644 -index 0000000..74fb26a ---- /dev/null -+++ b/contrib/lease-tools/dhcp_release6.c -@@ -0,0 +1,416 @@ -+/* -+ dhcp_release6 --iface --client-id --server-id -+ server-id --iaid --ip [--dry-run] [--help] -+ MUST be run as root - will fail othewise -+ */ -+ -+/* Send a DHCPRELEASE message to IPv6 multicast address via the specified= interface -+ to tell the local DHCP server to delete a particular lease. -+=20 -+ The interface argument is the interface in which a DHCP -+ request _would_ be received if it was coming from the client, -+ rather than being faked up here. -+=20 -+ The client-id argument is colon-separated hex string and mandatory. Normal= ly -+ it can be found in leases file both on client and server -+ -+ The server-id argument is colon-separated hex string and mandatory. Normal= ly -+ it can be found in leases file both on client and server. -+=20 -+ The iaid argument is numeric string and mandatory. Normally -+ it can be found in leases file both on client and server. -+=20 -+ IP is an IPv6 adress to release -+=20 -+ If --dry-run is specified, dhcp_release6 just prints hexadecimal represant= ation of -+ packet to send to stdout and exits. -+=20 -+ If --help is specified, dhcp_release6 print usage information to stdout an= d exits -+=20 -+=20 -+=20 -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define NOT_REPLY_CODE 115 -+typedef unsigned char u8; -+typedef unsigned short u16; -+typedef unsigned int u32; -+ -+enum DHCP6_TYPES{ -+ SOLICIT =3D 1, -+ ADVERTISE =3D 2, -+ REQUEST =3D 3, -+ CONFIRM =3D 4, -+ RENEW =3D 5, -+ REBIND =3D 6, -+ REPLY =3D 7, -+ RELEASE =3D 8, -+ DECLINE =3D 9, -+ RECONFIGURE =3D 10, -+ INFORMATION_REQUEST =3D 11, -+ RELAY_FORW =3D 12, -+ RELAY_REPL =3D 13 -+ =20 -+}; -+enum DHCP6_OPTIONS{ -+ CLIENTID =3D 1, -+ SERVERID =3D 2, -+ IA_NA =3D 3, -+ IA_TA =3D 4, -+ IAADDR =3D 5, -+ ORO =3D 6, -+ PREFERENCE =3D 7, -+ ELAPSED_TIME =3D 8, -+ RELAY_MSG =3D 9, -+ AUTH =3D 11, -+ UNICAST =3D 12, -+ STATUS_CODE =3D 13, -+ RAPID_COMMIT =3D 14, -+ USER_CLASS =3D 15, -+ VENDOR_CLASS =3D 16, -+ VENDOR_OPTS =3D 17, -+ INTERFACE_ID =3D 18, -+ RECONF_MSG =3D 19, -+ RECONF_ACCEPT =3D 20, -+}; -+ -+enum DHCP6_STATUSES{ -+ SUCCESS =3D 0, -+ UNSPEC_FAIL =3D 1, -+ NOADDR_AVAIL=3D2, -+ NO_BINDING =3D 3, -+ NOT_ON_LINK =3D 4, -+ USE_MULTICAST =3D5 -+}; -+static struct option longopts[] =3D { -+ {"ip", required_argument, 0, 'a'}, -+ {"server-id", required_argument, 0, 's'}, -+ {"client-id", required_argument, 0, 'c'}, -+ {"iface", required_argument, 0, 'n'}, -+ {"iaid", required_argument, 0, 'i'}, -+ {"dry-run", no_argument, 0, 'd'}, -+ {"help", no_argument, 0, 'h'}, -+ {0, 0, 0, 0} -+}; -+ -+const short DHCP6_CLIENT_PORT =3D 546; -+const short DHCP6_SERVER_PORT =3D 547; -+ -+const char* DHCP6_MULTICAST_ADDRESS =3D "ff02::1:2"; -+ -+struct dhcp6_option{ -+ uint16_t type; -+ uint16_t len; -+ char value[1024]; -+}; -+ -+struct dhcp6_iaaddr_option{ -+ uint16_t type; -+ uint16_t len; -+ struct in6_addr ip; -+ uint32_t preferred_lifetime; -+ uint32_t valid_lifetime; -+ =20 -+ =20 -+}; -+ -+struct dhcp6_iana_option{ -+ uint16_t type; -+ uint16_t len; -+ uint32_t iaid; -+ uint32_t t1; -+ uint32_t t2; -+ char options[1024]; -+}; -+ -+ -+struct dhcp6_packet{ -+ size_t len; -+ char buf[2048]; -+ =20 -+} ; -+ -+size_t pack_duid(const char* str, char* dst){ -+ =20 -+ char* tmp =3D strdup(str); -+ char* tmp_to_free =3D tmp; -+ char *ptr; -+ uint8_t write_pos =3D 0; -+ while ((ptr =3D strtok (tmp, ":"))) { -+ dst[write_pos] =3D (uint8_t) strtol(ptr, NULL, 16); -+ write_pos +=3D 1; -+ tmp =3D NULL; -+ =20 -+ } -+ free(tmp_to_free); -+ return write_pos; -+} -+ -+struct dhcp6_option create_client_id_option(const char* duid){ -+ struct dhcp6_option option; -+ option.type =3D htons(CLIENTID); -+ bzero(option.value, sizeof(option.value)); -+ option.len =3D htons(pack_duid(duid, option.value)); -+ return option; -+} -+ -+struct dhcp6_option create_server_id_option(const char* duid){ -+ struct dhcp6_option option; -+ option.type =3D htons(SERVERID); -+ bzero(option.value, sizeof(option.value)); -+ option.len =3D htons(pack_duid(duid, option.value)); -+ return option; -+} -+ -+struct dhcp6_iaaddr_option create_iaadr_option(const char* ip){ -+ struct dhcp6_iaaddr_option result; -+ result.type =3Dhtons(IAADDR); -+ /* no suboptions needed here, so length is 24 */ -+ result.len =3D htons(24); -+ result.preferred_lifetime =3D 0; -+ result.valid_lifetime =3D 0; -+ int s =3D inet_pton(AF_INET6, ip, &(result.ip)); -+ if (s <=3D 0) { -+ if (s =3D=3D 0) -+ fprintf(stderr, "Not in presentation format"); -+ else -+ perror("inet_pton"); -+ exit(EXIT_FAILURE); -+ } -+ return result; -+} -+struct dhcp6_iana_option create_iana_option(const char * iaid, struct dhcp= 6_iaaddr_option ia_addr){ -+ struct dhcp6_iana_option result; -+ result.type =3D htons(IA_NA); -+ result.iaid =3D htonl(atoi(iaid)); -+ result.t1 =3D 0; -+ result.t2 =3D 0; -+ result.len =3D htons(12 + ntohs(ia_addr.len) + 2 * sizeof(uint16_t)); -+ memcpy(result.options, &ia_addr, ntohs(ia_addr.len) + 2 * sizeof(uint16= _t)); -+ return result; -+} -+ -+struct dhcp6_packet create_release_packet(const char* iaid, const char* ip,= const char* client_id, const char* server_id){ -+ struct dhcp6_packet result; -+ bzero(result.buf, sizeof(result.buf)); -+ /* message_type */ -+ result.buf[0] =3D RELEASE; -+ /* tx_id */ -+ bzero(result.buf+1, 3); -+ =20 -+ struct dhcp6_option client_option =3D create_client_id_option(client_id= ); -+ struct dhcp6_option server_option =3D create_server_id_option(server_id= ); -+ struct dhcp6_iaaddr_option iaaddr_option =3D create_iaadr_option(ip); -+ struct dhcp6_iana_option iana_option =3D create_iana_option(iaid, iaadd= r_option); -+ int offset =3D 4; -+ memcpy(result.buf + offset, &client_option, ntohs(client_option.len) + = 2*sizeof(uint16_t)); -+ offset +=3D (ntohs(client_option.len)+ 2 *sizeof(uint16_t) ); -+ memcpy(result.buf + offset, &server_option, ntohs(server_option.len) + = 2*sizeof(uint16_t) ); -+ offset +=3D (ntohs(server_option.len)+ 2* sizeof(uint16_t)); -+ memcpy(result.buf + offset, &iana_option, ntohs(iana_option.len) + 2*si= zeof(uint16_t) ); -+ offset +=3D (ntohs(iana_option.len)+ 2* sizeof(uint16_t)); -+ result.len =3D offset; -+ return result; -+} -+ -+uint16_t parse_iana_suboption(char* buf, size_t len){ -+ size_t current_pos =3D 0; -+ char option_value[1024]; -+ while (current_pos < len) { -+ uint16_t option_type, option_len; -+ memcpy(&option_type,buf + current_pos, sizeof(uint16_t)); -+ memcpy(&option_len,buf + current_pos + sizeof(uint16_t), sizeof(uin= t16_t)); -+ option_type =3D ntohs(option_type); -+ option_len =3D ntohs(option_len); -+ current_pos +=3D 2 * sizeof(uint16_t); -+ if (option_type =3D=3D STATUS_CODE){ -+ uint16_t status; -+ memcpy(&status, buf + current_pos, sizeof(uint16_t)); -+ status =3D ntohs(status); -+ if (status !=3D SUCCESS){ -+ memcpy(option_value, buf + current_pos + sizeof(uint16_t) ,= option_len - sizeof(uint16_t)); -+ option_value[option_len-sizeof(uint16_t)] =3D'\0'; -+ fprintf(stderr, "Error: %s\n", option_value); -+ } -+ return status; -+ } -+ } -+ return -2; -+} -+ -+int16_t parse_packet(char* buf, size_t len){ -+ uint8_t type =3D buf[0]; -+ /*skipping tx id. you need it, uncomment following line -+ uint16_t tx_id =3D ntohs((buf[1] <<16) + (buf[2] <<8) + buf[3]); -+ */ -+ size_t current_pos =3D 4; -+ if (type !=3D REPLY ){ -+ return NOT_REPLY_CODE; -+ } -+ char option_value[1024]; -+ while (current_pos < len) { -+ uint16_t option_type, option_len; -+ memcpy(&option_type,buf + current_pos, sizeof(uint16_t)); -+ memcpy(&option_len,buf + current_pos + sizeof(uint16_t), sizeof(uin= t16_t)); -+ option_type =3D ntohs(option_type); -+ option_len =3D ntohs(option_len); -+ current_pos +=3D 2 * sizeof(uint16_t); -+ if (option_type =3D=3D STATUS_CODE){ -+ uint16_t status; -+ memcpy(&status, buf + current_pos, sizeof(uint16_t)); -+ status =3D ntohs(status); -+ if (status !=3D SUCCESS){ -+ memcpy(option_value, buf + current_pos +sizeof(uint16_t) , = option_len -sizeof(uint16_t)); -+ fprintf(stderr, "Error: %d %s\n", status, option_value); -+ return status; -+ } -+ =20 -+ } -+ if (option_type =3D=3D IA_NA ){ -+ uint16_t result =3D parse_iana_suboption(buf + current_pos +24,= option_len -24); -+ if (result){ -+ return result; -+ } -+ } -+ current_pos +=3D option_len; -+ -+ } -+ return -1; -+} -+ -+void usage(const char* arg, FILE* stream){ -+ const char* usage_string =3D"--ip IPv6 --iface IFACE --server-id SERVER= _ID --client-id CLIENT_ID --iaid IAID [--dry-run] | --help"; -+ fprintf (stream, "Usage: %s %s\n", arg, usage_string); -+ =20 -+} -+ -+int send_release_packet(const char* iface, struct dhcp6_packet* packet){ -+ =20 -+ struct sockaddr_in6 server_addr, client_addr; -+ char response[1400]; -+ int sock =3D socket(PF_INET6, SOCK_DGRAM, 0); -+ int i =3D 0; -+ if (sock < 0) { -+ perror("creating socket"); -+ return -1; -+ } -+ if (setsockopt(sock, SOL_SOCKET, 25, iface, strlen(iface)) =3D=3D -1) { -+ perror("SO_BINDTODEVICE"); -+ close(sock); -+ return -1; -+ } -+ memset(&server_addr, 0, sizeof(server_addr)); -+ server_addr.sin6_family =3D AF_INET6; -+ client_addr.sin6_family =3D AF_INET6; -+ client_addr.sin6_port =3D htons(DHCP6_CLIENT_PORT); -+ client_addr.sin6_flowinfo =3D 0; -+ client_addr.sin6_scope_id =3D0; -+ inet_pton(AF_INET6, "::", &client_addr.sin6_addr); -+ bind(sock, (struct sockaddr*)&client_addr, sizeof(struct sockaddr_in6)); -+ inet_pton(AF_INET6, DHCP6_MULTICAST_ADDRESS, &server_addr.sin6_addr); -+ server_addr.sin6_port =3D htons(DHCP6_SERVER_PORT); -+ int16_t recv_size =3D 0; -+ for (i =3D 0; i < 5; i++) { -+ if (sendto(sock, packet->buf, packet->len, 0, -+ (struct sockaddr *)&server_addr, -+ sizeof(server_addr)) < 0) { -+ perror("sendto failed"); -+ exit(4); -+ } -+ recv_size =3D recvfrom(sock, response, sizeof(response), MSG_DONTWA= IT, NULL, 0); -+ if (recv_size =3D=3D -1){ -+ if (errno =3D=3D EAGAIN){ -+ sleep(1); -+ continue; -+ }else { -+ perror("recvfrom"); -+ } -+ } -+ int16_t result =3D parse_packet(response, recv_size); -+ if (result =3D=3D NOT_REPLY_CODE){ -+ sleep(1); -+ continue; -+ } -+ return result; -+ } -+ fprintf(stderr, "Response timed out\n"); -+ return -1; -+ =20 -+} -+ -+ -+int main(int argc, char * const argv[]) { -+ const char* iface =3D ""; -+ const char* ip =3D ""; -+ const char* client_id =3D ""; -+ const char* server_id =3D ""; -+ const char* iaid =3D ""; -+ int dry_run =3D 0; -+ while (1) { -+ int option_index =3D 0; -+ int c =3D getopt_long(argc, argv, "a:s:c:n:i:hd", longopts, &option= _index); -+ if (c =3D=3D -1){ -+ break; -+ } -+ switch(c){ -+ case 0: -+ if (longopts[option_index].flag !=3D0){ -+ break; -+ } -+ printf ("option %s", longopts[option_index].name); -+ if (optarg) -+ printf (" with arg %s", optarg); -+ printf ("\n"); -+ break; -+ case 'i': -+ iaid =3D optarg; -+ break; -+ case 'n': -+ iface =3D optarg; -+ break; -+ case 'a': -+ ip =3D optarg; -+ break; -+ case 'c': -+ client_id =3D optarg; -+ break; -+ case 'd': -+ dry_run =3D 1; -+ break; -+ case 's': -+ server_id =3D optarg; -+ break; -+ case 'h': -+ usage(argv[0], stdout); -+ break; -+ case '?': -+ usage(argv[0], stderr); -+ return -1; -+ default: -+ abort(); -+ =20 -+ } -+ =20 -+ } -+ struct dhcp6_packet packet =3D create_release_packet(iaid, ip, client_i= d, server_id); -+ if (dry_run){ -+ uint16_t i; -+ for(i=3D0;i -Date: Tue, 3 May 2016 22:34:06 +0100 -Subject: [PATCH] Limit number of upstream nameservers when logging - configuration. - ---- - CHANGELOG | 5 +++++ - src/config.h | 1 + - src/network.c | 10 ++++++++-- - 3 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/CHANGELOG b/CHANGELOG -index 7d4a061..f3220d8 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -71,6 +71,11 @@ version 2.76 - Add dhcp_release6 to contrib/lease-tools. Many thanks=20 - to Sergey Nechaev for this code. -=20 -+ To avoid filling logs in configurations which define -+ many upstream nameservers, don't log more that 30 servers. -+ The number to be logged can be changed as SERVERS_LOGGED -+ in src/config.h.=20 -+ -=20 - version 2.75 - Fix reversion on 2.74 which caused 100% CPU use when a=20 -diff --git a/src/config.h b/src/config.h -index c3bbbcb..80a50e1 100644 ---- a/src/config.h -+++ b/src/config.h -@@ -25,6 +25,7 @@ - #define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */ - #define FORWARD_TEST 50 /* try all servers every 50 queries */ - #define FORWARD_TIME 20 /* or 20 seconds */ -+#define SERVERS_LOGGED 30 /* Only log this many servers when logging state = */ - #define RANDOM_SOCKS 64 /* max simultaneous random ports */ - #define LEASE_RETRY 60 /* on error, retry writing leasefile after LEASE_RET= RY seconds */ - #define CACHESIZ 150 /* default cache size */ -diff --git a/src/network.c b/src/network.c -index da8a7f4..e7722fd 100644 ---- a/src/network.c -+++ b/src/network.c -@@ -1429,7 +1429,7 @@ void check_servers(void) - { - struct irec *iface; - struct server *serv; -- int port =3D 0; -+ int port =3D 0, count; -=20 - /* interface may be new since startup */ - if (!option_bool(OPT_NOWILD)) -@@ -1442,7 +1442,7 @@ void check_servers(void) - serv->flags |=3D SERV_DO_DNSSEC; - #endif -=20 -- for (serv =3D daemon->servers; serv; serv =3D serv->next) -+ for (count =3D 0, serv =3D daemon->servers; serv; serv =3D serv->next) - { - if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_R= ESOLV | SERV_NO_REBIND))) - { -@@ -1509,6 +1509,9 @@ void check_servers(void) - =20 - if (!(serv->flags & SERV_NO_REBIND) && !(serv->flags & SERV_LITERAL_A= DDRESS)) - { -+ if (++count > SERVERS_LOGGED) -+ continue; -+ =20 - if (serv->flags & (SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_USE_RESOLV)) - { - char *s1, *s2, *s3 =3D ""; -@@ -1540,6 +1543,9 @@ void check_servers(void) - my_syslog(LOG_INFO, _("using nameserver %s#%d"), daemon->namebuff, por= t);=20 - } - } -+ =20 -+ if (count - 1 > SERVERS_LOGGED) -+ my_syslog(LOG_INFO, _("using %d more nameservers"), count - SERVERS_LOG= GED - 1); -=20 - cleanup_servers(); - } ---=20 -2.5.5 - diff --git a/src/patches/dnsmasq/006-Fix_for_DHCP_in_transmission_interface_w= hen_--bridge-interface_in_use.patch b/src/patches/dnsmasq/006-Fix_for_DHCP_in= _transmission_interface_when_--bridge-interface_in_use.patch deleted file mode 100644 index 3c90ca3..0000000 --- a/src/patches/dnsmasq/006-Fix_for_DHCP_in_transmission_interface_when_--b= ridge-interface_in_use.patch +++ /dev/null @@ -1,70 +0,0 @@ -From ff325644c7afae2588583f935f4ea9b9694eb52e Mon Sep 17 00:00:00 2001 -From: Neil Jerram -Date: Tue, 3 May 2016 22:45:14 +0100 -Subject: [PATCH] Fix for DHCP in transmission interface when - --bridge-interface in use. - -From f3d832b41f44c856003517c583fbd7af4dca722c Mon Sep 17 00:00:00 2001 -From: Neil Jerram -Date: Fri, 8 Apr 2016 19:23:47 +0100 -Subject: [PATCH] Fix DHCPv4 reply via --bridge-interface alias interface - -Sending a DHCPv4 reply through a --bridge-interface alias interface -was inadvertently broken by - - commit 65c721200023ef0023114459a8d12f8b0a24cfd8 - Author: Lung-Pin Chang - Date: Thu Mar 19 23:22:21 2015 +0000 - - dhcp: set outbound interface via cmsg in unicast reply - - If multiple routes to the same network exist, Linux blindly picks - the first interface (route) based on destination address, which migh= t not be - the one we're actually offering leases. Rather than relying on this, - always set the interface for outgoing unicast DHCP packets. - -because in the aliasing case, iface_index is changed from the index of -the interface on which the packet was received, to be the interface -index of the 'bridge' interface (where the DHCP context is expected to -be defined, and so needs to be looked up). - -For the cmsg code that the cited commit added, we need the original -iface_index; so this commit saves that off before the aliasing code -can change it, as rcvd_iface_index, and then uses rcvd_iface_index -instead of iface_index for the cmsg code. ---- - src/dhcp.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/dhcp.c b/src/dhcp.c -index 00145bc..10f1fb9 100644 ---- a/src/dhcp.c -+++ b/src/dhcp.c -@@ -146,6 +146,7 @@ void dhcp_packet(time_t now, int pxe_fd) - struct iovec iov; - ssize_t sz;=20 - int iface_index =3D 0, unicast_dest =3D 0, is_inform =3D 0; -+ int rcvd_iface_index; - struct in_addr iface_addr; - struct iface_param parm; - #ifdef HAVE_LINUX_NETWORK -@@ -230,6 +231,7 @@ void dhcp_packet(time_t now, int pxe_fd) - --bridge-interface option), change ifr.ifr_name so that we look - for DHCP contexts associated with the aliased interface instead - of with the aliasing one. */ -+ rcvd_iface_index =3D iface_index; - for (bridge =3D daemon->bridges; bridge; bridge =3D bridge->next) - { - for (alias =3D bridge->alias; alias; alias =3D alias->next) -@@ -387,7 +389,7 @@ void dhcp_packet(time_t now, int pxe_fd) - msg.msg_controllen =3D sizeof(control_u); - cmptr =3D CMSG_FIRSTHDR(&msg); - pkt =3D (struct in_pktinfo *)CMSG_DATA(cmptr); -- pkt->ipi_ifindex =3D iface_index; -+ pkt->ipi_ifindex =3D rcvd_iface_index; - pkt->ipi_spec_dst.s_addr =3D 0; - msg.msg_controllen =3D cmptr->cmsg_len =3D CMSG_LEN(sizeof(struct in_= pktinfo)); - cmptr->cmsg_level =3D IPPROTO_IP; ---=20 -2.5.5 - --=20 2.8.2 --===============4187721659467489114==--