From 28d49e9872ea7eff6d18e228f8ba3c9a7220dbfc Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 18 Apr 2014 18:49:13 +0200
Subject: [PATCH] Update netifd from Barrier Breaker

This allows us to drop our config mode patch.
---
 ...ts-dependencies-from-Barrier-Breaker.patch | 263 ++++++++++++++++++
 ...2-Update-netifd-from-Barrier-Breaker.patch | 128 ---------
 ...el-support-for-the-TL-WDR3500-board.patch} |   0
 ...latest-git-add-UCI-config-path-patch.patch | 136 ---------
 ...-space-support-for-TL-WDR3500-board.patch} |   0
 ...uild-image-for-the-TL-WDR3500-board.patch} |   0
 ...ch-configuration-for-the-TL-WDR3500.patch} |   0
 ...add-diag-support-for-the-TL-WDR3500.patch} |   0
 ...ic-suffix-of-the-TL-WDR3500-USB-LED.patch} |   0
 ...ix-USB-power-GPIO-on-the-TL-WDR3500.patch} |   0
 ...ED-configuration-for-the-WL-WRD3500.patch} |   0
 ...fix-ethernet-LEDs-on-the-TL-WDR3500.patch} |   0
 ...PIO-output-select-values-for-AR934x.patch} |   0
 ...80211-ath9k-add-support-for-QCA953x.patch} |   0
 ...-ar71xx-add-support-for-QCA953x-SoC.patch} |   0
 ...ort-for-the-TP-LINK-TL-WR841N-ND-v9.patch} |   0
 16 files changed, 263 insertions(+), 264 deletions(-)
 create mode 100644 patches/openwrt/0002-Update-netifd-and-its-dependencies-from-Barrier-Breaker.patch
 delete mode 100644 patches/openwrt/0002-Update-netifd-from-Barrier-Breaker.patch
 rename patches/openwrt/{0007-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch => 0006-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch} (100%)
 delete mode 100644 patches/openwrt/0006-netifd-update-to-latest-git-add-UCI-config-path-patch.patch
 rename patches/openwrt/{0008-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch => 0007-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch} (100%)
 rename patches/openwrt/{0009-ar71xx-build-image-for-the-TL-WDR3500-board.patch => 0008-ar71xx-build-image-for-the-TL-WDR3500-board.patch} (100%)
 rename patches/openwrt/{0010-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch => 0009-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch} (100%)
 rename patches/openwrt/{0011-ar71xx-add-diag-support-for-the-TL-WDR3500.patch => 0010-ar71xx-add-diag-support-for-the-TL-WDR3500.patch} (100%)
 rename patches/openwrt/{0012-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch => 0011-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch} (100%)
 rename patches/openwrt/{0013-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch => 0012-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch} (100%)
 rename patches/openwrt/{0014-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch => 0013-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch} (100%)
 rename patches/openwrt/{0015-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch => 0014-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch} (100%)
 rename patches/openwrt/{0016-ar71xx-add-GPIO-output-select-values-for-AR934x.patch => 0015-ar71xx-add-GPIO-output-select-values-for-AR934x.patch} (100%)
 rename patches/openwrt/{0017-mac80211-ath9k-add-support-for-QCA953x.patch => 0016-mac80211-ath9k-add-support-for-QCA953x.patch} (100%)
 rename patches/openwrt/{0018-ar71xx-add-support-for-QCA953x-SoC.patch => 0017-ar71xx-add-support-for-QCA953x-SoC.patch} (100%)
 rename patches/openwrt/{0019-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch => 0018-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch} (100%)

diff --git a/patches/openwrt/0002-Update-netifd-and-its-dependencies-from-Barrier-Breaker.patch b/patches/openwrt/0002-Update-netifd-and-its-dependencies-from-Barrier-Breaker.patch
new file mode 100644
index 000000000..e5ea0c7c7
--- /dev/null
+++ b/patches/openwrt/0002-Update-netifd-and-its-dependencies-from-Barrier-Breaker.patch
@@ -0,0 +1,263 @@
+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
+
+diff --git a/package/libubox/Makefile b/package/libubox/Makefile
+index bcf4481..fc9834a 100644
+--- a/package/libubox/Makefile
++++ b/package/libubox/Makefile
+@@ -1,13 +1,13 @@
+ include $(TOPDIR)/rules.mk
+ 
+ PKG_NAME:=libubox
+-PKG_VERSION:=2013-10-19
++PKG_VERSION:=2014-03-18
+ PKG_RELEASE=$(PKG_SOURCE_VERSION)
+ 
+ PKG_SOURCE_PROTO:=git
+-PKG_SOURCE_URL:=git://nbd.name/luci2/libubox.git
++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:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+ PKG_MIRROR_MD5SUM:=
+ CMAKE_INSTALL:=1
+@@ -26,6 +26,7 @@ define Package/libubox
+   SECTION:=libs
+   CATEGORY:=Libraries
+   TITLE:=Basic utility library
++  ABI_VERSION:=$(PKG_VERSION)
+   DEPENDS:=
+ endef
+ 
+@@ -54,6 +55,13 @@ define Package/libjson-script
+   TITLE:=Minimalistic JSON based scripting engine
+ endef
+ 
++define Package/libubox-lua
++  SECTION:=libs
++  CATEGORY:=Libraries
++  DEPENDS:=+libubox +liblua
++  TITLE:=Lua binding for the OpenWrt Basic utility library
++endef
++
+ TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+ CMAKE_OPTIONS = \
+ 	-DLUAPATH=/usr/lib/lua
+@@ -79,7 +87,13 @@ define Package/libjson-script/install
+ 	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libjson_script.so $(1)/lib/
+ endef
+ 
++define Package/libubox-lua/install
++	$(INSTALL_DIR) $(1)/usr/lib/lua
++	$(CP) $(PKG_BUILD_DIR)/lua/uloop.so $(1)/usr/lib/lua/
++endef
++
+ $(eval $(call BuildPackage,libubox))
+ $(eval $(call BuildPackage,libblobmsg-json))
+ $(eval $(call BuildPackage,jshn))
+ $(eval $(call BuildPackage,libjson-script))
++$(eval $(call BuildPackage,libubox-lua))
+diff --git a/package/netifd/Makefile b/package/netifd/Makefile
+index 5f2ee03..21137d0 100644
+--- a/package/netifd/Makefile
++++ b/package/netifd/Makefile
+@@ -1,13 +1,13 @@
+ include $(TOPDIR)/rules.mk
+ 
+ PKG_NAME:=netifd
+-PKG_VERSION:=2013-07-16
++PKG_VERSION:=2014-04-11
+ PKG_RELEASE=$(PKG_SOURCE_VERSION)
+ 
+ PKG_SOURCE_PROTO:=git
+-PKG_SOURCE_URL:=git://nbd.name/luci2/netifd.git
++PKG_SOURCE_URL:=http://git.openwrt.org/project/netifd.git
+ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+-PKG_SOURCE_VERSION:=2674941b06c1ec67f1aff1bff9212e1372106641
++PKG_SOURCE_VERSION:=d2a33f3f0fe704e4396fa2ada08401cb955ba7cb
+ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+ PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+ # PKG_MIRROR_MD5SUM:=
+@@ -24,7 +24,7 @@ include $(INCLUDE_DIR)/cmake.mk
+ define Package/netifd
+   SECTION:=base
+   CATEGORY:=Base system
+-  DEPENDS:=+libuci +libnl-tiny +libubus +ubus +ubusd +jshn
++  DEPENDS:=+libuci +libnl-tiny +libubus +ubus +ubusd +jshn +libubox
+   TITLE:=OpenWrt Network Interface Configuration Daemon
+ endef
+ 
+@@ -40,7 +40,7 @@ define Package/netifd/install
+ 	$(INSTALL_DIR) $(1)/sbin
+ 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
+ 	$(CP) ./files/* $(1)/
+-	$(CP) $(PKG_BUILD_DIR)/dummy/netifd-proto.sh $(1)/lib/netifd/
++	$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
+ endef
+ 
+ $(eval $(call BuildPackage,netifd))
+diff --git a/package/netifd/files/etc/hotplug.d/iface/00-netstate b/package/netifd/files/etc/hotplug.d/iface/00-netstate
+index c50cda6..023025c 100644
+--- a/package/netifd/files/etc/hotplug.d/iface/00-netstate
++++ b/package/netifd/files/etc/hotplug.d/iface/00-netstate
+@@ -1,6 +1,5 @@
+ [ ifup = "$ACTION" ] && {
+ 	uci_toggle_state network "$INTERFACE" up 1
+-	uci_toggle_state network "$INTERFACE" connect_time $(sed -ne 's![^0-9].*$!!p' /proc/uptime)
+ 	[ -n "$DEVICE" ] && {
+ 		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
+--- a/package/netifd/files/lib/netifd/dhcp.script
++++ b/package/netifd/files/lib/netifd/dhcp.script
+@@ -44,19 +44,20 @@ setup_interface () {
+ 		ip6rd="${ip6rd#* }"
+ 		local ip6rdbr="${ip6rd%% *}"
+ 
+-uci -q batch <<-EOF >/dev/null
+-set network.$IFACE6RD.proto=6rd
+-set network.$IFACE6RD.auto=0
+-set network.$IFACE6RD.peeraddr=$ip6rdbr
+-set network.$IFACE6RD.ip4prefixlen=$v4mask
+-set network.$IFACE6RD.ip6prefix=$ip6rdprefix
+-set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen
+-commit network
+-EOF
++		json_init
++		json_add_string name "$IFACE6RD"
++		json_add_string ifname "@$INTERFACE"
++		json_add_string proto "6rd"
++		json_add_string peeraddr "$ip6rdbr"
++		json_add_int ip4prefixlen "$v4mask"
++		json_add_string ip6prefix "$ip6rdprefix"
++		json_add_int ip6prefixlen "$ip6rdprefixlen"
++		json_add_string tunlink "$INTERFACE"
++		[ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
++		[ -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
+--- a/package/netifd/files/lib/netifd/proto/dhcp.sh
++++ b/package/netifd/files/lib/netifd/proto/dhcp.sh
+@@ -5,31 +5,42 @@
+ init_proto "$@"
+ 
+ proto_dhcp_init_config() {
+-	proto_config_add_string "ipaddr"
+-	proto_config_add_string "netmask"
+-	proto_config_add_string "hostname"
+-	proto_config_add_string "clientid"
+-	proto_config_add_string "vendorid"
+-	proto_config_add_boolean "broadcast"
+-	proto_config_add_string "reqopts"
+-	proto_config_add_string "iface6rd"
++	renew_handler=1
++
++	proto_config_add_string 'ipaddr:ipaddr'
++	proto_config_add_string 'hostname:hostname'
++	proto_config_add_string clientid
++	proto_config_add_string vendorid
++	proto_config_add_boolean 'broadcast:bool'
++	proto_config_add_string 'reqopts:list(string)'
++	proto_config_add_string iface6rd
++	proto_config_add_string sendopts
++	proto_config_add_boolean delegate
++	proto_config_add_string zone6rd
+ }
+ 
+ proto_dhcp_setup() {
+ 	local config="$1"
+ 	local iface="$2"
+ 
+-	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 opt dhcpopts
+ 	for opt in $reqopts; do
+ 		append dhcpopts "-O $opt"
+ 	done
+ 
++	for opt in $sendopts; do
++		append dhcpopts "-x $opt"
++	done
++
+ 	[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
+ 	[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
+ 	[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
++	[ -n "$iface6rd" ] && append dhcpopts "-O 212"
++	[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
++	[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
+ 
+ 	proto_export "INTERFACE=$config"
+ 	proto_run_command "$config" udhcpc \
+@@ -42,6 +53,13 @@ proto_dhcp_setup() {
+ 		$clientid $broadcast $dhcpopts
+ }
+ 
++proto_dhcp_renew() {
++	local interface="$1"
++	# SIGUSR1 forces udhcpc to renew its lease
++	local sigusr1="$(kill -l SIGUSR1)"
++	[ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1
++}
++
+ proto_dhcp_teardown() {
+ 	local interface="$1"
+ 	proto_kill_command "$interface"
+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
+--- /dev/null
++++ b/package/netifd/patches/001-musl_af_inet_include.patch
+@@ -0,0 +1,11 @@
++diff -urN netifd-2012-10-29/utils.c netifd-2012-10-29.new/utils.c
++--- netifd-2012-10-29/utils.c	2012-11-23 17:15:39.000000000 +0100
+++++ netifd-2012-10-29.new/utils.c	2012-11-23 17:16:53.409244361 +0100
++@@ -17,6 +17,7 @@
++ 
++ #include <arpa/inet.h>
++ #include <netinet/in.h>
+++#include <sys/socket.h>
++ 
++ void
++ __vlist_simple_init(struct vlist_simple_tree *tree, int offset)
+diff --git a/package/uci/Makefile b/package/uci/Makefile
+index 54ad80b..29f9ef3 100644
+--- a/package/uci/Makefile
++++ b/package/uci/Makefile
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (C) 2008-2013 OpenWrt.org
++# Copyright (C) 2008-2014 OpenWrt.org
+ #
+ # This is free software, licensed under the GNU General Public License v2.
+ # See /LICENSE for more information.
+@@ -7,13 +7,13 @@
+ 
+ include $(TOPDIR)/rules.mk
+ 
+-UCI_VERSION=2013-06-11
++UCI_VERSION=2014-04-11
+ UCI_RELEASE=1
+ 
+ PKG_NAME:=uci
+ PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE))
+ PKG_RELEASE:=1
+-PKG_REV:=c9c9d5cb085acc58b6579ace83fb79c085a9db27
++PKG_REV:=e339407372ffc70b1451e4eda218c01aa95a6a7f
+ 
+ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+ PKG_SOURCE_URL:=git://nbd.name/uci.git
diff --git a/patches/openwrt/0002-Update-netifd-from-Barrier-Breaker.patch b/patches/openwrt/0002-Update-netifd-from-Barrier-Breaker.patch
deleted file mode 100644
index b2945696f..000000000
--- a/patches/openwrt/0002-Update-netifd-from-Barrier-Breaker.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Sat, 11 Jan 2014 11:47:31 +0100
-Subject: Update netifd from Barrier Breaker
-
-diff --git a/package/netifd/Makefile b/package/netifd/Makefile
-index 5f2ee03..6f6f30e 100644
---- a/package/netifd/Makefile
-+++ b/package/netifd/Makefile
-@@ -1,13 +1,13 @@
- include $(TOPDIR)/rules.mk
- 
- PKG_NAME:=netifd
--PKG_VERSION:=2013-07-16
-+PKG_VERSION:=2013-12-29
- PKG_RELEASE=$(PKG_SOURCE_VERSION)
- 
- PKG_SOURCE_PROTO:=git
- PKG_SOURCE_URL:=git://nbd.name/luci2/netifd.git
- PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
--PKG_SOURCE_VERSION:=2674941b06c1ec67f1aff1bff9212e1372106641
-+PKG_SOURCE_VERSION:=7d79d0a8aa5a5b4c1ed987af119356438d98fe7b
- PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
- PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
- # PKG_MIRROR_MD5SUM:=
-@@ -40,7 +40,7 @@ define Package/netifd/install
- 	$(INSTALL_DIR) $(1)/sbin
- 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
- 	$(CP) ./files/* $(1)/
--	$(CP) $(PKG_BUILD_DIR)/dummy/netifd-proto.sh $(1)/lib/netifd/
-+	$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
- endef
- 
- $(eval $(call BuildPackage,netifd))
-diff --git a/package/netifd/files/etc/hotplug.d/iface/00-netstate b/package/netifd/files/etc/hotplug.d/iface/00-netstate
-index c50cda6..023025c 100644
---- a/package/netifd/files/etc/hotplug.d/iface/00-netstate
-+++ b/package/netifd/files/etc/hotplug.d/iface/00-netstate
-@@ -1,6 +1,5 @@
- [ ifup = "$ACTION" ] && {
- 	uci_toggle_state network "$INTERFACE" up 1
--	uci_toggle_state network "$INTERFACE" connect_time $(sed -ne 's![^0-9].*$!!p' /proc/uptime)
- 	[ -n "$DEVICE" ] && {
- 		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..77b77f5 100755
---- a/package/netifd/files/lib/netifd/dhcp.script
-+++ b/package/netifd/files/lib/netifd/dhcp.script
-@@ -44,19 +44,18 @@ setup_interface () {
- 		ip6rd="${ip6rd#* }"
- 		local ip6rdbr="${ip6rd%% *}"
- 
--uci -q batch <<-EOF >/dev/null
--set network.$IFACE6RD.proto=6rd
--set network.$IFACE6RD.auto=0
--set network.$IFACE6RD.peeraddr=$ip6rdbr
--set network.$IFACE6RD.ip4prefixlen=$v4mask
--set network.$IFACE6RD.ip6prefix=$ip6rdprefix
--set network.$IFACE6RD.ip6prefixlen=$ip6rdprefixlen
--commit network
--EOF
-+		json_init
-+		json_add_string name "$IFACE6RD"
-+		json_add_string ifname "@$INTERFACE"
-+		json_add_string proto "6rd"
-+		json_add_string peeraddr "$ip6rdbr"
-+		json_add_int ip4prefixlen "$v4mask"
-+		json_add_string ip6prefix "$ip6rdprefix"
-+		json_add_int ip6prefixlen "$ip6rdprefixlen"
-+		json_add_string tunlink "$INTERFACE"
-+		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..0117b27 100755
---- a/package/netifd/files/lib/netifd/proto/dhcp.sh
-+++ b/package/netifd/files/lib/netifd/proto/dhcp.sh
-@@ -13,20 +13,25 @@ proto_dhcp_init_config() {
- 	proto_config_add_boolean "broadcast"
- 	proto_config_add_string "reqopts"
- 	proto_config_add_string "iface6rd"
-+	proto_config_add_string "sendopts"
- }
- 
- proto_dhcp_setup() {
- 	local config="$1"
- 	local iface="$2"
- 
--	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
-+	json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts
- 
- 	local opt dhcpopts
- 	for opt in $reqopts; do
- 		append dhcpopts "-O $opt"
- 	done
- 
-+	for opt in $sendopts; do
-+		append dhcpopts "-x $opt"
-+	done
-+
- 	[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
- 	[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
- 	[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
-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
---- /dev/null
-+++ b/package/netifd/patches/001-musl_af_inet_include.patch
-@@ -0,0 +1,11 @@
-+diff -urN netifd-2012-10-29/utils.c netifd-2012-10-29.new/utils.c
-+--- netifd-2012-10-29/utils.c	2012-11-23 17:15:39.000000000 +0100
-++++ netifd-2012-10-29.new/utils.c	2012-11-23 17:16:53.409244361 +0100
-+@@ -17,6 +17,7 @@
-+ 
-+ #include <arpa/inet.h>
-+ #include <netinet/in.h>
-++#include <sys/socket.h>
-+ 
-+ void
-+ __vlist_simple_init(struct vlist_simple_tree *tree, int offset)
diff --git a/patches/openwrt/0007-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch b/patches/openwrt/0006-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch
similarity index 100%
rename from patches/openwrt/0007-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch
rename to patches/openwrt/0006-ar71xx-add-kernel-support-for-the-TL-WDR3500-board.patch
diff --git a/patches/openwrt/0006-netifd-update-to-latest-git-add-UCI-config-path-patch.patch b/patches/openwrt/0006-netifd-update-to-latest-git-add-UCI-config-path-patch.patch
deleted file mode 100644
index be5e97cbc..000000000
--- a/patches/openwrt/0006-netifd-update-to-latest-git-add-UCI-config-path-patch.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Thu, 13 Feb 2014 15:12:37 +0100
-Subject: netifd: update to latest git, add UCI config path patch
-
-diff --git a/package/netifd/Makefile b/package/netifd/Makefile
-index 6f6f30e..d5fa7f0 100644
---- a/package/netifd/Makefile
-+++ b/package/netifd/Makefile
-@@ -1,13 +1,13 @@
- include $(TOPDIR)/rules.mk
- 
- PKG_NAME:=netifd
--PKG_VERSION:=2013-12-29
-+PKG_VERSION:=2014-02-13
- PKG_RELEASE=$(PKG_SOURCE_VERSION)
- 
- PKG_SOURCE_PROTO:=git
- PKG_SOURCE_URL:=git://nbd.name/luci2/netifd.git
- PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
--PKG_SOURCE_VERSION:=7d79d0a8aa5a5b4c1ed987af119356438d98fe7b
-+PKG_SOURCE_VERSION:=88b3e92933925c09cfb6e95e9c8645727654ddf7
- PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
- PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
- # PKG_MIRROR_MD5SUM:=
-diff --git a/package/netifd/patches/001-musl_af_inet_include.patch b/package/netifd/patches/001-musl_af_inet_include.patch
-index 510ee05..0dbe645 100644
---- a/package/netifd/patches/001-musl_af_inet_include.patch
-+++ b/package/netifd/patches/001-musl_af_inet_include.patch
-@@ -1,11 +1,10 @@
--diff -urN netifd-2012-10-29/utils.c netifd-2012-10-29.new/utils.c
----- netifd-2012-10-29/utils.c	2012-11-23 17:15:39.000000000 +0100
--+++ netifd-2012-10-29.new/utils.c	2012-11-23 17:16:53.409244361 +0100
-+--- a/utils.c
-++++ b/utils.c
- @@ -17,6 +17,7 @@
-  
-  #include <arpa/inet.h>
-  #include <netinet/in.h>
- +#include <sys/socket.h>
-  
-- void
-- __vlist_simple_init(struct vlist_simple_tree *tree, int offset)
-+ #ifdef __APPLE__
-+ #include <libproc.h>
-diff --git a/package/netifd/patches/101-allow-setting-the-uci-config-path.patch b/package/netifd/patches/101-allow-setting-the-uci-config-path.patch
-new file mode 100644
-index 0000000..7561dd5
---- /dev/null
-+++ b/package/netifd/patches/101-allow-setting-the-uci-config-path.patch
-@@ -0,0 +1,86 @@
-+From addf95eebc22afd78c516664ae27f955277e3ee8 Mon Sep 17 00:00:00 2001
-+Message-Id: <addf95eebc22afd78c516664ae27f955277e3ee8.1392300589.git.mschiffer@universe-factory.net>
-+From: Matthias Schiffer <mschiffer@universe-factory.net>
-+Date: Thu, 13 Feb 2014 15:02:18 +0100
-+Subject: [PATCH] Allow setting the UCI config path
-+
-+---
-+ config.c | 4 +++-
-+ main.c   | 7 ++++++-
-+ netifd.h | 3 +++
-+ 3 files changed, 12 insertions(+), 2 deletions(-)
-+
-+--- a/config.c
-++++ b/config.c
-+@@ -190,8 +190,10 @@ config_init_package(const char *config)
-+ 		ctx = uci_alloc_context();
-+ 		uci_ctx = ctx;
-+ 
-++		if (config_path)
-++			uci_set_confdir(ctx, config_path);
-++
-+ #ifdef DUMMY_MODE
-+-		uci_set_confdir(ctx, "./config");
-+ 		uci_set_savedir(ctx, "./tmp");
-+ #endif
-+ 	} else {
-+--- a/main.c
-++++ b/main.c
-+@@ -27,6 +27,7 @@
-+ 
-+ unsigned int debug_mask = 0;
-+ const char *main_path = DEFAULT_MAIN_PATH;
-++const char *config_path = DEFAULT_CONFIG_PATH;
-+ const char *resolv_conf = DEFAULT_RESOLV_CONF;
-+ static char **global_argv;
-+ 
-+@@ -235,6 +236,7 @@ static int usage(const char *progname)
-+ 		" -d <mask>:		Mask for debug messages\n"
-+ 		" -s <path>:		Path to the ubus socket\n"
-+ 		" -p <path>:		Path to netifd addons (default: %s)\n"
-++		" -c <path>:		Path to UCI configuration\n"
-+ 		" -h <path>:		Path to the hotplug script\n"
-+ 		" -r <path>:		Path to resolv.conf\n"
-+ 		" -l <level>:		Log output level (default: %d)\n"
-+@@ -284,7 +286,7 @@ int main(int argc, char **argv)
-+ 
-+ 	global_argv = argv;
-+ 
-+-	while ((ch = getopt(argc, argv, "d:s:p:h:r:l:S")) != -1) {
-++	while ((ch = getopt(argc, argv, "d:s:p:c:h:r:l:S")) != -1) {
-+ 		switch(ch) {
-+ 		case 'd':
-+ 			debug_mask = strtoul(optarg, NULL, 0);
-+@@ -295,6 +297,9 @@ int main(int argc, char **argv)
-+ 		case 'p':
-+ 			main_path = optarg;
-+ 			break;
-++		case 'c':
-++			config_path = optarg;
-++			break;
-+ 		case 'h':
-+ 			hotplug_cmd_path = optarg;
-+ 			break;
-+--- a/netifd.h
-++++ b/netifd.h
-+@@ -30,10 +30,12 @@
-+ 
-+ #ifdef DUMMY_MODE
-+ #define DEFAULT_MAIN_PATH	"./examples"
-++#define DEFAULT_CONFIG_PATH	"./config"
-+ #define DEFAULT_HOTPLUG_PATH	"./examples/hotplug-cmd"
-+ #define DEFAULT_RESOLV_CONF	"./tmp/resolv.conf"
-+ #else
-+ #define DEFAULT_MAIN_PATH	"/lib/netifd"
-++#define DEFAULT_CONFIG_PATH	NULL /* use the default set in libuci */
-+ #define DEFAULT_HOTPLUG_PATH	"/sbin/hotplug-call"
-+ #define DEFAULT_RESOLV_CONF	"/tmp/resolv.conf.auto"
-+ #endif
-+@@ -94,6 +96,7 @@ struct device;
-+ struct interface;
-+ 
-+ extern const char *main_path;
-++extern const char *config_path;
-+ void netifd_restart(void);
-+ void netifd_reload(void);
-+ 
diff --git a/patches/openwrt/0008-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch b/patches/openwrt/0007-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch
similarity index 100%
rename from patches/openwrt/0008-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch
rename to patches/openwrt/0007-ar71xx-add-user-space-support-for-TL-WDR3500-board.patch
diff --git a/patches/openwrt/0009-ar71xx-build-image-for-the-TL-WDR3500-board.patch b/patches/openwrt/0008-ar71xx-build-image-for-the-TL-WDR3500-board.patch
similarity index 100%
rename from patches/openwrt/0009-ar71xx-build-image-for-the-TL-WDR3500-board.patch
rename to patches/openwrt/0008-ar71xx-build-image-for-the-TL-WDR3500-board.patch
diff --git a/patches/openwrt/0010-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch b/patches/openwrt/0009-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch
similarity index 100%
rename from patches/openwrt/0010-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch
rename to patches/openwrt/0009-ar71xx-add-default-switch-configuration-for-the-TL-WDR3500.patch
diff --git a/patches/openwrt/0011-ar71xx-add-diag-support-for-the-TL-WDR3500.patch b/patches/openwrt/0010-ar71xx-add-diag-support-for-the-TL-WDR3500.patch
similarity index 100%
rename from patches/openwrt/0011-ar71xx-add-diag-support-for-the-TL-WDR3500.patch
rename to patches/openwrt/0010-ar71xx-add-diag-support-for-the-TL-WDR3500.patch
diff --git a/patches/openwrt/0012-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch b/patches/openwrt/0011-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch
similarity index 100%
rename from patches/openwrt/0012-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch
rename to patches/openwrt/0011-ar71xx-remove-numeric-suffix-of-the-TL-WDR3500-USB-LED.patch
diff --git a/patches/openwrt/0013-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch b/patches/openwrt/0012-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch
similarity index 100%
rename from patches/openwrt/0013-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch
rename to patches/openwrt/0012-ar71xx-fix-USB-power-GPIO-on-the-TL-WDR3500.patch
diff --git a/patches/openwrt/0014-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch b/patches/openwrt/0013-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch
similarity index 100%
rename from patches/openwrt/0014-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch
rename to patches/openwrt/0013-ar71xx-add-default-LED-configuration-for-the-WL-WRD3500.patch
diff --git a/patches/openwrt/0015-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch b/patches/openwrt/0014-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch
similarity index 100%
rename from patches/openwrt/0015-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch
rename to patches/openwrt/0014-ar71xx-fix-ethernet-LEDs-on-the-TL-WDR3500.patch
diff --git a/patches/openwrt/0016-ar71xx-add-GPIO-output-select-values-for-AR934x.patch b/patches/openwrt/0015-ar71xx-add-GPIO-output-select-values-for-AR934x.patch
similarity index 100%
rename from patches/openwrt/0016-ar71xx-add-GPIO-output-select-values-for-AR934x.patch
rename to patches/openwrt/0015-ar71xx-add-GPIO-output-select-values-for-AR934x.patch
diff --git a/patches/openwrt/0017-mac80211-ath9k-add-support-for-QCA953x.patch b/patches/openwrt/0016-mac80211-ath9k-add-support-for-QCA953x.patch
similarity index 100%
rename from patches/openwrt/0017-mac80211-ath9k-add-support-for-QCA953x.patch
rename to patches/openwrt/0016-mac80211-ath9k-add-support-for-QCA953x.patch
diff --git a/patches/openwrt/0018-ar71xx-add-support-for-QCA953x-SoC.patch b/patches/openwrt/0017-ar71xx-add-support-for-QCA953x-SoC.patch
similarity index 100%
rename from patches/openwrt/0018-ar71xx-add-support-for-QCA953x-SoC.patch
rename to patches/openwrt/0017-ar71xx-add-support-for-QCA953x-SoC.patch
diff --git a/patches/openwrt/0019-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch b/patches/openwrt/0018-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch
similarity index 100%
rename from patches/openwrt/0019-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch
rename to patches/openwrt/0018-ar71xx-add-support-for-the-TP-LINK-TL-WR841N-ND-v9.patch
-- 
GitLab