From a0efa9f3fd96276ebd88ffab85c6d7635d432eb8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Jan 2017 22:11:53 +0100 Subject: [PATCH] odhcp6c: update to use upstreamed solution to ignore default lifetime for RDNSS --- .../330-gluon-mesh-batman-adv-core-local-node | 1 + ...ndent-of-the-default-router-lifetime.patch | 31 ----- ...f9f4b4da9d1960f82e68ae797290e4b9c434.patch | 118 ++++++++++++++++++ 3 files changed, 119 insertions(+), 31 deletions(-) delete mode 100644 patches/openwrt/0003-odhcp6c-always-accept-RDNSS-independent-of-the-default-router-lifetime.patch create mode 100644 patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch diff --git a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node index 04909fa6..ae20d61c 100755 --- a/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node +++ b/package/gluon-mesh-batman-adv-core/luasrc/lib/gluon/upgrade/330-gluon-mesh-batman-adv-core-local-node @@ -25,6 +25,7 @@ uci:section('network', 'interface', 'local_node', reqprefix = 'no', peerdns = 1, sourcefilter = 0, + keep_ra_dnslifetime = 1, } ) diff --git a/patches/openwrt/0003-odhcp6c-always-accept-RDNSS-independent-of-the-default-router-lifetime.patch b/patches/openwrt/0003-odhcp6c-always-accept-RDNSS-independent-of-the-default-router-lifetime.patch deleted file mode 100644 index 50efa243..00000000 --- a/patches/openwrt/0003-odhcp6c-always-accept-RDNSS-independent-of-the-default-router-lifetime.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Matthias Schiffer -Date: Thu, 13 Nov 2014 01:17:24 +0100 -Subject: odhcp6c: always accept RDNSS, independent of the default router lifetime - -diff --git a/package/network/ipv6/odhcp6c/patches/001-always_accept_rdnss.patch b/package/network/ipv6/odhcp6c/patches/001-always_accept_rdnss.patch -new file mode 100644 -index 0000000000000000000000000000000000000000..cb694cadf4df4b487b3a4035eacca9c6a7798ecb ---- /dev/null -+++ b/package/network/ipv6/odhcp6c/patches/001-always_accept_rdnss.patch -@@ -0,0 +1,21 @@ -+--- a/src/ra.c -++++ b/src/ra.c -+@@ -438,18 +438,6 @@ bool ra_process(void) -+ } -+ } -+ } -+- -+- int states[2] = {STATE_RA_DNS, STATE_RA_SEARCH}; -+- for (size_t i = 0; i < 2; ++i) { -+- size_t ra_dns_len; -+- uint8_t *start = odhcp6c_get_state(states[i], &ra_dns_len); -+- for (struct odhcp6c_entry *c = (struct odhcp6c_entry*)start; -+- (uint8_t*)c < &start[ra_dns_len] && &c->auxtarget[c->auxlen] <= &start[ra_dns_len]; -+- c = (struct odhcp6c_entry*)(&c->auxtarget[c->auxlen])) -+- if (IN6_ARE_ADDR_EQUAL(&c->router, &from.sin6_addr) && -+- c->valid > router_valid) -+- c->valid = router_valid; -+- } -+ } -+ -+ if (found) diff --git a/patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch b/patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch new file mode 100644 index 00000000..75993f39 --- /dev/null +++ b/patches/openwrt/0003-odhcp6c-backport-from-LEDE-0d49f9f4b4da9d1960f82e68ae797290e4b9c434.patch @@ -0,0 +1,118 @@ +From: Matthias Schiffer +Date: Tue, 17 Jan 2017 22:08:21 +0100 +Subject: odhcp6c: backport from LEDE 0d49f9f4b4da9d1960f82e68ae797290e4b9c434 + +diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile +index 3705705f6540dc841c7041e81f6d208a41a1f08a..a8e45588a52859daf14c68c665a53690b9d09be2 100644 +--- a/package/network/ipv6/odhcp6c/Makefile ++++ b/package/network/ipv6/odhcp6c/Makefile +@@ -8,15 +8,16 @@ + include $(TOPDIR)/rules.mk + + PKG_NAME:=odhcp6c +-PKG_VERSION:=2016-02-08 ++PKG_VERSION:=2017-01-07 + PKG_RELEASE=$(PKG_SOURCE_VERSION) + + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +-PKG_SOURCE_URL:=https://github.com/openwrt/odhcp6c.git ++PKG_SOURCE_URL:=git://git.lede-project.org/project/odhcp6c.git + PKG_SOURCE_PROTO:=git +-PKG_SOURCE_VERSION:=dc186d6d2b0dd4ad23ca5fc69c00e81f796ff6d9 +-PKG_MAINTAINER:=Steven Barth ++PKG_SOURCE_VERSION:=d420f49396c627ce1072b83170889baf0720bc8b ++PKG_MIRROR_HASH:=a7c599b5600b6cca9aec221dd32fc7754e0e942b0192bd902f1e789f53345127 ++PKG_MAINTAINER:=Hans Dedecker + PKG_LICENSE:=GPL-2.0 + + include $(INCLUDE_DIR)/package.mk +@@ -30,7 +31,7 @@ define Package/odhcp6c + SECTION:=net + CATEGORY:=Network + TITLE:=Embedded DHCPv6-client for OpenWrt +- DEPENDS:=+kmod-ipv6 ++ DEPENDS:=@IPV6 +libubox + endef + + define Package/odhcp6c/config +diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script +index 677d35f4f92e82d6a7fe9ca01a35e071097baca8..1bb5e771b6dc80c1f5bceef88508d92cc69b1d3a 100755 +--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script ++++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script +@@ -77,6 +77,11 @@ setup_interface () { + -z "$RA_DNS" -a "$FAKE_ROUTES" = 1 ]; then + RA_ROUTES="::/0,$SERVER,$valid,4096" + fi ++ ++ # RFC 7278 ++ if [ "$mask" -eq 64 -a -z "$PREFIXES" -a -n "$EXTENDPREFIX" ]; then ++ proto_add_ipv6_prefix "$addr/$mask,$preferred,$valid" ++ fi + done + + for entry in $RA_ROUTES; do +@@ -180,7 +185,7 @@ setup_interface () { + # Apply IPv6 / ND configuration + HOPLIMIT=$(cat /proc/sys/net/ipv6/conf/$device/hop_limit) + [ -n "$RA_HOPLIMIT" -a -n "$HOPLIMIT" ] && [ "$RA_HOPLIMIT" -gt "$HOPLIMIT" ] && echo "$RA_HOPLIMIT" > /proc/sys/net/ipv6/conf/$device/hop_limit +- [ -n "$RA_MTU" ] && [ "$RA_MTU" -gt 0 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu ++ [ -n "$RA_MTU" ] && [ "$RA_MTU" -ge 1280 ] && echo "$RA_MTU" > /proc/sys/net/ipv6/conf/$device/mtu 2>/dev/null + [ -n "$RA_REACHABLE" ] && [ "$RA_REACHABLE" -gt 0 ] && echo "$RA_REACHABLE" > /proc/sys/net/ipv6/neigh/$device/base_reachable_time_ms + [ -n "$RA_RETRANSMIT" ] && [ "$RA_RETRANSMIT" -gt 0 ] && echo "$RA_RETRANSMIT" > /proc/sys/net/ipv6/neigh/$device/retrans_time_ms + +@@ -209,6 +214,6 @@ case "$2" in + esac + + # user rules +-[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user ++[ -f /etc/odhcp6c.user ] && . /etc/odhcp6c.user "@" + + exit 0 +diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh +index 4a453fdc4d94d9298067a986b0e4c6054b6c0a60..9e3f6697335a55cf4be1751fec907a4ac93f09ec 100755 +--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh ++++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh +@@ -13,6 +13,7 @@ proto_dhcpv6_init_config() { + proto_config_add_string 'reqopts:list(uinteger)' + proto_config_add_string 'noslaaconly:bool' + proto_config_add_string 'forceprefix:bool' ++ proto_config_add_string 'extendprefix:bool' + proto_config_add_string 'norelease:bool' + proto_config_add_string 'ip6prefix:ip6addr' + proto_config_add_string iface_dslite +@@ -29,14 +30,15 @@ proto_dhcpv6_init_config() { + proto_config_add_int "soltimeout" + proto_config_add_boolean fakeroutes + proto_config_add_boolean sourcefilter ++ proto_config_add_boolean keep_ra_dnslifetime + } + + proto_dhcpv6_setup() { + local config="$1" + local iface="$2" + +- local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter +- json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter ++ local reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ++ json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix extendprefix norelease ip6prefix iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime + + + # Configure +@@ -60,6 +62,8 @@ proto_dhcpv6_setup() { + + [ -n "$userclass" ] && append opts "-u$userclass" + ++ [ "$keep_ra_dnslifetime" = "1" ] && append opts "-L" ++ + for opt in $reqopts; do + append opts "-r$opt" + done +@@ -78,6 +82,7 @@ proto_dhcpv6_setup() { + [ -n "$zone" ] && proto_export "ZONE=$zone" + [ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1" + [ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1" ++ [ "$extendprefix" = "1" ] && proto_export "EXTENDPREFIX=1" + + proto_export "INTERFACE=$config" + proto_run_command "$config" odhcp6c \