Browse Source

Update netifd and odhcp6c from Barrier Breaker

Matthias Schiffer 9 years ago
parent
commit
e9aa0533ce

+ 89 - 21
patches/openwrt/0003-Update-netifd-and-its-dependencies-from-Barrier-Breaker.patch → patches/openwrt/0003-Update-netifd-and-its-dependencies-from-Barrier-Breaker-r41831.patch

@@ -1,9 +1,9 @@
 From: Matthias Schiffer <mschiffer@universe-factory.net>
 Date: Sat, 11 Jan 2014 11:47:31 +0100
-Subject: Update netifd and its dependencies from Barrier Breaker
+Subject: Update netifd and its dependencies from Barrier Breaker (r41831)
 
 diff --git a/package/libubox/Makefile b/package/libubox/Makefile
-index bcf4481..fc9834a 100644
+index bcf4481..6cbfc08 100644
 --- a/package/libubox/Makefile
 +++ b/package/libubox/Makefile
 @@ -1,13 +1,13 @@
@@ -11,7 +11,7 @@ index bcf4481..fc9834a 100644
  
  PKG_NAME:=libubox
 -PKG_VERSION:=2013-10-19
-+PKG_VERSION:=2014-03-18
++PKG_VERSION:=2014-07-16
  PKG_RELEASE=$(PKG_SOURCE_VERSION)
  
  PKG_SOURCE_PROTO:=git
@@ -19,7 +19,7 @@ index bcf4481..fc9834a 100644
 +PKG_SOURCE_URL:=http://git.openwrt.org/project/libubox.git
  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 -PKG_SOURCE_VERSION:=734d28eb1a46358743cf8837c91e5d46695c3b91
-+PKG_SOURCE_VERSION:=4f44401ae8d23465261cef80b87630ffccd5a864
++PKG_SOURCE_VERSION:=bd388d2b6c2c151bf513c1e449417d18ce02d10b
  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  PKG_MIRROR_MD5SUM:=
  CMAKE_INSTALL:=1
@@ -60,7 +60,7 @@ index bcf4481..fc9834a 100644
  $(eval $(call BuildPackage,libjson-script))
 +$(eval $(call BuildPackage,libubox-lua))
 diff --git a/package/netifd/Makefile b/package/netifd/Makefile
-index 5f2ee03..1d7f363 100644
+index 5f2ee03..62d64e5 100644
 --- a/package/netifd/Makefile
 +++ b/package/netifd/Makefile
 @@ -1,13 +1,13 @@
@@ -68,7 +68,7 @@ index 5f2ee03..1d7f363 100644
  
  PKG_NAME:=netifd
 -PKG_VERSION:=2013-07-16
-+PKG_VERSION:=2014-04-19
++PKG_VERSION:=2014-07-26
  PKG_RELEASE=$(PKG_SOURCE_VERSION)
  
  PKG_SOURCE_PROTO:=git
@@ -76,7 +76,7 @@ index 5f2ee03..1d7f363 100644
 +PKG_SOURCE_URL:=http://git.openwrt.org/project/netifd.git
  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 -PKG_SOURCE_VERSION:=2674941b06c1ec67f1aff1bff9212e1372106641
-+PKG_SOURCE_VERSION:=ede9739fe90f5da09f14481d10a4f11c000072de
++PKG_SOURCE_VERSION:=c430d3278b91369204c83cd135673a5d5cded699
  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  # PKG_MIRROR_MD5SUM:=
@@ -110,10 +110,27 @@ index c50cda6..023025c 100644
  		uci_toggle_state network "$INTERFACE" device "$(uci -q get network.$INTERFACE.ifname)"
  		uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
 diff --git a/package/netifd/files/lib/netifd/dhcp.script b/package/netifd/files/lib/netifd/dhcp.script
-index 50163da..948c3cd 100755
+index 50163da..db3fc01 100755
 --- a/package/netifd/files/lib/netifd/dhcp.script
 +++ b/package/netifd/files/lib/netifd/dhcp.script
-@@ -44,19 +44,20 @@ setup_interface () {
+@@ -33,9 +33,15 @@ setup_interface () {
+ 	for domain in $domain; do
+ 		proto_add_dns_search "$domain"
+ 	done
++
++	proto_add_data
++	[ -n "$ZONE" ] && json_add_string zone "$ZONE"
++	proto_close_data
++
+ 	proto_send_update "$INTERFACE"
+ 
+-	if [ -n "$IFACE6RD" -a -n "$ip6rd" ]; then
++
++	if [ "$IFACE6RD" != 0 -a -n "$ip6rd" ]; then
+ 		local v4mask="${ip6rd%% *}"
+ 		ip6rd="${ip6rd#* }"
+ 		local ip6rdprefixlen="${ip6rd%% *}"
+@@ -44,19 +50,24 @@ setup_interface () {
  		ip6rd="${ip6rd#* }"
  		local ip6rdbr="${ip6rd%% *}"
  
@@ -126,6 +143,13 @@ index 50163da..948c3cd 100755
 -set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen
 -commit network
 -EOF
+-
+-		ifdown "$IFACE6RD"
+-		/etc/init.d/network reload
+-		ifup "$IFACE6RD"
++		[ -n "$ZONE" ] || ZONE=$(fw3 network $INTERFACE)
++		[ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6rd
++
 +		json_init
 +		json_add_string name "$IFACE6RD"
 +		json_add_string ifname "@$INTERFACE"
@@ -136,21 +160,19 @@ index 50163da..948c3cd 100755
 +		json_add_int ip6prefixlen "$ip6rdprefixlen"
 +		json_add_string tunlink "$INTERFACE"
 +		[ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
++		[ -n "$ZONE6RD" ] || ZONE6RD=$ZONE
 +		[ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
 +		json_close_object
- 
--		ifdown "$IFACE6RD"
--		/etc/init.d/network reload
--		ifup "$IFACE6RD"
++
 +		ubus call network add_dynamic "$(json_dump)"
  	fi
  
  	# TODO
 diff --git a/package/netifd/files/lib/netifd/proto/dhcp.sh b/package/netifd/files/lib/netifd/proto/dhcp.sh
-index a270c68..2e58c19 100755
+index a270c68..b14f7be 100755
 --- a/package/netifd/files/lib/netifd/proto/dhcp.sh
 +++ b/package/netifd/files/lib/netifd/proto/dhcp.sh
-@@ -5,31 +5,42 @@
+@@ -5,31 +5,44 @@
  init_proto "$@"
  
  proto_dhcp_init_config() {
@@ -174,6 +196,7 @@ index a270c68..2e58c19 100755
 +	proto_config_add_string sendopts
 +	proto_config_add_boolean delegate
 +	proto_config_add_string zone6rd
++	proto_config_add_string zone
  }
  
  proto_dhcp_setup() {
@@ -182,8 +205,8 @@ index a270c68..2e58c19 100755
  
 -	local ipaddr hostname clientid vendorid broadcast reqopts iface6rd
 -	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd
-+	local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
-+	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
++	local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
++	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
  
  	local opt dhcpopts
  	for opt in $reqopts; do
@@ -199,11 +222,12 @@ index a270c68..2e58c19 100755
  	[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
 +	[ -n "$iface6rd" ] && append dhcpopts "-O 212"
 +	[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
++	[ -n "$zone" ] && proto_export "ZONE=$zone"
 +	[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
  
  	proto_export "INTERFACE=$config"
  	proto_run_command "$config" udhcpc \
-@@ -42,6 +53,13 @@ proto_dhcp_setup() {
+@@ -42,10 +55,16 @@ proto_dhcp_setup() {
  		$clientid $broadcast $dhcpopts
  }
  
@@ -217,6 +241,10 @@ index a270c68..2e58c19 100755
  proto_dhcp_teardown() {
  	local interface="$1"
  	proto_kill_command "$interface"
+ }
+ 
+ add_protocol dhcp
+-
 diff --git a/package/netifd/patches/001-musl_af_inet_include.patch b/package/netifd/patches/001-musl_af_inet_include.patch
 new file mode 100644
 index 0000000..510ee05
@@ -234,8 +262,48 @@ index 0000000..510ee05
 + 
 + void
 + __vlist_simple_init(struct vlist_simple_tree *tree, int offset)
+diff --git a/package/netifd/patches/002-fix_compile_with_old_includes.patch b/package/netifd/patches/002-fix_compile_with_old_includes.patch
+new file mode 100644
+index 0000000..361b2d1
+--- /dev/null
++++ b/package/netifd/patches/002-fix_compile_with_old_includes.patch
+@@ -0,0 +1,34 @@
++--- a/system-linux.c
+++++ b/system-linux.c
++@@ -43,6 +43,31 @@
++ #define RTN_FAILED_POLICY 12
++ #endif
++ 
+++
+++#ifndef IFLA_IPTUN_MAX
+++enum {
+++        IFLA_IPTUN_UNSPEC,
+++        IFLA_IPTUN_LINK,
+++        IFLA_IPTUN_LOCAL,
+++        IFLA_IPTUN_REMOTE,
+++        IFLA_IPTUN_TTL,
+++        IFLA_IPTUN_TOS,
+++        IFLA_IPTUN_ENCAP_LIMIT,
+++        IFLA_IPTUN_FLOWINFO,
+++        IFLA_IPTUN_FLAGS,
+++        IFLA_IPTUN_PROTO,
+++        IFLA_IPTUN_PMTUDISC,
+++        IFLA_IPTUN_6RD_PREFIX,
+++        IFLA_IPTUN_6RD_RELAY_PREFIX,
+++        IFLA_IPTUN_6RD_PREFIXLEN,
+++        IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
+++        __IFLA_IPTUN_MAX,
+++};
+++#define IFLA_IPTUN_MAX  (__IFLA_IPTUN_MAX - 1)
+++#endif
+++
+++
+++
++ #include <string.h>
++ #include <fcntl.h>
++ #include <glob.h>
 diff --git a/package/ubus/Makefile b/package/ubus/Makefile
-index be18fb5..53fb586 100644
+index be18fb5..ba96b3b 100644
 --- a/package/ubus/Makefile
 +++ b/package/ubus/Makefile
 @@ -1,13 +1,13 @@
@@ -243,14 +311,14 @@ index be18fb5..53fb586 100644
  
  PKG_NAME:=ubus
 -PKG_VERSION:=2013-08-08
-+PKG_VERSION:=2014-03-18
++PKG_VERSION:=2014-07-03
  PKG_RELEASE=$(PKG_SOURCE_VERSION)
  
  PKG_SOURCE_PROTO:=git
  PKG_SOURCE_URL:=git://nbd.name/luci2/ubus.git
  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 -PKG_SOURCE_VERSION:=b20a8a01c7faea5bcc9d34d10dcf7736589021b8
-+PKG_SOURCE_VERSION:=1d5ac421a5b3dca60562e876ba70d0c2fe46b3d2
++PKG_SOURCE_VERSION:=f688c7ad0b2435a89bfd13f5496cabf596b54c8f
  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  PKG_MIRROR_MD5SUM:=
  CMAKE_INSTALL:=1

+ 37 - 29
patches/openwrt/0004-Update-odhcp6c-from-Barrier-Breaker-r41447.patch → patches/openwrt/0004-Update-odhcp6c-from-Barrier-Breaker-r41830.patch

@@ -1,9 +1,9 @@
 From: Matthias Schiffer <mschiffer@universe-factory.net>
 Date: Sat, 11 Jan 2014 11:47:58 +0100
-Subject: Update odhcp6c from Barrier Breaker (r41447)
+Subject: Update odhcp6c from Barrier Breaker (r41830)
 
 diff --git a/package/odhcp6c/Makefile b/package/odhcp6c/Makefile
-index e767064..7ad9bd2 100644
+index e767064..3ec58e1 100644
 --- a/package/odhcp6c/Makefile
 +++ b/package/odhcp6c/Makefile
 @@ -8,26 +8,55 @@
@@ -12,7 +12,7 @@ index e767064..7ad9bd2 100644
  PKG_NAME:=odhcp6c
 -PKG_VERSION:=2013-10-02
 -PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
-+PKG_VERSION:=2014-06-04
++PKG_VERSION:=2014-07-21
 +PKG_RELEASE=$(PKG_SOURCE_VERSION)
  
  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
@@ -20,7 +20,7 @@ index e767064..7ad9bd2 100644
  PKG_SOURCE_URL:=git://github.com/sbyx/odhcp6c.git
  PKG_SOURCE_PROTO:=git
 -PKG_SOURCE_VERSION:=357ecc1f5163bc7f74c64f4bca387e8d44a2eac5
-+PKG_SOURCE_VERSION:=26c5466e626735f27dd073b727b02612c5a807cd
++PKG_SOURCE_VERSION:=67b311ab81736b35858664219d345844ab08fcc7
  PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
  
  include $(INCLUDE_DIR)/package.mk
@@ -68,10 +68,10 @@ index e767064..7ad9bd2 100644
  	$(INSTALL_DIR) $(1)/usr/sbin/
  	$(INSTALL_BIN) $(PKG_BUILD_DIR)/odhcp6c $(1)/usr/sbin/
 diff --git a/package/odhcp6c/files/dhcpv6.script b/package/odhcp6c/files/dhcpv6.script
-index 324a823..42c67c1 100755
+index 324a823..8c1ba18 100755
 --- a/package/odhcp6c/files/dhcpv6.script
 +++ b/package/odhcp6c/files/dhcpv6.script
-@@ -64,23 +64,63 @@ setup_interface () {
+@@ -64,23 +64,68 @@ setup_interface () {
  		entry="${entry#*,}"
  		local metric="${entry%%,*}"
  
@@ -90,11 +90,12 @@ index 324a823..42c67c1 100755
 +	proto_add_data
 +	[ -n "$CER" ] && json_add_string cer "$CER"
 +	[ -n "$PASSTHRU" ] && json_add_string passthru "$PASSTHRU"
++	[ -n "$ZONE" ] && json_add_string zone "$ZONE"
 +	proto_close_data
 +
  	proto_send_update "$INTERFACE"
  
- 	if [ -n "$AFTR_IP " -a -n "$IFACE_DSLITE" ]; then
+-	if [ -n "$AFTR_IP " -a -n "$IFACE_DSLITE" ]; then
 -uci -q batch <<-EOF >/dev/null
 -set network.$IFACE_DSLITE.proto=dslite
 -set network.$IFACE_DSLITE.auto=0
@@ -106,33 +107,24 @@ index 324a823..42c67c1 100755
 -		ifdown "$IFACE_DSLITE"
 -		/etc/init.d/network reload
 -		ifup "$IFACE_DSLITE"
-+		json_init
-+		json_add_string name "$IFACE_DSLITE"
-+		json_add_string ifname "@$INTERFACE"
-+		json_add_string proto "dslite"
-+		json_add_string peeraddr "$AFTR_IP"
-+		json_add_string tunlink "$INTERFACE"
-+		[ -n "$ZONE_DSLITE" ] && json_add_string zone "$ZONE_DSLITE"
-+		[ -n "$IFACE_DSLITE_DELEGATE" ] && json_add_boolean delegate "$IFACE_DSLITE_DELEGATE"
-+		json_close_object
-+		ubus call network add_dynamic "$(json_dump)"
-+	fi
-+
 +	MAPTYPE=""
 +	MAPRULE=""
 +
-+	if [ -n "$MAPE" ]; then
++	if [ -n "$MAPE" -a -f /lib/netifd/proto/map.sh ]; then
 +		MAPTYPE="map-e"
 +		MAPRULE="$MAPE"
-+	elif [ -n "$MAPT" ]; then
++	elif [ -n "$MAPT" -a -f /lib/netifd/proto/map.sh -a -f /proc/net/nat46/control ]; then
 +		MAPTYPE="map-t"
 +		MAPRULE="$MAPT"
-+	elif [ -n "$LW4O6" ]; then
++	elif [ -n "$LW4O6" -a -f /lib/netifd/proto/map.sh ]; then
 +		MAPTYPE="lw4o6"
 +		MAPRULE="$LW4O6"
 +	fi
 +
-+	if [ -n "$IFACE_MAP" -a -n "$MAPTYPE" -a -n "$MAPRULE" ]; then
++	[ -n "$ZONE" ] || ZONE=$(fw3 network $INTERFACE)
++
++	if [ "$IFACE_MAP" != 0 -a -n "$MAPTYPE" -a -n "$MAPRULE" ]; then
++		[ -z "$IFACE_MAP" -o "$IFACE_MAP" = 1 ] && IFACE_MAP=${INTERFACE}_map
 +		json_init
 +		json_add_string name "$IFACE_MAP"
 +		json_add_string ifname "@$INTERFACE"
@@ -140,18 +132,32 @@ index 324a823..42c67c1 100755
 +		json_add_string type "$MAPTYPE"
 +		json_add_string rule "$MAPRULE"
 +		json_add_string tunlink "$INTERFACE"
++		[ -n "$ZONE_MAP" ] || ZONE_MAP=$ZONE
 +		[ -n "$ZONE_MAP" ] && json_add_string zone "$ZONE_MAP"
 +		[ -n "$IFACE_MAP_DELEGATE" ] && json_add_boolean delegate "$IFACE_MAP_DELEGATE"
 +		json_close_object
++		ubus call network add_dynamic "$(json_dump)"
++	elif [ -n "$AFTR_IP " -a "$IFACE_DSLITE" != 0 -a -f /lib/netifd/proto/dslite.sh ]; then
++		[ -z "$IFACE_DSLITE" -o "$IFACE_DSLITE" = 1 ] && IFACE_DSLITE=${INTERFACE}_dslite
++		json_init
++		json_add_string name "$IFACE_DSLITE"
++		json_add_string ifname "@$INTERFACE"
++		json_add_string proto "dslite"
++		json_add_string peeraddr "$AFTR_IP"
++		json_add_string tunlink "$INTERFACE"
++		[ -n "$ZONE_DSLITE" ] || ZONE_DSLITE=$ZONE
++		[ -n "$ZONE_DSLITE" ] && json_add_string zone "$ZONE_DSLITE"
++		[ -n "$IFACE_DSLITE_DELEGATE" ] && json_add_boolean delegate "$IFACE_DSLITE_DELEGATE"
++		json_close_object
 +		ubus call network add_dynamic "$(json_dump)"
  	fi
  
  	# TODO: $SNTP_IP $SIP_IP $SNTP_FQDN $SIP_DOMAIN
 diff --git a/package/odhcp6c/files/dhcpv6.sh b/package/odhcp6c/files/dhcpv6.sh
-index bf6cd9a..1c6d609 100755
+index bf6cd9a..0690bd1 100755
 --- a/package/odhcp6c/files/dhcpv6.sh
 +++ b/package/odhcp6c/files/dhcpv6.sh
-@@ -5,23 +5,34 @@
+@@ -5,23 +5,35 @@
  init_proto "$@"
  
  proto_dhcpv6_init_config() {
@@ -178,6 +184,7 @@ index bf6cd9a..1c6d609 100755
 +	proto_config_add_string zone_dslite
 +	proto_config_add_string iface_map
 +	proto_config_add_string zone_map
++	proto_config_add_string zone
 +	proto_config_add_string 'ifaceid:ip6addr'
 +	proto_config_add_string 'sourcerouting:bool'
 +	proto_config_add_string "userclass"
@@ -192,12 +199,12 @@ index bf6cd9a..1c6d609 100755
  
 -	local reqaddress reqprefix clientid reqopts noslaaconly norelease ip6prefix iface_dslite ifaceid
 -	json_get_vars reqaddress reqprefix clientid reqopts noslaaconly norelease ip6prefix iface_dslite ifaceid
-+	local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map soltimeout
-+	json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map soltimeout
++	local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout
++	json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout
  
  
  	# Configure
-@@ -35,16 +46,30 @@ proto_dhcpv6_setup() {
+@@ -35,16 +47,31 @@ proto_dhcpv6_setup() {
  
  	[ "$noslaaconly" = "1" ] && append opts "-S"
  
@@ -225,10 +232,11 @@ index bf6cd9a..1c6d609 100755
 +	[ "$delegate" = "0" ] && proto_export "IFACE_MAP_DELEGATE=0"
 +	[ -n "$zone_dslite" ] && proto_export "ZONE_DSLITE=$zone_dslite"
 +	[ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map"
++	[ -n "$zone" ] && proto_export "ZONE=$zone"
  
  	proto_export "INTERFACE=$config"
  	proto_run_command "$config" odhcp6c \
-@@ -52,6 +77,13 @@ proto_dhcpv6_setup() {
+@@ -52,6 +79,13 @@ proto_dhcpv6_setup() {
  		$opts $iface
  }