Browse Source

Fresh pull from upstream lede-17.01 branch to fix several outstanding
bugs. Some support may have regressed as a result.

RISCi_ATOM 6 years ago
parent
commit
447cf1a2b7
100 changed files with 582 additions and 1320 deletions
  1. 1 1
      include/feeds.mk
  2. 2 2
      include/image-commands.mk
  3. 1 0
      include/image-legacy.mk
  4. 4 4
      include/image.mk
  5. 1 1
      include/prereq-build.mk
  6. 3 2
      include/toplevel.mk
  7. 5 3
      package/base-files/Makefile
  8. 2 5
      package/base-files/files/bin/config_generate
  9. 1 1
      package/base-files/files/etc/init.d/system
  10. 61 34
      package/base-files/files/lib/functions/network.sh
  11. 21 1
      package/base-files/files/lib/functions/uci-defaults.sh
  12. 4 1
      package/base-files/files/lib/preinit/10_indicate_preinit
  13. 1 1
      package/base-files/files/usr/lib/os-release
  14. 4 4
      package/base-files/image-config.in
  15. 7 7
      package/kernel/linux/modules/crypto.mk
  16. 0 1
      package/kernel/linux/modules/netdevices.mk
  17. 2 2
      package/kernel/linux/modules/netfilter.mk
  18. 1 1
      package/kernel/linux/modules/sound.mk
  19. 2 2
      package/kernel/linux/modules/video.mk
  20. 6 4
      package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  21. 3 3
      package/kernel/mac80211/files/lib/wifi/mac80211.sh
  22. 0 10
      package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  23. 0 20
      package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  24. 3 3
      package/libs/mbedtls/Makefile
  25. 27 27
      package/libs/mbedtls/patches/200-config.patch
  26. 1 1
      package/network/config/gre/Makefile
  27. 1 1
      package/network/config/gre/files/gre.sh
  28. 3 13
      package/network/services/dnsmasq/Makefile
  29. 0 46
      package/network/services/dnsmasq/files/dhcp-script.sh
  30. 1 1
      package/network/services/dnsmasq/files/dhcp.conf
  31. 67 304
      package/network/services/dnsmasq/files/dnsmasq.init
  32. 0 4
      package/network/services/dnsmasq/files/dnsmasq_acl.json
  33. 0 15
      package/network/services/dnsmasq/files/rfc6761.conf
  34. 0 126
      package/network/services/dnsmasq/patches/240-ubus.patch
  35. 1 1
      package/network/services/hostapd/Makefile
  36. 1 1
      package/network/services/hostapd/files/hostapd.sh
  37. 4 4
      package/network/services/odhcpd/Makefile
  38. 17 2
      package/network/services/odhcpd/files/odhcpd.defaults
  39. 5 4
      package/network/services/openvpn/Makefile
  40. 29 54
      package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch
  41. 3 3
      package/network/services/uhttpd/Makefile
  42. 1 1
      package/network/utils/comgt/Makefile
  43. 1 1
      package/network/utils/comgt/files/3g.sh
  44. 1 2
      package/network/utils/comgt/files/directip.sh
  45. 1 1
      package/network/utils/curl/Makefile
  46. 4 5
      package/network/utils/tcpdump/Makefile
  47. 39 35
      package/network/utils/tcpdump/patches/100-tcpdump_mini.patch
  48. 1 1
      scripts/checkpatch.pl
  49. 26 9
      scripts/feeds
  50. 1 1
      scripts/om-fwupgradecfg-gen.sh
  51. 3 2
      target/imagebuilder/Makefile
  52. 7 1
      target/linux/ar71xx/base-files/etc/board.d/01_leds
  53. 6 7
      target/linux/ar71xx/base-files/etc/board.d/02_network
  54. 3 0
      target/linux/ar71xx/base-files/etc/diag.sh
  55. 0 133
      target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
  56. 4 0
      target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration
  57. 5 5
      target/linux/ar71xx/base-files/lib/ar71xx.sh
  58. 0 54
      target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
  59. 2 2
      target/linux/ar71xx/base-files/lib/upgrade/platform.sh
  60. 1 1
      target/linux/ar71xx/config-4.4
  61. 15 13
      target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
  62. 1 1
      target/linux/ar71xx/files/arch/mips/ath79/Makefile
  63. 37 42
      target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c
  64. 0 87
      target/linux/ar71xx/files/arch/mips/ath79/mach-gl-usb150.c
  65. 2 0
      target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c
  66. 1 1
      target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c
  67. 1 1
      target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
  68. 17 62
      target/linux/ar71xx/image/generic.mk
  69. 0 25
      target/linux/ar71xx/image/legacy-devices.mk
  70. 2 2
      target/linux/ar71xx/image/legacy.mk
  71. 2 2
      target/linux/ar71xx/image/mikrotik.mk
  72. 9 41
      target/linux/ar71xx/image/tp-link.mk
  73. 1 0
      target/linux/ar71xx/mikrotik/config-default
  74. 2 0
      target/linux/ar71xx/mikrotik/target.mk
  75. 1 0
      target/linux/ar71xx/nand/config-default
  76. 1 1
      target/linux/generic/patches-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch
  77. 9 9
      target/linux/generic/patches-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
  78. 0 11
      target/linux/generic/patches-4.4/704-phy-no-genphy-soft-reset.patch
  79. 3 3
      target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch
  80. 1 1
      target/linux/ramips/Makefile
  81. 9 6
      target/linux/ramips/base-files/etc/board.d/01_leds
  82. 34 10
      target/linux/ramips/base-files/etc/board.d/02_network
  83. 11 2
      target/linux/ramips/base-files/etc/diag.sh
  84. 16 4
      target/linux/ramips/base-files/lib/ramips.sh
  85. 5 1
      target/linux/ramips/base-files/lib/upgrade/platform.sh
  86. 1 0
      target/linux/ramips/base-files/sbin/fixup-mac-address
  87. 0 1
      target/linux/ramips/dts/3G150B.dts
  88. 0 1
      target/linux/ramips/dts/3G300M.dts
  89. 0 1
      target/linux/ramips/dts/A5-V11.dts
  90. 0 1
      target/linux/ramips/dts/AI-BR100.dts
  91. 0 1
      target/linux/ramips/dts/AIR3GII.dts
  92. 0 1
      target/linux/ramips/dts/ALL0256N-4M.dts
  93. 0 1
      target/linux/ramips/dts/ALL0256N-8M.dts
  94. 0 1
      target/linux/ramips/dts/ALL5002.dts
  95. 0 1
      target/linux/ramips/dts/ALL5003.dts
  96. 0 1
      target/linux/ramips/dts/ASL26555-16M.dts
  97. 0 1
      target/linux/ramips/dts/ASL26555-8M.dts
  98. 0 1
      target/linux/ramips/dts/AWAPN2403.dts
  99. 0 1
      target/linux/ramips/dts/AWM002-4M.dtsi
  100. 0 1
      target/linux/ramips/dts/AWM002-8M.dtsi

+ 1 - 1
include/feeds.mk

@@ -47,7 +47,7 @@ endef
 # 1: destination file
 define FeedSourcesAppend
 ( \
-  echo "src/gz %n_core %U/%S/packages"; \
+  echo "src/gz %n_core %U/targets/%S/packages"; \
   $(strip $(if $(CONFIG_PER_FEED_REPO), \
 	$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %n_$(feed) %U/packages/%A/$(feed)";) \
 	$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \

+ 2 - 2
include/image-commands.mk

@@ -7,7 +7,7 @@ define Build/uImage
 	mkimage -A $(LINUX_KARCH) \
 		-O linux -T kernel \
 		-C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-		-n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) LEDE Linux-$(LINUX_VERSION))' -d $@ $@.new
+		-n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) libreCMC Linux-$(LINUX_VERSION))' -d $@ $@.new
 	@mv $@.new $@
 endef
 
@@ -22,7 +22,7 @@ endef
 
 define Build/netgear-dni
 	$(STAGING_DIR_HOST)/bin/mkdniimg \
-		-B $(NETGEAR_BOARD_ID) -v LEDE.$(REVISION) \
+		-B $(NETGEAR_BOARD_ID) -v libreCMC.$(REVISION) \
 		$(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
 		-r "$(1)" \
 		-i $@ -o $@.new

+ 1 - 0
include/image-legacy.mk

@@ -48,6 +48,7 @@ endef
 ifdef TARGET_PER_DEVICE_ROOTFS
   define Image/Build/Profile/Filesystem
 	cp $(KDIR)/root.$(2)+pkg=$(3) $(KDIR)/root.$(2)
+	$(call Image/Build/$(2),$(2))
 	$(call Image/Build/Profile,$(1),$(2))
   endef
 else

+ 4 - 4
include/image.mk

@@ -137,7 +137,7 @@ endef
 
 define Image/BuildKernel/MkuImage
 	mkimage -A $(ARCH) -O linux -T kernel -C $(1) -a $(2) -e $(3) \
-		-n '$(call toupper,$(ARCH)) LEDE Linux-$(LINUX_VERSION)' -d $(4) $(5)
+		-n '$(call toupper,$(ARCH)) libreCMC Linux-$(LINUX_VERSION)' -d $(4) $(5)
 endef
 
 define Image/BuildKernel/MkFIT
@@ -277,7 +277,7 @@ endif
 
 ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
   define Image/Build/cpiogz
-	( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
+	( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root | gzip -9n >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
   endef
 endif
 
@@ -420,7 +420,7 @@ define Device/Build/initramfs
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
 	cp $$^ $$@
 
-  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
+  $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
 	@rm -f $$@
 	$$(call concat_cmd,$$(KERNEL_INITRAMFS))
 endef
@@ -444,7 +444,7 @@ define Device/Build/kernel
     ifdef CONFIG_IB
       install: $$(KDIR_KERNEL_IMAGE)
     endif
-    $$(KDIR_KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS)
+    $$(KDIR_KERNEL_IMAGE): $(KDIR)/$$(KERNEL_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
 	@rm -f $$@
 	$$(call concat_cmd,$$(KERNEL))
 	$$(if $$(KERNEL_SIZE),$$(call Build/check-size,$$(KERNEL_SIZE)))

+ 1 - 1
include/prereq-build.mk

@@ -20,7 +20,7 @@ $(eval $(call TestHostCommand,working-make, \
 	$(MAKE) -v | grep -E 'Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)'))
 
 $(eval $(call TestHostCommand,case-sensitive-fs, \
-	LEDE can only be built on a case-sensitive filesystem, \
+	libreCMC can only be built on a case-sensitive filesystem, \
 	rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
 		test ! -f $(TMP_DIR)/test.FS))
 

+ 3 - 2
include/toplevel.mk

@@ -23,6 +23,7 @@ HOSTCC ?= $(CC)
 export REVISION
 export SOURCE_DATE_EPOCH
 export GIT_CONFIG_PARAMETERS='core.autocrlf=false'
+export GIT_ASKPASS:=/bin/true
 export MAKE_JOBSERVER=$(filter --jobserver%,$(MAKEFLAGS))
 
 # prevent perforce from messing with the patch utility
@@ -126,7 +127,7 @@ menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
 	if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
 		cp $(HOME)/.openwrt/defconfig .config; \
 	fi
-	$< Config.in
+	[ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; $< Config.in
 
 prepare_kernel_conf: .config FORCE
 
@@ -170,7 +171,7 @@ else
   DOWNLOAD_DIRS = package/download
 endif
 
-download: .config FORCE
+download: .config FORCE $(if $(wildcard $(TOPDIR)/staging_dir/host/bin/flock),,tools/flock/compile)
 	@+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
 
 clean dirclean: .config

+ 5 - 3
package/base-files/Makefile

@@ -11,14 +11,15 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=172
+PKG_RELEASE:=173.1
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=usign/host
 PKG_LICENSE:=GPL-2.0
 
-PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE
+# Extend depends from version.mk
+PKG_CONFIG_DEPENDS += CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -31,7 +32,7 @@ define Package/base-files
   SECTION:=base
   CATEGORY:=Base system
   DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:librecmc-keyring +fstools +fwtool
-  TITLE:=Base filesystem for libreCMC
+  TITLE:=Base filesystem for Lede
   URL:=http://openwrt.org/
   VERSION:=$(PKG_RELEASE)-$(REVISION)
 endef
@@ -137,6 +138,7 @@ define Package/base-files/install
 
 	mkdir -p $(1)/CONTROL
 	mkdir -p $(1)/dev
+	mkdir -p $(1)/etc/config
 	mkdir -p $(1)/etc/crontabs
 	mkdir -p $(1)/etc/rc.d
 	mkdir -p $(1)/overlay

+ 2 - 5
package/base-files/files/bin/config_generate

@@ -119,17 +119,14 @@ generate_network() {
 		;;
 
 		pppoe)
-			# fixup IPv6 slave interface
-			ifname="pppoe-$1"
-
 			uci -q batch <<-EOF
 				set network.$1.proto='pppoe'
 				set network.$1.username='username'
 				set network.$1.password='password'
-				set network.$1.ipv6='auto'
+				set network.$1.ipv6='1'
 				delete network.${1}6
 				set network.${1}6='interface'
-				set network.${1}6.ifname='$ifname'
+				set network.${1}6.ifname='@${1}'
 				set network.${1}6.proto='dhcpv6'
 			EOF
 		;;

+ 1 - 1
package/base-files/files/etc/init.d/system

@@ -7,7 +7,7 @@ USE_PROCD=1
 validate_system_section()
 {
 	uci_validate_section system system "${1}" \
-		'hostname:string:lede' \
+		'hostname:string:librecmc' \
 		'conloglevel:uinteger' \
 		'buffersize:uinteger' \
 		'timezone:string:UTC' \

+ 61 - 34
package/base-files/files/lib/functions/network.sh

@@ -29,18 +29,9 @@ network_get_ipaddr() {
 # 1: destination variable
 # 2: interface
 network_get_ipaddr6() {
-	local __addr
-
-	if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][0].address"; then
-		case "$__addr" in
-			*:)	export "$1=${__addr}1" ;;
-			*)	export "$1=${__addr}" ;;
-		esac
-		return 0
-	fi
-
-	unset $1
-	return 1
+	__network_ifstatus "$1" "$2" "['ipv6-address'][0].address" || \
+		__network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][0]['local-address'].address" || \
+		return 1
 }
 
 # determine first IPv4 subnet of given logical interface
@@ -54,7 +45,36 @@ network_get_subnet() {
 # 1: destination variable
 # 2: interface
 network_get_subnet6() {
-	__network_ifstatus "$1" "$2" "['ipv6-address'][0]['address','mask']" "/"
+	local __nets __addr
+
+	if network_get_subnets6 __nets "$2"; then
+		# Attempt to return first non-fe80::/10, non-fc::/7 range
+		for __addr in $__nets; do
+			case "$__addr" in fe[8ab]?:*|f[cd]??:*)
+				continue
+			esac
+			export "$1=$__addr"
+			return 0
+		done
+
+		# Attempt to return first non-fe80::/10 range
+		for __addr in $__nets; do
+			case "$__addr" in fe[8ab]?:*)
+				continue
+			esac
+			export "$1=$__addr"
+			return 0
+		done
+
+		# Return first item
+		for __addr in $__nets; do
+			export "$1=$__addr"
+			return 0
+		done
+	fi
+
+	unset "$1"
+	return 1
 }
 
 # determine first IPv6 prefix of given logical interface
@@ -78,14 +98,19 @@ network_get_ipaddrs6() {
 	local __addr
 	local __list=""
 
-	if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][*].address"; then
+	if __network_ifstatus "__addr" "$2" "['ipv6-address'][*].address"; then
 		for __addr in $__addr; do
-			case "$__addr" in
-				*:) __list="${__list:+$__list }${__addr}1" ;;
-				*)  __list="${__list:+$__list }${__addr}"  ;;
-			esac
+			__list="${__list:+$__list }${__addr}"
+		done
+	fi
+
+	if __network_ifstatus "__addr" "$2" "['ipv6-prefix-assignment'][*]['local-address'].address"; then
+		for __addr in $__addr; do
+			__list="${__list:+$__list }${__addr}"
 		done
+	fi
 
+	if [ -n "$__list" ]; then
 		export "$1=$__list"
 		return 0
 	fi
@@ -98,18 +123,13 @@ network_get_ipaddrs6() {
 # 1: destination variable
 # 2: interface
 network_get_ipaddrs_all() {
-	local __addr
-	local __list=""
+	local __addr __addr6
 
-	if __network_ifstatus "__addr" "$2" "['ipv4-address','ipv6-address','ipv6-prefix-assignment'][*].address"; then
-		for __addr in $__addr; do
-			case "$__addr" in
-				*:) __list="${__list:+$__list }${__addr}1" ;;
-				*)  __list="${__list:+$__list }${__addr}"  ;;
-			esac
-		done
+	network_get_ipaddrs __addr "$2"
+	network_get_ipaddrs6 __addr6 "$2"
 
-		export "$1=$__list"
+	if [ -n "$__addr" -o -n "$__addr6" ]; then
+		export "$1=${__addr:+$__addr }$__addr6"
 		return 0
 	fi
 
@@ -128,17 +148,24 @@ network_get_subnets() {
 # 1: destination variable
 # 2: interface
 network_get_subnets6() {
-	local __addr
+	local __addr __mask
 	local __list=""
 
-	if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][*]['address','mask']" "/ "; then
+	if __network_ifstatus "__addr" "$2" "['ipv6-address'][*]['address','mask']" "/ "; then
 		for __addr in $__addr; do
-			case "$__addr" in
-				*:/*) __list="${__list:+$__list }${__addr%/*}1/${__addr##*/}" ;;
-				*)    __list="${__list:+$__list }${__addr}"                   ;;
-			esac
+			__list="${__list:+$__list }${__addr}"
 		done
+	fi
+
+	if __network_ifstatus "__addr" "$2" "['ipv6-prefix-assignment'][*]['local-address'].address" && \
+	   __network_ifstatus "__mask" "$2" "['ipv6-prefix-assignment'][*].mask"; then
+		for __addr in $__addr; do
+			__list="${__list:+$__list }${__addr}/${__mask%% *}"
+			__mask="${__mask#* }"
+		done
+	fi
 
+	if [ -n "$__list" ]; then
 		export "$1=$__list"
 		return 0
 	fi

+ 21 - 1
package/base-files/files/lib/functions/uci-defaults.sh

@@ -35,7 +35,7 @@ _ucidef_set_interface() {
 	json_select_object "$name"
 	json_add_string ifname "$iface"
 
-	if ! json_is_a protocol string; then
+	if ! json_is_a protocol string || [ -n "$proto" ]; then
 		case "$proto" in
 			static|dhcp|none|pppoe) : ;;
 			*)
@@ -619,6 +619,26 @@ ucidef_add_gpio_switch() {
 	json_select ..
 }
 
+ucidef_set_hostname() {
+	local hostname="$1"
+
+	json_select_object system
+		json_add_string hostname "$hostname"
+	json_select ..
+}
+
+ucidef_set_ntpserver() {
+	local server
+
+	json_select_object system
+		json_select_array ntpserver
+			for server in "$@"; do
+				json_add_string "" "$server"
+			done
+		json_select ..
+	json_select ..
+}
+
 board_config_update() {
 	json_init
 	[ -f ${CFG} ] && json_load "$(cat ${CFG})"

+ 4 - 1
package/base-files/files/lib/preinit/10_indicate_preinit

@@ -96,6 +96,8 @@ preinit_config_board() {
 }
 
 preinit_ip() {
+	[ "$pi_preinit_no_failsafe" = "y" ] && return
+
 	# if the preinit interface isn't specified and ifname is set in
 	# preinit.arch use that interface
 	if [ -z "$pi_ifname" ]; then
@@ -107,6 +109,8 @@ preinit_ip() {
 	elif [ -d "/etc/board.d/" ]; then
 		preinit_config_board
 	fi
+
+	preinit_net_echo "Doing Lede Preinit\n"
 }
 
 preinit_ip_deconfig() {
@@ -146,7 +150,6 @@ preinit_echo() {
 }
 
 pi_indicate_preinit() {
-	preinit_net_echo "Doing Lede Preinit\n"
 	set_state preinit
 }
 

+ 1 - 1
package/base-files/files/usr/lib/os-release

@@ -1,7 +1,7 @@
 NAME="%D"
 VERSION="%V, %N"
 ID="%d"
-ID_LIKE="lede openwrt"
+ID_LIKE="librecmc openwrt"
 PRETTY_NAME="%D %N %V"
 VERSION_ID="%v"
 HOME_URL="%m"

+ 4 - 4
package/base-files/image-config.in

@@ -92,7 +92,7 @@ config TARGET_PREINIT_NETMASK
 config TARGET_PREINIT_BROADCAST
 	string
 	prompt "Broadcast address for preinit network messages" if PREINITOPT
-	default "192.168.1.255"
+	default "192.168.10.255"
 	help
 		Broadcast address to which to send preinit network messages, as
 		as failsafe messages
@@ -201,13 +201,13 @@ if VERSIONOPT
 			 %c .. Configured release revision code or value of %R, lowercase
 			 %N .. Release name, uppercase
 			 %n .. Release name, lowercase
-			 %D .. Distribution name or "Lede", uppercase
-			 %d .. Distribution name or "lede", lowercase
+			 %D .. Distribution name or "libreCMC", uppercase
+			 %d .. Distribution name or "librecmc", lowercase
 			 %T .. Target name
 			 %S .. Target/Subtarget name
 			 %A .. Package architecture
 			 %t .. Build taint flags, e.g. "no-all busybox"
-			 %M .. Manufacturer name or "Lede"
+			 %M .. Manufacturer name or "libreCMC"
 			 %P .. Product name or "Generic"
 			 %h .. Hardware revision or "v0"
 

+ 7 - 7
package/kernel/linux/modules/crypto.mk

@@ -436,7 +436,7 @@ endef
 
 define KernelPackage/crypto-md5/octeon
   FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-md5.ko
-  AUTOLOAD:=$(call AutoLoad,09,octeon-md5)
+  AUTOLOAD+=$(call AutoLoad,09,octeon-md5)
 endef
 
 $(eval $(call KernelPackage,crypto-md5))
@@ -468,12 +468,12 @@ endef
 
 define KernelPackage/crypto-sha1/octeon
   FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha1.ko
-  AUTOLOAD:=$(call AutoLoad,09,octeon-sha1)
+  AUTOLOAD+=$(call AutoLoad,09,octeon-sha1)
 endef
 
 define KernelPackage/crypto-sha1/x86/64
   FILES+=$(LINUX_DIR)/arch/x86/crypto/sha1-ssse3.ko
-  AUTOLOAD:=$(call AutoLoad,09,sha1-ssse3)
+  AUTOLOAD+=$(call AutoLoad,09,sha1-ssse3)
 endef
 
 $(eval $(call KernelPackage,crypto-sha1))
@@ -493,12 +493,12 @@ endef
 
 define KernelPackage/crypto-sha256/octeon
   FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha256.ko
-  AUTOLOAD:=$(call AutoLoad,09,octeon-sha256)
+  AUTOLOAD+=$(call AutoLoad,09,octeon-sha256)
 endef
 
 define KernelPackage/crypto-sha256/x86/64
   FILES+=$(LINUX_DIR)/arch/x86/crypto/sha256-ssse3.ko
-  AUTOLOAD:=$(call AutoLoad,09,sha256-ssse3)
+  AUTOLOAD+=$(call AutoLoad,09,sha256-ssse3)
 endef
 
 $(eval $(call KernelPackage,crypto-sha256))
@@ -518,12 +518,12 @@ endef
 
 define KernelPackage/crypto-sha512/octeon
   FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha512.ko
-  AUTOLOAD:=$(call AutoLoad,09,octeon-sha512)
+  AUTOLOAD+=$(call AutoLoad,09,octeon-sha512)
 endef
 
 define KernelPackage/crypto-sha512/x86/64
   FILES+=$(LINUX_DIR)/arch/x86/crypto/sha512-ssse3.ko
-  AUTOLOAD:=$(call AutoLoad,09,sha512-ssse3)
+  AUTOLOAD+=$(call AutoLoad,09,sha512-ssse3)
 endef
 
 $(eval $(call KernelPackage,crypto-sha512))

+ 0 - 1
package/kernel/linux/modules/netdevices.mk

@@ -446,7 +446,6 @@ endef
 
 $(eval $(call KernelPackage,ne2k-pci))
 
-
 define KernelPackage/e1000
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Intel(R) PRO/1000 PCI cards kernel support

+ 2 - 2
package/kernel/linux/modules/netfilter.mk

@@ -360,8 +360,6 @@ define KernelPackage/nf-nathelper/description
  Default Netfilter (IPv4) Conntrack and NAT helpers
  Includes:
  - ftp
- - irc
- - tftp
 endef
 
 $(eval $(call KernelPackage,nf-nathelper))
@@ -381,11 +379,13 @@ define KernelPackage/nf-nathelper-extra/description
  Includes:
  - amanda
  - h323
+ - irc
  - mms
  - pptp
  - proto_gre
  - sip
  - snmp_basic
+ - tftp
  - broadcast
 endef
 

+ 1 - 1
package/kernel/linux/modules/sound.mk

@@ -67,7 +67,7 @@ define KernelPackage/sound-core/uml
   FILES:= \
 	$(LINUX_DIR)/sound/soundcore.ko \
 	$(LINUX_DIR)/arch/um/drivers/hostaudio.ko
-  AUTOLOAD:=$(call AutoLoad,30,soundcore hostaudio)
+  AUTOLOAD+=$(call AutoLoad,30,soundcore hostaudio)
 endef
 
 define KernelPackage/sound-core/description

+ 2 - 2
package/kernel/linux/modules/video.mk

@@ -47,7 +47,7 @@ define KernelPackage/backlight-pwm
 	AUTOLOAD:=$(call AutoProbe,video pwm_bl)
 endef
 
-define KernelPackage/backlight/backlight-pwm
+define KernelPackage/backlight-pwm/description
 	Kernel module for PWM based Backlight support.
 endef
 
@@ -72,7 +72,7 @@ endef
 
 define KernelPackage/fb/x86
   FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko
-  AUTOLOAD:=$(call AutoLoad,06,fbdev fb)
+  AUTOLOAD+=$(call AutoLoad,06,fbdev fb)
 endef
 
 $(eval $(call KernelPackage,fb))

+ 6 - 4
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

@@ -268,7 +268,7 @@ mac80211_hostapd_setup_base() {
 			vht_max_mpdu_hw=11454
 		[ "$vht_max_mpdu_hw" != 3895 ] && \
 			vht_capab="$vht_capab[MAX-MPDU-$vht_max_mpdu_hw]"
-			
+
 		# maximum A-MPDU length exponent
 		vht_max_a_mpdu_len_exp_hw=0
 		[ "$(($vht_cap & 58720256))" -ge 8388608 -a 1 -le "$vht_max_a_mpdu_len_exp" ] && \
@@ -566,7 +566,7 @@ mac80211_setup_adhoc() {
 	[ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
 
 	iw dev "$ifname" ibss join "$ssid" $freq $ibss_htmode fixed-freq $bssid \
-		${beacon_int:+beacon-interval $beacon_int} \
+		beacon-interval $beacon_int \
 		${brstr:+basic-rates $brstr} \
 		${mcval:+mcast-rate $mcval} \
 		${keyspec:+keys $keyspec}
@@ -646,7 +646,9 @@ mac80211_setup_vif() {
 				esac
 
 				freq="$(get_freq "$phy" "$channel")"
-				iw dev "$ifname" mesh join "$mesh_id" freq $freq $mesh_htmode ${mcval:+mcast-rate $mcval}
+				iw dev "$ifname" mesh join "$mesh_id" freq $freq $mesh_htmode \
+					${mcval:+mcast-rate $mcval} \
+					beacon-interval $beacon_int
 			fi
 
 			for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
@@ -698,7 +700,7 @@ drv_mac80211_setup() {
 		country chanbw distance \
 		txpower antenna_gain \
 		rxantenna txantenna \
-		frag rts beacon_int htmode
+		frag rts beacon_int:100 htmode
 	json_get_values basic_rate_list basic_rate
 	json_select ..
 

+ 3 - 3
package/kernel/mac80211/files/lib/wifi/mac80211.sh

@@ -92,7 +92,7 @@ detect_mac80211() {
 			htmode="VHT80"
 		}
 
-		[ -n $htmode ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
+		[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
 
 		if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then
 			path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
@@ -123,8 +123,8 @@ detect_mac80211() {
 			set wireless.default_radio${devidx}.network=lan
 			set wireless.default_radio${devidx}.mode=ap
 			set wireless.default_radio${devidx}.ssid=libreCMC
-			set wireless.default_radio${devidx}.encryption=psk
-			set wireless.default_radio${devidx}.key=librecmc
+                        set wireless.default_radio${devidx}.encryption=psk
+                        set wireless.default_radio${devidx}.key=librecmc
 EOF
 		uci -q commit wireless
 

+ 0 - 10
package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch

@@ -1,10 +0,0 @@
---- a/drivers/net/wireless/marvell/mwl8k.c
-+++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -5681,6 +5681,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
- MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
- 
- static const struct pci_device_id mwl8k_pci_id_table[] = {
-+	{ PCI_VDEVICE(MARVELL, 0x2a02), .driver_data = MWL8363, },
- 	{ PCI_VDEVICE(MARVELL, 0x2a0a), .driver_data = MWL8363, },
- 	{ PCI_VDEVICE(MARVELL, 0x2a0c), .driver_data = MWL8363, },
- 	{ PCI_VDEVICE(MARVELL, 0x2a24), .driver_data = MWL8363, },

+ 0 - 20
package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch

@@ -1,20 +0,0 @@
---- a/drivers/net/wireless/marvell/mwl8k.c
-+++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -6264,6 +6264,8 @@ static int mwl8k_probe(struct pci_dev *p
- 
- 	priv->running_bsses = 0;
- 
-+	wait_for_completion(&priv->firmware_loading_complete);
-+
- 	return rc;
- 
- err_stop_firmware:
-@@ -6297,8 +6299,6 @@ static void mwl8k_remove(struct pci_dev
- 		return;
- 	priv = hw->priv;
- 
--	wait_for_completion(&priv->firmware_loading_complete);
--
- 	if (priv->fw_state == FW_STATE_ERROR) {
- 		mwl8k_hw_reset(priv);
- 		goto unmap;

+ 3 - 3
package/libs/mbedtls/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mbedtls
-PKG_VERSION:=2.5.1
-PKG_RELEASE:=2
+PKG_VERSION:=2.6.0
+PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz
 PKG_SOURCE_URL:=https://tls.mbed.org/download/
-PKG_HASH:=312f020006f0d8e9ede3ed8e73d907a629baf6475229703941769372ab0adee2
+PKG_HASH:=a99959d7360def22f9108d2d487c9de384fe76c349697176b1f22370080d5810
 
 PKG_BUILD_PARALLEL:=1
 PKG_LICENSE:=GPL-2.0+

+ 27 - 27
package/libs/mbedtls/patches/200-config.patch

@@ -1,6 +1,6 @@
 --- a/include/mbedtls/config.h
 +++ b/include/mbedtls/config.h
-@@ -191,7 +191,7 @@
+@@ -220,7 +220,7 @@
   *
   * Uncomment to get errors on using deprecated functions.
   */
@@ -9,7 +9,7 @@
  
  /* \} name SECTION: System support */
  
-@@ -504,17 +504,17 @@
+@@ -539,17 +539,17 @@
   *
   * Comment macros to disable the curve and functions for it
   */
@@ -35,7 +35,7 @@
  #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
  
  /**
-@@ -539,8 +539,8 @@
+@@ -574,8 +574,8 @@
   * Requires: MBEDTLS_HMAC_DRBG_C
   *
   * Comment this macro to disable deterministic ECDSA.
@@ -45,7 +45,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
-@@ -586,7 +586,7 @@
+@@ -621,7 +621,7 @@
   *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
   */
@@ -54,7 +54,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
-@@ -605,8 +605,8 @@
+@@ -640,8 +640,8 @@
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
@@ -64,7 +64,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
-@@ -631,7 +631,7 @@
+@@ -666,7 +666,7 @@
   *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
   *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
   */
@@ -73,7 +73,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
-@@ -758,7 +758,7 @@
+@@ -793,7 +793,7 @@
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -82,7 +82,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
-@@ -782,7 +782,7 @@
+@@ -817,7 +817,7 @@
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
   */
@@ -91,7 +91,7 @@
  
  /**
   * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
-@@ -886,7 +886,7 @@
+@@ -921,7 +921,7 @@
   * This option is only useful if both MBEDTLS_SHA256_C and
   * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
   */
@@ -100,7 +100,7 @@
  
  /**
   * \def MBEDTLS_ENTROPY_NV_SEED
-@@ -980,14 +980,14 @@
+@@ -1015,14 +1015,14 @@
   * Uncomment this macro to disable the use of CRT in RSA.
   *
   */
@@ -117,7 +117,7 @@
  
  /**
   * \def MBEDTLS_SHA256_SMALLER
-@@ -1003,7 +1003,7 @@
+@@ -1038,7 +1038,7 @@
   *
   * Uncomment to enable the smaller implementation of SHA256.
   */
@@ -126,7 +126,7 @@
  
  /**
   * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
-@@ -1122,8 +1122,8 @@
+@@ -1157,8 +1157,8 @@
   * misuse/misunderstand.
   *
   * Comment this to disable support for renegotiation.
@@ -136,7 +136,7 @@
  
  /**
   * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
-@@ -1297,8 +1297,8 @@
+@@ -1332,8 +1332,8 @@
   * callbacks are provided by MBEDTLS_SSL_TICKET_C.
   *
   * Comment this macro to disable support for SSL session tickets
@@ -146,7 +146,7 @@
  
  /**
   * \def MBEDTLS_SSL_EXPORT_KEYS
-@@ -1328,7 +1328,7 @@
+@@ -1363,7 +1363,7 @@
   *
   * Comment this macro to disable support for truncated HMAC in SSL
   */
@@ -155,7 +155,7 @@
  
  /**
   * \def MBEDTLS_THREADING_ALT
-@@ -1362,8 +1362,8 @@
+@@ -1397,8 +1397,8 @@
   * Requires: MBEDTLS_VERSION_C
   *
   * Comment this to disable run-time checking and save ROM space
@@ -165,7 +165,7 @@
  
  /**
   * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
-@@ -1684,7 +1684,7 @@
+@@ -1719,7 +1719,7 @@
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
   *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
   */
@@ -174,7 +174,7 @@
  
  /**
   * \def MBEDTLS_CCM_C
-@@ -1698,7 +1698,7 @@
+@@ -1733,7 +1733,7 @@
   * This module enables the AES-CCM ciphersuites, if other requisites are
   * enabled as well.
   */
@@ -183,7 +183,7 @@
  
  /**
   * \def MBEDTLS_CERTS_C
-@@ -1710,7 +1710,7 @@
+@@ -1745,7 +1745,7 @@
   *
   * This module is used for testing (ssl_client/server).
   */
@@ -192,7 +192,7 @@
  
  /**
   * \def MBEDTLS_CIPHER_C
-@@ -1763,7 +1763,7 @@
+@@ -1798,7 +1798,7 @@
   *
   * This module provides debugging functions.
   */
@@ -201,7 +201,7 @@
  
  /**
   * \def MBEDTLS_DES_C
-@@ -1788,8 +1788,8 @@
+@@ -1823,8 +1823,8 @@
   *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
   *
   * PEM_PARSE uses DES/3DES for decrypting encrypted keys.
@@ -211,7 +211,7 @@
  
  /**
   * \def MBEDTLS_DHM_C
-@@ -1943,8 +1943,8 @@
+@@ -1978,8 +1978,8 @@
   * Requires: MBEDTLS_MD_C
   *
   * Uncomment to enable the HMAC_DRBG random number geerator.
@@ -221,7 +221,7 @@
  
  /**
   * \def MBEDTLS_MD_C
-@@ -2221,7 +2221,7 @@
+@@ -2256,7 +2256,7 @@
   * Caller:  library/md.c
   *
   */
@@ -230,7 +230,7 @@
  
  /**
   * \def MBEDTLS_RSA_C
-@@ -2299,8 +2299,8 @@
+@@ -2334,8 +2334,8 @@
   * Caller:
   *
   * Requires: MBEDTLS_SSL_CACHE_C
@@ -240,7 +240,7 @@
  
  /**
   * \def MBEDTLS_SSL_COOKIE_C
-@@ -2321,8 +2321,8 @@
+@@ -2356,8 +2356,8 @@
   * Caller:
   *
   * Requires: MBEDTLS_CIPHER_C
@@ -250,7 +250,7 @@
  
  /**
   * \def MBEDTLS_SSL_CLI_C
-@@ -2421,8 +2421,8 @@
+@@ -2456,8 +2456,8 @@
   * Module:  library/version.c
   *
   * This module provides run-time version information.
@@ -260,7 +260,7 @@
  
  /**
   * \def MBEDTLS_X509_USE_C
-@@ -2532,7 +2532,7 @@
+@@ -2567,7 +2567,7 @@
   * Module:  library/xtea.c
   * Caller:
   */
@@ -269,7 +269,7 @@
  
  /* \} name SECTION: mbed TLS modules */
  
-@@ -2646,7 +2646,7 @@
+@@ -2681,7 +2681,7 @@
   * recommended because of it is possible to generte SHA-1 collisions, however
   * this may be safe for legacy infrastructure where additional controls apply.
   */

+ 1 - 1
package/network/config/gre/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gre
 PKG_VERSION:=1
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk

+ 1 - 1
package/network/config/gre/files/gre.sh

@@ -25,7 +25,7 @@ gre_generic_setup() {
 	json_add_string mode "$mode"
 	json_add_int mtu "${mtu:-1280}"
 	[ -n "$df" ] && json_add_boolean df "$df"
-	[ -n "ttl" ] && json_add_int ttl "$ttl"
+	[ -n "$ttl" ] && json_add_int ttl "$ttl"
 	[ -n "$tos" ] && json_add_string tos "$tos"
 	json_add_boolean multicast "$multicast"
 	json_add_string local "$local"

+ 3 - 13
package/network/services/dnsmasq/Makefile

@@ -37,7 +37,6 @@ define Package/dnsmasq/Default
   CATEGORY:=Base system
   TITLE:=DNS and DHCP server
   URL:=http://www.thekelleys.org.uk/dnsmasq/
-  DEPENDS:=+libubus
   USERID:=dnsmasq=453:dnsmasq=453
 endef
 
@@ -49,14 +48,14 @@ endef
 define Package/dnsmasq-dhcpv6
 $(call Package/dnsmasq/Default)
   TITLE += (with DHCPv6 support)
-  DEPENDS+=@IPV6
+  DEPENDS:=@IPV6
   VARIANT:=dhcpv6
 endef
 
 define Package/dnsmasq-full
 $(call Package/dnsmasq/Default)
   TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset, Conntrack, NO_ID enabled by default)
-  DEPENDS+=+PACKAGE_dnsmasq_full_dnssec:libnettle \
+  DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
 	+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset \
 	+PACKAGE_dnsmasq_full_conntrack:libnetfilter-conntrack
   VARIANT:=full
@@ -138,7 +137,7 @@ endif
 
 MAKE_FLAGS := \
 	$(TARGET_CONFIGURE_OPTS) \
-	CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+	CFLAGS="$(TARGET_CFLAGS)" \
 	LDFLAGS="$(TARGET_LDFLAGS)" \
 	COPTS="$(COPTS)" \
 	PREFIX="/usr"
@@ -151,17 +150,8 @@ define Package/dnsmasq/install
 	$(INSTALL_DATA) ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf
 	$(INSTALL_DIR) $(1)/etc/init.d
 	$(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/neigh
 	$(INSTALL_DIR) $(1)/etc/hotplug.d/ntp
-	$(INSTALL_DIR) $(1)/etc/hotplug.d/tftp
 	$(INSTALL_DATA) ./files/dnsmasqsec.hotplug $(1)/etc/hotplug.d/ntp/25-dnsmasqsec
-	$(INSTALL_DIR) $(1)/usr/share/dnsmasq
-	$(INSTALL_DATA) ./files/rfc6761.conf $(1)/usr/share/dnsmasq/
-	$(INSTALL_DIR) $(1)/usr/lib/dnsmasq
-	$(INSTALL_BIN) ./files/dhcp-script.sh $(1)/usr/lib/dnsmasq/dhcp-script.sh
-	$(INSTALL_DIR) $(1)/usr/share/acl.d
-	$(INSTALL_DATA) ./files/dnsmasq_acl.json $(1)/usr/share/acl.d/
 endef
 
 Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)

+ 0 - 46
package/network/services/dnsmasq/files/dhcp-script.sh

@@ -1,46 +0,0 @@
-#!/bin/sh
-
-[ -f "$USER_DHCPSCRIPT" ] && . "$USER_DHCPSCRIPT" "$@"
-
-case "$1" in
-	add)
-		export ACTION="add"
-		export MACADDR="$2"
-		export IPADDR="$3"
-		export HOSTNAME="$4"
-		exec /sbin/hotplug-call dhcp
-	;;
-	del)
-		export ACTION="remove"
-		export MACADDR="$2"
-		export IPADDR="$3"
-		export HOSTNAME="$4"
-		exec /sbin/hotplug-call dhcp
-	;;
-	old)
-		export ACTION="update"
-		export MACADDR="$2"
-		export IPADDR="$3"
-		export HOSTNAME="$4"
-		exec /sbin/hotplug-call dhcp
-	;;
-	arp-add)
-		export ACTION="add"
-		export MACADDR="$2"
-		export IPADDR="$3"
-		exec /sbin/hotplug-call neigh
-	;;
-	arp-del)
-		export ACTION="remove"
-		export MACADDR="$2"
-		export IPADDR="$3"
-		exec /sbin/hotplug-call neigh
-	;;
-	tftp)
-		export ACTION="add"
-		export TFTP_SIZE="$2"
-		export TFTP_ADDR="$3"
-		export TFTP_PATH="$4"
-		exec /sbin/hotplug-call tftp
-	;;
-esac

+ 1 - 1
package/network/services/dnsmasq/files/dhcp.conf

@@ -15,7 +15,7 @@ config dnsmasq
 	option leasefile	'/tmp/dhcp.leases'
 	option resolvfile	'/tmp/resolv.conf.auto'
 	#list server		'/mycompany.local/1.2.3.4'
-	option nonwildcard	1 # bind to & keep track of interfaces
+	#option nonwildcard	1
 	#list interface		br-lan
 	#list notinterface	lo
 	#list bogusnxdomain     '64.94.110.11'

+ 67 - 304
package/network/services/dnsmasq/files/dnsmasq.init

@@ -8,8 +8,6 @@ PROG=/usr/sbin/dnsmasq
 
 ADD_LOCAL_DOMAIN=1
 ADD_LOCAL_HOSTNAME=1
-ADD_WAN_FQDN=0
-ADD_LOCAL_FQDN=""
 
 BASECONFIGFILE="/var/etc/dnsmasq.conf"
 BASEHOSTFILE="/tmp/hosts/dhcp"
@@ -17,10 +15,6 @@ BASETIMESTAMPFILE="/etc/dnsmasq.time"
 TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf"
 TIMEVALIDFILE="/var/state/dnsmasqsec"
 BASEDHCPSTAMPFILE="/var/run/dnsmasq"
-RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf"
-DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh"
-
-DNSMASQ_DHCP_VER=4
 
 xappend() {
 	local value="$1"
@@ -89,24 +83,12 @@ log_once() {
 		logger -t dnsmasq "$@"
 }
 
-has_handler() {
-	local file
-
-	for file in /etc/hotplug.d/dhcp/* /etc/hotplug.d/tftp/* /etc/hotplug.d/neigh/*; do
-		[ -f "$file" ] && return 0
-	done
-
-	return 1
-}
-
 append_bool() {
 	local section="$1"
 	local option="$2"
 	local value="$3"
-	local default="$4"
 	local _loctmp
-	[ -z "$default" ] && default="0"
-	config_get_bool _loctmp "$section" "$option" "$default"
+	config_get_bool _loctmp "$section" "$option" 0
 	[ $_loctmp -gt 0 ] && xappend "$value"
 }
 
@@ -125,10 +107,6 @@ append_server() {
 	xappend "--server=$1"
 }
 
-append_rev_server() {
-        xappend "--rev-server=$1"
-}
-
 append_address() {
 	xappend "--address=$1"
 }
@@ -138,12 +116,12 @@ append_ipset() {
 }
 
 append_interface() {
-	network_get_device ifname "$1" || ifname="$1"
+	network_get_device ifname "$1" || return
 	xappend "--interface=$ifname"
 }
 
 append_notinterface() {
-	network_get_device ifname "$1" || ifname="$1"
+	network_get_device ifname "$1" || return
 	xappend "--except-interface=$ifname"
 }
 
@@ -159,10 +137,6 @@ append_pxe_service() {
 	xappend "--pxe-service=$1"
 }
 
-append_interface_name() {
-	xappend "--interface-name=$1,$2"
-}
-
 filter_dnsmasq() {
 	local cfg="$1" func="$2" match_cfg="$3" found_cfg
 
@@ -206,7 +180,6 @@ dhcp_remoteid_add() {
 }
 
 dhcp_circuitid_add() {
-	# TODO: DHCPV6 does not have circuitid; catch "option6:"
 	local cfg="$1"
 
 	config_get networkid "$cfg" networkid
@@ -239,7 +212,6 @@ dhcp_userclass_add() {
 }
 
 dhcp_vendorclass_add() {
-	# TODO: DHCPV6 vendor class has stricter definitions; catch? fixup?
 	local cfg="$1"
 
 	config_get networkid "$cfg" networkid
@@ -273,7 +245,6 @@ dhcp_match_add() {
 
 dhcp_host_add() {
 	local cfg="$1"
-	local hosttag nametime addrs duids
 
 	config_get_bool force "$cfg" force 0
 
@@ -285,9 +256,7 @@ dhcp_host_add() {
 
 	config_get name "$cfg" name
 	config_get ip "$cfg" ip
-	config_get hostid "$cfg" hostid
-
-	[ -n "$ip" -o -n "$name" -o -n "$hostid" ] || return 0
+	[ -n "$ip" -o -n "$name" ] || return 0
 
 	config_get_bool dns "$cfg" dns 0
 	[ "$dns" = "1" -a -n "$ip" -a -n "$name" ] && {
@@ -295,105 +264,36 @@ dhcp_host_add() {
 	}
 
 	config_get mac "$cfg" mac
-	config_get duid "$cfg" duid
-	config_get tag "$cfg" tag
-
 	if [ -n "$mac" ]; then
 		# --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap
-		# many MAC are possible to track a laptop ON/OFF dock
 		macs=""
 		for m in $mac; do append macs "$m" ","; done
-	fi
-
-	if [ $DNSMASQ_DHCP_VER -eq 6 -a -n "$duid" ]; then
-		# --dhcp-host=id:00:03:00:01:12:00:00:01:02:03,[::beef],lap
-		# one (virtual) machine gets one DUID per RFC3315
-		duids="id:${duid// */}"
-	fi
-
-	if [ -z "$macs" -a -z "$duids" ]; then
-		# --dhcp-host=lap,192.168.0.199,[::beef]
+	else
+		# --dhcp-host=lap,192.168.0.199
 		[ -n "$name" ] || return 0
 		macs="$name"
 		name=""
 	fi
 
-	if [ -n "$hostid" ]; then
-		hex_to_hostid hostid "$hostid"
-	fi
+	config_get tag "$cfg" tag
 
-	tags=""
-	if [ -n "$tag" ]; then
-		for t in $tag; do append tags "$t" ",set:"; done
+	if [ "$DHCPv6CAPABLE" -eq 1 ]; then
+		config_get duid "$cfg" duid
+		config_get hostid "$cfg" hostid
+		if [ -n "$hostid" ]; then
+			hex_to_hostid hostid "$hostid"
+		fi
 	fi
 
 	config_get_bool broadcast "$cfg" broadcast 0
-	config_get leasetime "$cfg" leasetime
-
-	[ "$broadcast" = "0" ] && broadcast= || broadcast=",set:needs-broadcast"
+	[ "$broadcast" = "0" ] && broadcast=
 
-	hosttag="${networkid:+,set:${networkid}}${tags:+,set:${tags}}$broadcast"
-	nametime="${name:+,$name}${leasetime:+,$leasetime}"
-
-	if [ $DNSMASQ_DHCP_VER -eq 6 ]; then
-		addrs="${ip:+,$ip}${hostid:+,[::$hostid]}"
-		xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime"
-	else
-		xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime"
-	fi
-}
-
-dhcp_this_host_add() {
-	local net="$1"
-	local ifname="$2"
-	local mode="$3"
-	local routerstub routername ifdashname
-	local lanaddr lanaddr6 lanaddrs6 ulaprefix
-
-	if [ "$mode" -gt 0 ] ; then
-		ifdashname="${ifname//./-}"
-		routerstub="$( md5sum /etc/os-release )"
-		routerstub="router-${routerstub// */}"
-		routername="$( uci_get system @system[0] hostname $routerstub )"
-
-		if [ "$mode" -gt 1 ] ; then
-			if [ "$mode" -gt 2 ] ; then
-				if [ "$mode" -gt 3 ] ; then
-					append_interface_name "$ifdashname.$routername.$DOMAIN" "$ifname"
-				fi
-
-				append_interface_name "$routername.$DOMAIN" "$ifname"
-			fi
-
-			# All IP addresses discovered by dnsmasq will be labeled (except fe80::)
-			append_interface_name "$routername" "$ifname"
-
-		else
-			# This uses a static host file entry for only limited addresses.
-			# Use dnsmasq option "--expandhosts" to enable FQDN on host files.
-			ulaprefix="$(uci_get network @globals[0] ula_prefix)"
-			network_get_ipaddr lanaddr "$net"
-			network_get_ipaddrs6 lanaddrs6 "$net"
-
-			if [ -n "$lanaddr" ] ; then
-				dhcp_domain_add "" "$routername" "$lanaddr"
-			fi
+	config_get leasetime "$cfg" leasetime
 
-			if [ -n "$ulaprefix" -a -n "$lanaddrs6" ] ; then
-				for lanaddr6 in $lanaddrs6 ; do
-					case "$lanaddr6" in
-					"${ulaprefix%%:/*}"*)
-						dhcp_domain_add "" "$routername" "$lanaddr6"
-						;;
-					esac
-				done
-			fi
-		fi
-	fi
+	xappend "--dhcp-host=$macs${duid:+,id:$duid}${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip${hostid:+,[::$hostid]}}${name:+,$name}${leasetime:+,$leasetime}"
 }
 
 dhcp_tag_add() {
-	# NOTE: dnsmasq has explicit "option6:" prefix for DHCPv6 so no collisions
 	local cfg="$1"
 
 	tag="$cfg"
@@ -424,7 +324,6 @@ dhcp_mac_add() {
 }
 
 dhcp_boot_add() {
-	# TODO: BOOTURL is different between DHCPv4 and DHCPv6
 	local cfg="$1"
 
 	config_get networkid "$cfg" networkid
@@ -447,30 +346,24 @@ dhcp_boot_add() {
 
 dhcp_add() {
 	local cfg="$1"
-	local dhcp6range="::"
-	local nettag
-	local tags
-
 	config_get net "$cfg" interface
 	[ -n "$net" ] || return 0
 
+	config_get dhcpv4 "$cfg" dhcpv4
+	[ "$dhcpv4" != "disabled" ] || return 0
+
 	config_get networkid "$cfg" networkid
 	[ -n "$networkid" ] || networkid="$net"
 
+	network_get_subnet subnet "$net" || return 0
 	network_get_device ifname "$net" || return 0
+	network_get_protocol proto "$net" || return 0
 
 	[ "$cachelocal" = "0" ] && network_get_dnsserver dnsserver "$net" && {
 		DNS_SERVERS="$DNS_SERVERS $dnsserver"
 	}
 
-	append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && {
-		# Many ISP do not have useful names for DHCP customers (your WAN).
-		dhcp_this_host_add "$net" "$ifname" "$ADD_WAN_FQDN"
-		return 0
-	}
-
-	network_get_subnet subnet "$net" || return 0
-	network_get_protocol proto "$net" || return 0
+	append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && return 0
 
 	# Do not support non-static interfaces for now
 	[ static = "$proto" ] || return 0
@@ -482,107 +375,21 @@ dhcp_add() {
 	config_get_bool force "$cfg" force 0
 	[ $force -gt 0 ] || dhcp_check "$ifname" || return 0
 
-	config_get start "$cfg" start 100
-	config_get limit "$cfg" limit 150
-	config_get leasetime "$cfg" leasetime 12h
+	config_get start "$cfg" start
+	config_get limit "$cfg" limit
+	config_get leasetime "$cfg" leasetime
 	config_get options "$cfg" options
 	config_get_bool dynamicdhcp "$cfg" dynamicdhcp 1
 
-	config_get dhcpv4 "$cfg" dhcpv4
-	config_get dhcpv6 "$cfg" dhcpv6
-
-	config_get ra "$cfg" ra
-	config_get ra_management "$cfg" ra_management
-	config_get ra_preference "$cfg" ra_preference
-	config_get dns "$cfg" dns
-
-	config_list_foreach "$cfg" "interface_name" append_interface_name "$ifname"
-
-	# Put the router host name on this DHCP served interface address(es)
-	dhcp_this_host_add "$net" "$ifname" "$ADD_LOCAL_FQDN"
-
-	start="$( dhcp_calc "$start" )"
-
-	add_tag() {
-		tags="${tags}tag:$1,"
-	}
-	config_list_foreach "$cfg" tag add_tag
-
-	nettag="${networkid:+set:${networkid},}"
-
-	if [ "$limit" -gt 0 ] ; then
-		limit=$((limit-1))
-	fi
-
+	leasetime="${leasetime:-12h}"
+	start="$(dhcp_calc "${start:-100}")"
+	limit="${limit:-150}"
+	[ "$limit" -gt 0 ] && limit=$((limit-1))
 	eval "$(ipcalc.sh "${subnet%%/*}" $netmask $start $limit)"
+	if [ "$dynamicdhcp" = "0" ]; then END="static"; fi
+	xappend "--dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+ $options}"
 
-	if [ "$dynamicdhcp" = "0" ] ; then
-		END="static"
-		dhcp6range="::,static"
-	else
-		dhcp6range="::1000,::ffff"
-	fi
-
-
-	if [ "$dhcpv4" != "disabled" ] ; then
-		xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
-	fi
-
-
-	if [ $DNSMASQ_DHCP_VER -eq 6 -a "$ra" = "server" ] ; then
-		# Note: dnsmasq cannot just be a DHCPv6 server (all-in-1)
-		# and let some other machine(s) send RA pointing to it.
-
-		case $ra_preference in
-		*high*)
-			xappend "--ra-param=$ifname,high,0,7200"
-			;;
-		*low*)
-			xappend "--ra-param=$ifname,low,0,7200"
-			;;
-		*)
-			# Send UNSOLICITED RA at default interval and live for 2 hours.
-			# TODO: convert flexible lease time into route life time (only seconds).
-			xappend "--ra-param=$ifname,0,7200"
-			;;
-		esac
-
-		if [ "$dhcpv6" = "disabled" ] ; then
-			ra_management="3"
-		fi
-
-
-		case $ra_management in
-		0)
-			# SLACC with DCHP for extended options
-			xappend "--dhcp-range=$nettag::,constructor:$ifname,ra-stateless,ra-names"
-			;;
-		2)
-			# DHCP address and RA only for management redirection
-			xappend "--dhcp-range=$nettag$dhcp6range,constructor:$ifname,$leasetime"
-			;;
-		3)
-			# SLAAC only but dnsmasq attempts to link HOSTNAME, DHCPv4 MAC, and SLAAC
-			xappend "--dhcp-range=$nettag::,constructor:$ifname,ra-only,ra-names"
-			;;
-		*)
-			# SLAAC and full DHCP
-			xappend "--dhcp-range=$nettag$dhcp6range,constructor:$ifname,slaac,ra-names,$leasetime"
-			;;
-		esac
-
-		if [ -n "$dns" ]; then
-			dnss=""
-			for d in $dns; do append dnss "[$d]" ","; done
-		else
-			dnss="[::]"
-		fi
-
-		dhcp_option_append "option6:dns-server,$dnss" "$networkid"
-	fi
-
-	dhcp_option_add "$cfg" "$networkid" 0
-	dhcp_option_add "$cfg" "$networkid" 2
+	dhcp_option_add "$cfg" "$networkid"
 }
 
 dhcp_option_append() {
@@ -594,24 +401,21 @@ dhcp_option_append() {
 }
 
 dhcp_option_add() {
-	# NOTE: dnsmasq has explicit "option6:" prefix for DHCPv6 so no collisions
 	local cfg="$1"
 	local networkid="$2"
 	local force="$3"
-	local opt="dhcp_option"
 
 	[ "$force" = "0" ] && force=
-	[ "$force" = "2" ] && opt="dhcp_option_force"
 
 	local list_len
-	config_get list_len "$cfg" "${opt}_LENGTH"
+	config_get list_len "$cfg" dhcp_option_LENGTH
 
 	if [ -n "$list_len" ]; then
-		config_list_foreach "$cfg" "$opt" dhcp_option_append "$networkid" "$force"
+		config_list_foreach "$cfg" dhcp_option dhcp_option_append "$networkid" "$force"
 	else
-		config_get dhcp_option "$cfg" "$opt"
+		config_get dhcp_option "$cfg" dhcp_option
 
-		[ -n "$dhcp_option" ] && echo "Warning: the 'option $opt' syntax is deprecated, use 'list $opt'" >&2
+		[ -n "$dhcp_option" ] && echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
 
 		local option
 		for option in $dhcp_option; do
@@ -729,7 +533,7 @@ dhcp_relay_add() {
 
 dnsmasq_start()
 {
-	local cfg="$1" disabled resolvfile user_dhcpscript
+	local cfg="$1" disabled
 
 	config_get_bool disabled "$cfg" disabled 0
 	[ "$disabled" -gt 0 ] && return 0
@@ -762,41 +566,6 @@ dnsmasq_start()
 
 	$PROG --version | grep -osqE "^Compile time options:.* DHCPv6( |$)" && DHCPv6CAPABLE=1 || DHCPv6CAPABLE=0
 
-
-	if [ -x /usr/sbin/odhcpd -a -x /etc/init.d/odhcpd ] ; then
-		local odhcpd_is_main odhcpd_is_enabled
-		config_get odhcpd_is_main odhcpd maindhcp 0
-		/etc/init.d/odhcpd enabled && odhcpd_is_enabled=1 || odhcpd_is_enabled=0
-
-
-		if [ "$odhcpd_is_enabled" -eq 0 -a "$DHCPv6CAPABLE" -eq 1 ] ; then
-			# DHCP V4 and V6 in DNSMASQ
-			DNSMASQ_DHCP_VER=6
-		elif [ "$odhcpd_is_main" -gt 0 ] ; then
-			# ODHCPD is doing it all
-			DNSMASQ_DHCP_VER=0
-		else
-			# You have ODHCPD but use DNSMASQ for DHCPV4
-			DNSMASQ_DHCP_VER=4
-		fi
-
-	elif [ "$DHCPv6CAPABLE" -eq 1 ] ; then
-		# DHCP V4 and V6 in DNSMASQ
-		DNSMASQ_DHCP_VER=6
-	else
-		DNSMASQ_DHCP_VER=4
-	fi
-
-	# Allow DHCP/DHCPv6 to be handled by ISC DHCPD
-	if [ -x /usr/sbin/dhcpd ] ; then
-		if [ -x /etc/init.d/dhcpd ] ; then
-			/etc/init.d/dhcpd enabled && DNSMASQ_DHCP_VER=0
-		fi
-		if [ -x /etc/init.d/dhcpd6 -a "$DNSMASQ_DHCP_VER" -gt 0 ] ; then
-			/etc/init.d/dhcpd6 enabled && DNSMASQ_DHCP_VER=4
-		fi
-	fi
-
 	append_bool "$cfg" authoritative "--dhcp-authoritative"
 	append_bool "$cfg" nodaemon "--no-daemon"
 	append_bool "$cfg" domainneeded "--domain-needed"
@@ -809,11 +578,12 @@ dnsmasq_start()
 	append_bool "$cfg" localise_queries "--localise-queries"
 	append_bool "$cfg" readethers "--read-ethers"
 	append_bool "$cfg" dbus "--enable-dbus"
+	append_bool "$cfg" boguspriv "--bogus-priv"
 	append_bool "$cfg" expandhosts "--expand-hosts"
 	config_get tftp_root "$cfg" "tftp_root"
 	[ -n "$tftp_root" ] && mkdir -p "$tftp_root" && append_bool "$cfg" enable_tftp "--enable-tftp"
 	append_bool "$cfg" tftp_no_fail "--tftp-no-fail"
-	append_bool "$cfg" nonwildcard "--bind-dynamic" 1
+	append_bool "$cfg" nonwildcard "--bind-dynamic"
 	append_bool "$cfg" fqdn "--dhcp-fqdn"
 	append_bool "$cfg" proxydnssec "--proxy-dnssec"
 	append_bool "$cfg" localservice "--local-service"
@@ -824,7 +594,7 @@ dnsmasq_start()
 	append_bool "$cfg" noping "--no-ping"
 
 	append_parm "$cfg" logfacility "--log-facility"
-
+	append_parm "$cfg" dhcpscript "--dhcp-script"
 	append_parm "$cfg" cachesize "--cache-size"
 	append_parm "$cfg" dnsforwardmax "--dns-forward-max"
 	append_parm "$cfg" port "--port"
@@ -836,7 +606,6 @@ dnsmasq_start()
 	append_parm "$cfg" "domain" "--domain"
 	append_parm "$cfg" "local" "--server"
 	config_list_foreach "$cfg" "server" append_server
-	config_list_foreach "$cfg" "rev_server" append_rev_server
 	config_list_foreach "$cfg" "address" append_address
 	config_list_foreach "$cfg" "ipset" append_ipset
 	config_list_foreach "$cfg" "interface" append_interface
@@ -844,6 +613,7 @@ dnsmasq_start()
 	config_list_foreach "$cfg" "addnhosts" append_addnhosts
 	config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain
 	append_parm "$cfg" "leasefile" "--dhcp-leasefile" "/tmp/dhcp.leases"
+	append_parm "$cfg" "resolvfile" "--resolv-file" "/tmp/resolv.conf.auto"
 	append_parm "$cfg" "serversfile" "--servers-file"
 	append_parm "$cfg" "tftp_root" "--tftp-root"
 	append_parm "$cfg" "dhcp_boot" "--dhcp-boot"
@@ -854,21 +624,12 @@ dnsmasq_start()
 
 	config_get_bool ADD_LOCAL_DOMAIN "$cfg" add_local_domain 1
 	config_get_bool ADD_LOCAL_HOSTNAME "$cfg" add_local_hostname 1
-	config_get ADD_LOCAL_FQDN "$cfg" add_local_fqdn ""
-	config_get ADD_WAN_FQDN "$cfg" add_wan_fqdn 0
-
-	if [ -z "$ADD_LOCAL_FQDN" ] ; then
-		# maintain support for previous UCI
-		ADD_LOCAL_FQDN="$ADD_LOCAL_HOSTNAME"
-	fi
 
 	config_get_bool readethers "$cfg" readethers
 	[ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers
 
-	config_get user_dhcpscript $cfg dhcpscript
-	if has_handler || [ -n "$user_dhcpscript" ]; then
-		xappend "--dhcp-script=$DHCPSCRIPT"
-	fi
+	config_get resolvfile $cfg resolvfile
+	config_get dhcpscript $cfg dhcpscript
 
 	config_get leasefile $cfg leasefile "/tmp/dhcp.leases"
 	[ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
@@ -881,8 +642,6 @@ dnsmasq_start()
 		[ -n "$resolvfile" -a \! -e "$resolvfile" ] && touch "$resolvfile"
 	fi
 
-	[ -n "$resolvfile" ] && xappend "--resolv-file=$resolvfile"
-
 	config_get hostsfile "$cfg" dhcphostsfile
 	[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
 
@@ -929,7 +688,6 @@ dnsmasq_start()
 	}
 
 	dhcp_option_add "$cfg" "" 0
-	dhcp_option_add "$cfg" "" 2
 
 	xappend "--dhcp-broadcast=tag:needs-broadcast"
 
@@ -963,31 +721,37 @@ dnsmasq_start()
 	config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg"
 	config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg"
 
+	# add own hostname
+	[ $ADD_LOCAL_HOSTNAME -eq 1 ] && {
+		local lanaddr lanaddr6
+		local ulaprefix="$(uci_get network @globals[0] ula_prefix)"
+		local hostname="$(uci_get system @system[0] hostname Lede)"
+
+		network_get_ipaddr lanaddr "lan" && {
+			dhcp_domain_add "" "$hostname" "$lanaddr"
+		}
+
+		[ -n "$ulaprefix" ] && network_get_ipaddrs6 lanaddr6 "lan" && {
+			for lanaddr6 in $lanaddr6; do
+				case "$lanaddr6" in
+					"${ulaprefix%%:/*}"*)
+						dhcp_domain_add "" "$hostname" "$lanaddr6"
+					;;
+				esac
+			done
+		}
+	}
+
 	echo >> $CONFIGFILE_TMP
 	config_foreach filter_dnsmasq srvhost dhcp_srv_add "$cfg"
 	config_foreach filter_dnsmasq mxhost dhcp_mx_add "$cfg"
 	echo >> $CONFIGFILE_TMP
 
-	config_get_bool boguspriv "$cfg" boguspriv 1
-	[ "$boguspriv" -gt 0 ] && {
-		xappend "--bogus-priv"
-		[ -r "$RFC6761FILE" ] && xappend "--conf-file=$RFC6761FILE"
-	}
-
-	if [ "$DNSMASQ_DHCP_VER" -gt 4 ] ; then
-		# Enable RA feature for when/if it is constructed,
-		# and RA is selected per interface pool (RA, DHCP, or both),
-		# but no one (should) want RA broadcast in syslog
-		config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
-		xappend "--enable-ra"
-		xappend "--quiet-ra"
-		append_bool "$cfg" quietdhcp "--quiet-dhcp6"
-
-	elif [ "$DNSMASQ_DHCP_VER" -gt 0 ] ; then
+	config_get odhcpd_is_active odhcpd maindhcp
+	if [ "$odhcpd_is_active" != "1" ]; then
 		config_foreach filter_dnsmasq dhcp dhcp_add "$cfg"
 	fi
 
-
 	echo >> $CONFIGFILE_TMP
 	config_foreach filter_dnsmasq cname dhcp_cname_add "$cfg"
 	echo >> $CONFIGFILE_TMP
@@ -1009,7 +773,6 @@ dnsmasq_start()
 	procd_open_instance $cfg
 	procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq."${cfg}".pid
 	procd_set_param file $CONFIGFILE
-	[ -n "$user_dhcpscript" ] && procd_set_param env USER_DHCPSCRIPT="$user_dhcpscript"
 	procd_set_param respawn
 
 	local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
@@ -1018,7 +781,7 @@ dnsmasq_start()
 	fi
 
 	procd_add_jail dnsmasq ubus log
-	procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE $RFC6761FILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvfile $user_dhcpscript /etc/hosts /etc/ethers /sbin/hotplug-call $EXTRA_MOUNT $DHCPSCRIPT
+	procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvfile $dhcpscript /etc/hosts /etc/ethers $EXTRA_MOUNT
 	procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
 
 	procd_close_instance

+ 0 - 4
package/network/services/dnsmasq/files/dnsmasq_acl.json

@@ -1,4 +0,0 @@
-{
-	"user": "dnsmasq",
-	"publish": [ "dnsmasq" ]
-}

+ 0 - 15
package/network/services/dnsmasq/files/rfc6761.conf

@@ -1,15 +0,0 @@
-# RFC6761 included configuration file for dnsmasq
-#
-# includes a list of domains that should not be forwarded to Internet name servers
-# to reduce burden on them, asking questions that they won't know the answer to.
-
-server=/bind/
-server=/example/
-server=/example.com/
-server=/example.org/
-server=/example.net/
-server=/invalid/
-server=/local/
-server=/localhost/
-server=/onion/
-server=/test/

+ 0 - 126
package/network/services/dnsmasq/patches/240-ubus.patch

@@ -1,126 +0,0 @@
---- a/src/dnsmasq.c
-+++ b/src/dnsmasq.c
-@@ -19,6 +19,8 @@
- 
- #include "dnsmasq.h"
- 
-+#include <libubus.h>
-+
- struct daemon *daemon;
- 
- static volatile pid_t pid = 0;
-@@ -32,6 +34,62 @@ static void fatal_event(struct event_des
- static int read_event(int fd, struct event_desc *evp, char **msg);
- static void poll_resolv(int force, int do_reload, time_t now);
- 
-+static struct ubus_context *ubus;
-+static struct blob_buf b;
-+
-+static struct ubus_object_type ubus_object_type = {
-+	.name = "dnsmasq",
-+};
-+
-+static struct ubus_object ubus_object = {
-+	.name = "dnsmasq",
-+	.type = &ubus_object_type,
-+};
-+
-+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name)
-+{
-+	if (!ubus || !ubus_object.has_subscribers)
-+		return;
-+
-+	blob_buf_init(&b, 0);
-+	if (mac)
-+		blobmsg_add_string(&b, "mac", mac);
-+	if (ip)
-+		blobmsg_add_string(&b, "ip", ip);
-+	if (name)
-+		blobmsg_add_string(&b, "name", name);
-+	ubus_notify(ubus, &ubus_object, type, b.head, -1);
-+}
-+
-+static void set_ubus_listeners(void)
-+{
-+	if (!ubus)
-+		return;
-+
-+	poll_listen(ubus->sock.fd, POLLIN);
-+	poll_listen(ubus->sock.fd, POLLERR);
-+	poll_listen(ubus->sock.fd, POLLHUP);
-+}
-+
-+static void check_ubus_listeners()
-+{
-+	if (!ubus) {
-+		ubus = ubus_connect(NULL);
-+		if (ubus)
-+			ubus_add_object(ubus, &ubus_object);
-+		else
-+			return;
-+	}
-+
-+	if (poll_check(ubus->sock.fd, POLLIN))
-+		ubus_handle_event(ubus);
-+
-+	if (poll_check(ubus->sock.fd, POLLHUP)) {
-+		ubus_free(ubus);
-+		ubus = NULL;
-+	}
-+}
-+
- int main (int argc, char **argv)
- {
-   int bind_fallback = 0;
-@@ -911,6 +969,7 @@ int main (int argc, char **argv)
-       set_dbus_listeners();
- #endif	
-   
-+      set_ubus_listeners();
- #ifdef HAVE_DHCP
-       if (daemon->dhcp || daemon->relay4)
- 	{
-@@ -1041,6 +1100,8 @@ int main (int argc, char **argv)
-       check_dbus_listeners();
- #endif
-       
-+      check_ubus_listeners();
-+
-       check_dns_listeners(now);
- 
- #ifdef HAVE_TFTP
---- a/Makefile
-+++ b/Makefile
-@@ -85,7 +85,7 @@ all : $(BUILDDIR)
- 	@cd $(BUILDDIR) && $(MAKE) \
-  top="$(top)" \
-  build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \
-- build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs)" \
-+ build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) -lubox -lubus" \
-  -f $(top)/Makefile dnsmasq 
- 
- mostly_clean :
---- a/src/dnsmasq.h
-+++ b/src/dnsmasq.h
-@@ -1397,6 +1397,8 @@ void emit_dbus_signal(int action, struct
- #  endif
- #endif
- 
-+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name);
-+
- /* ipset.c */
- #ifdef HAVE_IPSET
- void ipset_init(void);
---- a/src/rfc2131.c
-+++ b/src/rfc2131.c
-@@ -1621,6 +1621,10 @@ static void log_packet(char *type, void
- 	      daemon->namebuff,
- 	      string ? string : "",
- 	      err ? err : "");
-+  if (!strcmp(type, "DHCPACK"))
-+	  ubus_event_bcast("dhcp.ack", addr ? inet_ntoa(a) : NULL, daemon->namebuff, string ? string : NULL);
-+  else if (!strcmp(type, "DHCPRELEASE"))
-+	  ubus_event_bcast("dhcp.release", addr ? inet_ntoa(a) : NULL, daemon->namebuff, string ? string : NULL);
- }
- 
- static void log_options(unsigned char *start, u32 xid)

+ 1 - 1
package/network/services/hostapd/Makefile

@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git

+ 1 - 1
package/network/services/hostapd/files/hostapd.sh

@@ -620,7 +620,7 @@ wpa_supplicant_add_network() {
 		scan_ssid=""
 	}
 
-	[[ "$_w_mode" = "adhoc" -o "$_w_mode" = "mesh" ]] && append network_data "$_w_modestr" "$N$T"
+	[ "$_w_mode" = "adhoc" -o "$_w_mode" = "mesh" ] && append network_data "$_w_modestr" "$N$T"
 
 	case "$auth_type" in
 		none) ;;

+ 4 - 4
package/network/services/odhcpd/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=odhcpd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/odhcpd.git
-PKG_SOURCE_DATE:=2017-04-28
-PKG_SOURCE_VERSION:=9268ca65d6e000b6cd4ed72d4a8fa427dada6f06
-PKG_MIRROR_HASH:=3c375291de38034f0965c92e509ca17788d3b31fe13abbc8f541b2e2452bc7fe
+PKG_SOURCE_DATE:=2017-10-02
+PKG_SOURCE_VERSION:=c6f3d5d4ea5154e5971fa0b1b1e9a9c07119429f
+PKG_MIRROR_HASH:=5ce8f52b5c6acea27d9733918e9c3bc8a154d516a02eef9b172c5e3d459f494c
 
 PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
 PKG_LICENSE:=GPL-2.0

+ 17 - 2
package/network/services/odhcpd/files/odhcpd.defaults

@@ -2,12 +2,27 @@
 uci -q get dhcp.odhcpd && exit 0
 touch /etc/config/dhcp
 
+. /usr/share/libubox/jshn.sh
+
+json_load "$(cat /etc/board.json)"
+json_select network
+json_select lan
+json_get_vars protocol
+json_select ..
+json_select ..
+
+case "$protocol" in
+# only enable server mode on statically addressed lan ports
+"static") MODE=server ;;
+*) MODE=disabled ;;
+esac
+
 uci batch <<EOF
 set dhcp.odhcpd=odhcpd
 set dhcp.odhcpd.maindhcp=0
 set dhcp.odhcpd.leasefile=/tmp/hosts/odhcpd
 set dhcp.odhcpd.leasetrigger=/usr/sbin/odhcpd-update
-set dhcp.lan.dhcpv6=server
-set dhcp.lan.ra=server
+set dhcp.lan.dhcpv6=$MODE
+set dhcp.lan.ra=$MODE
 commit dhcp
 EOF

+ 5 - 4
package/network/services/openvpn/Makefile

@@ -9,14 +9,15 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openvpn
 
-PKG_VERSION:=2.4.4
-PKG_RELEASE:=1
+PKG_VERSION:=2.4.3
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=\
 	https://build.openvpn.net/downloads/releases/ \
-	https://swupdate.openvpn.net/community/releases/
+	https://swupdate.openvpn.net/community/releases/ \
+	http://www.eurephia.net/openvpn/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=96cd1b8fe1e8cb2920f07c3fd3985faea756e16fdeebd11d3e146d5bd2b04a80
+PKG_HASH:=7aa86167a5b8923e54e8795b814ed77288c793671f59fd830d9ab76d4b480571
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

+ 29 - 54
package/network/services/openvpn/patches/210-build_always_use_internal_lz4.patch

@@ -1,68 +1,43 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1068,62 +1068,15 @@ dnl
+@@ -1076,37 +1076,14 @@ dnl
  AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
  AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
  if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then
--    if test -z "${LZ4_CFLAGS}" -a -z "${LZ4_LIBS}"; then
--	# if the user did not explicitly specify flags, try to autodetect
--	PKG_CHECK_MODULES([LZ4],
--			  [liblz4 >= 1.7.1],
--			  [have_lz4="yes"],
--			  [] # If this fails, we will do another test next
--	)
--    fi
-
-     saved_CFLAGS="${CFLAGS}"
-     saved_LIBS="${LIBS}"
-     CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
-     LIBS="${LIBS} ${LZ4_LIBS}"
-
--    # If pkgconfig check failed or LZ4_CFLAGS/LZ4_LIBS env vars
--    # are used, check the version directly in the LZ4 include file
--    if test "${have_lz4}" != "yes"; then
--	AC_CHECK_HEADERS([lz4.h],
--			 [have_lz4h="yes"],
--			 [])
--
--	if test "${have_lz4h}" = "yes" ; then
--	    AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1])
--	    AC_COMPILE_IFELSE(
--		[AC_LANG_PROGRAM([[
--#include <lz4.h>
--				 ]],
--				 [[
--/* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */
--#if LZ4_VERSION_NUMBER < 10701L
--#error LZ4 is too old
--#endif
--				 ]]
--				)],
--		[
--		    AC_MSG_RESULT([ok])
--		    have_lz4="yes"
--		],
--		[AC_MSG_RESULT([system LZ4 library is too old])]
--	    )
--	fi
--    fi
--
+-    AC_CHECKING([for LZ4 Library and Header files])
+-    havelz4lib=1
+ 
 -    # if LZ4_LIBS is set, we assume it will work, otherwise test
 -    if test -z "${LZ4_LIBS}"; then
--	AC_CHECK_LIB([lz4],
--		     [LZ4_compress],
--		     [LZ4_LIBS="-llz4"],
--		     [have_lz4="no"])
+-	AC_CHECK_LIB(lz4, LZ4_compress,
+-	    [ LZ4_LIBS="-llz4" ],
+-	    [
+-	        AC_MSG_RESULT([LZ4 library not found.])
+-	        havelz4lib=0
+-	    ])
 -    fi
++    AC_MSG_RESULT([Using LZ4 library in src/compat/compat-lz4.*])
++    AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
++    LZ4_LIBS=""
+ 
+-    saved_CFLAGS="${CFLAGS}"
+-    CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
+-    AC_CHECK_HEADERS(lz4.h,
+-       ,
+-       [
+-	   AC_MSG_RESULT([LZ4 headers not found.])
+-	   havelz4lib=0
+-       ])
 -
--    if test "${have_lz4}" != "yes" ; then
--	AC_MSG_RESULT([		usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
+-    if test $havelz4lib = 0 ; then
+-	AC_MSG_RESULT([LZ4 library or header not found, using version in src/compat/compat-lz4.*])
 -	AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
 -	LZ4_LIBS=""
 -    fi
-+    AC_MSG_RESULT([		usuable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
-+    AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
-+    LZ4_LIBS=""
      OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
      OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
-     AC_DEFINE(ENABLE_LZ4, [1], [Enable LZ4 compression library])
+     AC_DEFINE(ENABLE_LZ4, 1, [Enable LZ4 compression library])
+-    CFLAGS="${saved_CFLAGS}"
+ fi
+ 
+ 

+ 3 - 3
package/network/services/uhttpd/Makefile

@@ -12,9 +12,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(LEDE_GIT)/project/uhttpd.git
-PKG_SOURCE_DATE:=2016-10-25
-PKG_SOURCE_VERSION:=1628fa4b34aa143187353f81e8001b9a15286bda
-PKG_MIRROR_HASH:=2ac4ba8dc0b349d72174aac9ff693a73a214295a9890fe3d2a8eedcad54d06e3
+PKG_SOURCE_DATE:=2017-08-19
+PKG_SOURCE_VERSION:=3fd58e9b6da7d9e1a4710dbeefc2d289baea09fb
+PKG_MIRROR_HASH:=69bba3b04c5e1975b99dee4fc47672ebf5ab282f115249a46be0fe0b961eb34b
 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 PKG_LICENSE:=ISC
 

+ 1 - 1
package/network/utils/comgt/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=comgt
 PKG_VERSION:=0.32
-PKG_RELEASE:=28
+PKG_RELEASE:=29
 
 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=@SF/comgt

+ 1 - 1
package/network/utils/comgt/files/3g.sh

@@ -109,4 +109,4 @@ proto_3g_teardown() {
 	proto_kill_command "$interface"
 }
 
-[ -z "NOT_INCLUDED" ] || add_protocol 3g
+[ -z "$NOT_INCLUDED" ] || add_protocol 3g

+ 1 - 2
package/network/utils/comgt/files/directip.sh

@@ -44,8 +44,7 @@ proto_directip_setup() {
 		return 1
 	}
 
-	cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
-	[ -n $(echo "$cardinfo" | grep -q "Sierra Wireless") ] || {
+	gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | grep -q "Sierra Wireless" || {
 		proto_notify_error "$interface" BAD_DEVICE
 		proto_block_restart "$interface"
 		return 1

+ 1 - 1
package/network/utils/curl/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=curl
 PKG_VERSION:=7.52.1
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://curl.haxx.se/download/ \

+ 4 - 5
package/network/utils/tcpdump/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tcpdump
-PKG_VERSION:=4.9.1
+PKG_VERSION:=4.9.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.tcpdump.org/release/ \
-	http://www.at.tcpdump.org/
-PKG_HASH:=f9448cf4deb2049acf713655c736342662e652ef40dbe0a8f6f8d5b9ce5bd8f3
+PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
+	http://www.tcpdump.org/release/
+PKG_HASH:=798b3536a29832ce0cbb07fafb1ce5097c95e308a6f592d14052e1ef1505fe79
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_PARALLEL:=1
@@ -76,7 +76,6 @@ endif
 MAKE_FLAGS += \
 	CCOPT="$(TARGET_CFLAGS)" INCLS="-I. $(TARGET_CPPFLAGS)"
 
-
 define Package/tcpdump/install
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tcpdump $(1)/usr/sbin/

+ 39 - 35
package/network/utils/tcpdump/patches/100-tcpdump_mini.patch

@@ -115,7 +115,7 @@
  	$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
 --- a/addrtoname.c
 +++ b/addrtoname.c
-@@ -566,8 +566,10 @@ linkaddr_string(netdissect_options *ndo,
+@@ -578,8 +578,10 @@ linkaddr_string(netdissect_options *ndo,
  	if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN)
  		return (etheraddr_string(ndo, ep));
  
@@ -125,8 +125,8 @@
 +#endif
  
  	tp = lookup_bytestring(ndo, ep, len);
- 	if (tp->e_name)
-@@ -1202,6 +1204,7 @@ init_addrtoname(netdissect_options *ndo,
+	if (tp->bs_name)
+@@ -1214,6 +1216,7 @@ init_addrtoname(netdissect_options *ndo,
  	init_ipxsaparray(ndo);
  }
  
@@ -134,7 +134,7 @@
  const char *
  dnaddr_string(netdissect_options *ndo, u_short dnaddr)
  {
-@@ -1221,6 +1224,7 @@ dnaddr_string(netdissect_options *ndo, u
+@@ -1233,6 +1236,7 @@ dnaddr_string(netdissect_options *ndo, u
  
  	return(tp->name);
  }
@@ -247,7 +247,7 @@
  		return (1);
 @@ -368,6 +369,7 @@ ethertype_print(netdissect_options *ndo,
  		}
- 		isoclns_print(ndo, p + 1, length - 1, caplen - 1);
+		isoclns_print(ndo, p + 1, length - 1);
  		return(1);
 +#endif
  
@@ -335,7 +335,7 @@
          break;
 --- a/print-ip6.c
 +++ b/print-ip6.c
-@@ -303,6 +303,7 @@ ip6_print(netdissect_options *ndo, const
+@@ -305,6 +305,7 @@ ip6_print(netdissect_options *ndo, const
  				return;
  			nh = *cp;
  			break;
@@ -343,13 +343,16 @@
  		case IPPROTO_FRAGMENT:
  			advance = frag6_print(ndo, cp, (const u_char *)ip6);
  			if (advance < 0 || ndo->ndo_snapend <= cp + advance)
-@@ -324,16 +325,19 @@ ip6_print(netdissect_options *ndo, const
- 			advance = mobility_print(ndo, cp, (const u_char *)ip6);
+@@ -328,6 +329,7 @@ ip6_print(netdissect_options *ndo, const
+				return;
  			nh = *cp;
  			return;
 +#endif
  		case IPPROTO_ROUTING:
+			ND_TCHECK(*cp);
  			advance = rt6_print(ndo, cp, (const u_char *)ip6);
+@@ -335,12 +337,14 @@ ip6_print(netdissect_options *ndo, const
+				return;
  			nh = *cp;
  			break;
 +#ifndef TCPDUMP_MINI
@@ -363,15 +366,15 @@
  		case IPPROTO_TCP:
  			tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented);
  			return;
-@@ -343,6 +347,7 @@ ip6_print(netdissect_options *ndo, const
+@@ -350,6 +354,7 @@ ip6_print(netdissect_options *ndo, const
  		case IPPROTO_ICMPV6:
  			icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented);
  			return;
 +#ifndef TCPDUMP_MINI
  		case IPPROTO_AH:
  			advance = ah_print(ndo, cp);
- 			nh = *cp;
-@@ -371,6 +376,7 @@ ip6_print(netdissect_options *ndo, const
+			if (advance < 0)
+@@ -382,6 +387,7 @@ ip6_print(netdissect_options *ndo, const
  		case IPPROTO_PIM:
  			pim_print(ndo, cp, len, (const u_char *)ip6);
  			return;
@@ -379,7 +382,7 @@
  
  		case IPPROTO_OSPF:
  			ospf6_print(ndo, cp, len);
-@@ -384,9 +390,11 @@ ip6_print(netdissect_options *ndo, const
+@@ -395,9 +401,11 @@ ip6_print(netdissect_options *ndo, const
  		        ip_print(ndo, cp, len);
  			return;
  
@@ -393,7 +396,7 @@
  			gre_print(ndo, cp, len);
 --- a/print-ip.c
 +++ b/print-ip.c
-@@ -329,6 +329,7 @@ ip_print_demux(netdissect_options *ndo,
+@@ -344,6 +344,7 @@ ip_print_demux(netdissect_options *ndo,
  again:
  	switch (ipds->nh) {
  
@@ -401,7 +404,7 @@
  	case IPPROTO_AH:
  		if (!ND_TTEST(*ipds->cp)) {
  			ND_PRINT((ndo, "[|AH]"));
-@@ -367,7 +368,9 @@ again:
+@@ -382,7 +383,9 @@ again:
  		 */
  		break;
  	}
@@ -411,7 +414,7 @@
  	case IPPROTO_SCTP:
  		sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
  		break;
-@@ -375,6 +378,7 @@ again:
+@@ -390,6 +393,7 @@ again:
  	case IPPROTO_DCCP:
  		dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
  		break;
@@ -419,7 +422,7 @@
  
  	case IPPROTO_TCP:
  		/* pass on the MF bit plus the offset to detect fragments */
-@@ -394,6 +398,7 @@ again:
+@@ -409,6 +413,7 @@ again:
  			   ipds->off & (IP_MF|IP_OFFMASK));
  		break;
  
@@ -427,7 +430,7 @@
  	case IPPROTO_PIGP:
  		/*
  		 * XXX - the current IANA protocol number assignments
-@@ -414,14 +419,17 @@ again:
+@@ -429,14 +434,17 @@ again:
  	case IPPROTO_EIGRP:
  		eigrp_print(ndo, ipds->cp, ipds->len);
  		break;
@@ -445,7 +448,7 @@
  
  	case IPPROTO_OSPF:
  		ospf_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
-@@ -454,6 +462,7 @@ again:
+@@ -469,6 +477,7 @@ again:
  		gre_print(ndo, ipds->cp, ipds->len);
  		break;
  
@@ -453,14 +456,14 @@
  	case IPPROTO_MOBILE:
  		mobile_print(ndo, ipds->cp, ipds->len);
  		break;
-@@ -482,6 +491,7 @@ again:
+@@ -497,6 +506,7 @@ again:
  	case IPPROTO_PGM:
  		pgm_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
  		break;
 +#endif
  
  	default:
- 		if (ndo->ndo_nflag==0 && (proto = getprotobynumber(ipds->nh)) != NULL)
+		if (ndo->ndo_nflag==0 && (p_name = netdb_protoname(ipds->nh)) != NULL)
 --- a/print-llc.c
 +++ b/print-llc.c
 @@ -206,6 +206,7 @@ llc_print(netdissect_options *ndo, const
@@ -495,21 +498,22 @@
  
  #ifdef ENABLE_SMB
  	if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI
-@@ -322,11 +326,13 @@ llc_print(netdissect_options *ndo, const
+@@ -322,12 +326,13 @@ llc_print(netdissect_options *ndo, const
  		return (hdrlen);
  	}
  #endif
 +#ifndef TCPDUMP_MINI
  	if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS
  	    && control == LLC_UI) {
- 		isoclns_print(ndo, p, length, caplen);
+		isoclns_print(ndo, p, length);
  		return (hdrlen);
  	}
+-
 +#endif
- 
  	if (!ndo->ndo_eflag) {
  		if (ssap == dsap) {
-@@ -480,6 +486,7 @@ snap_print(netdissect_options *ndo, cons
+			if (src == NULL || dst == NULL)
+@@ -480,6 +485,7 @@ snap_print(netdissect_options *ndo, cons
  
  	case OUI_CISCO:
                  switch (et) {
@@ -517,7 +521,7 @@
                  case PID_CISCO_CDP:
                          cdp_print(ndo, p, length, caplen);
                          return (1);
-@@ -492,6 +499,7 @@ snap_print(netdissect_options *ndo, cons
+@@ -492,6 +498,7 @@ snap_print(netdissect_options *ndo, cons
                  case PID_CISCO_VTP:
                          vtp_print(ndo, p, length);
                          return (1);
@@ -525,7 +529,7 @@
                  case PID_CISCO_PVST:
                  case PID_CISCO_VLANBRIDGE:
                          stp_print(ndo, p, length);
-@@ -504,6 +512,7 @@ snap_print(netdissect_options *ndo, cons
+@@ -504,6 +511,7 @@ snap_print(netdissect_options *ndo, cons
  	case OUI_RFC2684:
  		switch (et) {
  
@@ -533,7 +537,7 @@
  		case PID_RFC2684_ETH_FCS:
  		case PID_RFC2684_ETH_NOFCS:
  			/*
-@@ -565,6 +574,7 @@ snap_print(netdissect_options *ndo, cons
+@@ -565,6 +573,7 @@ snap_print(netdissect_options *ndo, cons
  			 */
  			fddi_print(ndo, p, length, caplen);
  			return (1);
@@ -549,7 +553,7 @@
  
 +#ifndef TCPDUMP_MINI
  	case BSD_AFNUM_ISO:
- 		isoclns_print(ndo, p, length, caplen);
+		isoclns_print(ndo, p, length);
  		break;
 @@ -127,6 +128,7 @@ null_if_print(netdissect_options *ndo, c
  	case BSD_AFNUM_IPX:
@@ -561,7 +565,7 @@
  		/* unknown AF_ value */
 --- a/print-ppp.c
 +++ b/print-ppp.c
-@@ -1358,6 +1358,7 @@ trunc:
+@@ -1367,6 +1367,7 @@ trunc:
  	return 0;
  }
  
@@ -569,7 +573,7 @@
  static void
  ppp_hdlc(netdissect_options *ndo,
           const u_char *p, int length)
-@@ -1436,6 +1437,7 @@ trunc:
+@@ -1445,6 +1446,7 @@ trunc:
  	free(b);
  	ND_PRINT((ndo, "[|ppp]"));
  }
@@ -577,7 +581,7 @@
  
  
  /* PPP */
-@@ -1443,10 +1445,12 @@ static void
+@@ -1452,10 +1454,12 @@ static void
  handle_ppp(netdissect_options *ndo,
             u_int proto, const u_char *p, int length)
  {
@@ -590,7 +594,7 @@
  
  	switch (proto) {
  	case PPP_LCP: /* fall through */
-@@ -1479,6 +1483,7 @@ handle_ppp(netdissect_options *ndo,
+@@ -1488,6 +1492,7 @@ handle_ppp(netdissect_options *ndo,
  	case PPP_IPV6:
  		ip6_print(ndo, p, length);
  		break;
@@ -598,7 +602,7 @@
  	case ETHERTYPE_IPX:	/*XXX*/
  	case PPP_IPX:
  		ipx_print(ndo, p, length);
-@@ -1490,6 +1495,7 @@ handle_ppp(netdissect_options *ndo,
+@@ -1499,6 +1504,7 @@ handle_ppp(netdissect_options *ndo,
  	case PPP_MPLS_MCAST:
  		mpls_print(ndo, p, length);
  		break;
@@ -606,7 +610,7 @@
  	case PPP_COMP:
  		ND_PRINT((ndo, "compressed PPP data"));
  		break;
-@@ -1630,6 +1636,7 @@ ppp_if_print(netdissect_options *ndo,
+@@ -1639,6 +1645,7 @@ ppp_if_print(netdissect_options *ndo,
  	return (0);
  }
  
@@ -614,7 +618,7 @@
  /*
   * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
   * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
-@@ -1857,6 +1864,7 @@ printx:
+@@ -1866,6 +1873,7 @@ printx:
  #endif /* __bsdi__ */
  	return (hdrlength);
  }

+ 1 - 1
scripts/checkpatch.pl

@@ -173,7 +173,7 @@ if ($tree) {
 	}
 
 	if (!defined $root) {
-		print "Must be run from the top-level dir. of a LEDE tree\n";
+		print "Must be run from the top-level dir. of a libreCMC tree\n";
 		exit(2);
 	}
 }

+ 26 - 9
scripts/feeds

@@ -130,6 +130,7 @@ my %update_method = (
 		'init_branch'   => "git clone --depth 1 --branch '%s' '%s' '%s'",
 		'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
 		'update'	=> "git pull --ff",
+		'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 		'controldir'	=> ".git",
 		'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
 	'src-git-full' => {
@@ -137,6 +138,7 @@ my %update_method = (
 		'init_branch'   => "git clone --branch '%s' '%s' '%s'",
 		'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
 		'update'	=> "git pull --ff",
+		'update_force'	=> "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
 		'controldir'	=> ".git",
 		'revision'	=> "git rev-parse --short HEAD | tr -d '\n'"},
 	'src-gitsvn' => {
@@ -161,11 +163,12 @@ my %update_method = (
 # src-git: pull broken
 # src-cpy: broken if `basename $src` != $name
 
-sub update_feed_via($$$$) {
+sub update_feed_via($$$$$) {
 	my $type = shift;
 	my $name = shift;
 	my $src = shift;
 	my $relocate = shift;
+	my $force = shift;
 
 	my $m = $update_method{$type};
 	my $localpath = "./feeds/$name";
@@ -186,7 +189,11 @@ sub update_feed_via($$$$) {
 	} elsif ($m->{'init_commit'} and $commit) {
 		# in case git hash has been provided don't update the feed
 	} else {
-		system("cd '$safepath'; $m->{'update'}") == 0 or return 1;
+		my $update_cmd = $m->{'update'};
+		if ($force && exists $m->{'update_force'}) {
+			$update_cmd = $m->{'update_force'};
+		}
+		system("cd '$safepath'; $update_cmd") == 0 or return 1;
 	}
 
 	return 0;
@@ -664,13 +671,15 @@ sub uninstall {
 	return 0;
 }
 
-sub update_feed($$$$)
+sub update_feed($$$$$)
 {
 	my $type=shift;
 	my $name=shift;
 	my $src=shift;
 	my $perform_update=shift;
+	my $force_update=shift;
 	my $force_relocate=update_location( $name, "@$src" );
+	my $rv=0;
 
 	if( $force_relocate ) {
 		warn "Source of feed $name has changed, replacing copy\n";
@@ -683,9 +692,16 @@ sub update_feed($$$$)
 		my $failed = 1;
 		foreach my $feedsrc (@$src) {
 			warn "Updating feed '$name' from '$feedsrc' ...\n";
-			next unless update_feed_via($type, $name, $feedsrc, $force_relocate) == 0;
+			if (update_feed_via($type, $name, $feedsrc, $force_relocate, $force_update) != 0) {
+				if ($force_update) {
+					$rv=1;
+					$failed=0;
+					warn "failed, ignore.\n";
+					next;
+				}
+				last;
+			}
 			$failed = 0;
-			last;
 		}
 		$failed and do {
 			warn "failed.\n";
@@ -697,7 +713,7 @@ sub update_feed($$$$)
 		warn "failed.\n";
 		return 1;
 	};
-	return 0;
+	return $rv;
 }
 
 sub update {
@@ -709,7 +725,7 @@ sub update {
 	$ENV{SCAN_COOKIE} = $$;
 	$ENV{OPENWRT_VERBOSE} = 's';
 
-	getopts('ahi', \%opts);
+	getopts('ahif', \%opts);
 
 	if ($opts{h}) {
 		usage();
@@ -729,7 +745,7 @@ sub update {
 	if ( ($#ARGV == -1) or $opts{a}) {
 		foreach my $feed (@feeds) {
 			my ($type, $name, $src) = @$feed;
-			update_feed($type, $name, $src, $perform_update) == 0 or $failed=1;
+			update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1;
 		}
 	} else {
 		while ($feed_name = shift @ARGV) {
@@ -738,7 +754,7 @@ sub update {
 				if($feed_name ne $name) {
 					next;
 				}
-				update_feed($type, $name, $src, $perform_update) == 0 or $failed=1;
+				update_feed($type, $name, $src, $perform_update, $opts{f}) == 0 or $failed=1;
 			}
 		}
 	}
@@ -796,6 +812,7 @@ Commands:
 	Options:
 	    -a :           Update all feeds listed within feeds.conf. Otherwise the specified feeds will be updated.
 	    -i :           Recreate the index only. No feed update from repository is performed.
+	    -f :           Force updating feeds even if there are changed, uncommitted files.
 
 	clean:             Remove downloaded/generated files.
 

+ 1 - 1
scripts/om-fwupgradecfg-gen.sh

@@ -1,4 +1,4 @@
-#/bin/sh
+#!/bin/sh
 #
 # Copyright (C) 2011 OpenWrt.org
 #

+ 3 - 2
target/imagebuilder/Makefile

@@ -18,6 +18,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
 IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
 IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))
 IB_DTSDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))/arch/$(ARCH)/boot/dts/
+IB_IDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(STAGING_DIR_IMAGE))
 
 all: compile
 
@@ -72,8 +73,8 @@ endif
 		$(INSTALL_DIR) $(IB_LDIR)/scripts/dtc; \
 		$(INSTALL_BIN) $(LINUX_DIR)/scripts/dtc/dtc $(IB_LDIR)/scripts/dtc/dtc; \
 	fi
-	if [ -d $(LINUX_DIR)/arch/$(ARCH)/boot/dts ]; then \
-		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/* $(IB_DTSDIR); \
+	if [ -d $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts ]; then \
+		$(CP) -L $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/* $(IB_DTSDIR); \
 	fi
 	$(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(PKG_BUILD_DIR)/include/version.mk
 	find $(PKG_BUILD_DIR) -name CVS -o -name .git -o -name .svn \

+ 7 - 1
target/linux/ar71xx/base-files/etc/board.d/01_leds

@@ -49,6 +49,10 @@ antrouter-r1)
 	ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
 	ucidef_set_led_default "btc" "BTC" "$board:green:btc" "0"
 	;;
+ap121f)
+	ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0"
+	ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt"
+	;;
 arduino-yun)
 	ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
 	ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
@@ -183,6 +187,9 @@ cr5000)
 	ucidef_set_led_wlan "wlan" "WLAN" "pcs:blue:wlan" "phy0tpt"
 	ucidef_set_led_usbdev "usb" "USB" "pcs:white:wps" "1-1"
 	;;
+dr344)
+	ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1"
+	;;
 dragino2)
 	ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt"
 	ucidef_set_led_netdev "lan" "LAN" "$board:red:lan" "eth0"
@@ -276,7 +283,6 @@ dlan-pro-1200-ac)
 	ucidef_set_led_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
 	;;
 gl-ar150|\
-gl-usb150|\
 gl-ar300|\
 gl-ar300m|\
 gl-mifi)

+ 6 - 7
target/linux/ar71xx/base-files/etc/board.d/02_network

@@ -42,7 +42,6 @@ ar71xx_setup_interfaces()
 	tl-mr3420|\
 	tl-wdr3320-v2|\
 	tl-wdr3500|\
-	tl-wr741nd|\
 	tl-wr741nd-v4|\
 	tl-wr841n-v11|\
 	tl-wr841n-v9|\
@@ -61,6 +60,7 @@ ar71xx_setup_interfaces()
 	antminer-s1|\
 	antminer-s3|\
 	antrouter-r1|\
+	ap121f|\
 	aw-nr580|\
 	bullet-m|\
 	c-55|\
@@ -112,7 +112,7 @@ ar71xx_setup_interfaces()
 	tl-wa901nd-v4|\
 	tl-wr703n|\
 	tl-wr802n-v1|\
-	tpe-r1100|\
+	toe-r1100|\
 	tube2h|\
 	unifiac-lite|\
 	wndap360|\
@@ -123,10 +123,8 @@ ar71xx_setup_interfaces()
 	a60|\
 	alfa-ap96|\
 	alfa-nx|\
+	dr344|\
 	gl-ar150|\
-	gl-usb150)
-		ucidef_set_interface_lan "eth0"
-		;;
 	gl-ar300m|\
 	gl-domino|\
 	gl-inet|\
@@ -149,7 +147,6 @@ ar71xx_setup_interfaces()
 	all0315n|\
 	dlan-hotspot|\
 	dlan-pro-500-wp|\
-	dr344|\
 	ja76pf2|\
 	rocket-m-ti|\
 	ubnt-unifi-outdoor)
@@ -404,6 +401,7 @@ ar71xx_setup_interfaces()
 		ucidef_set_interface_raw "eth" "eth0"
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
 		;;
+	tl-wr741nd|\
 	tl-wr841n-v7)
 		ucidef_set_interfaces_lan_wan "eth0" "eth1"
 		ucidef_add_switch "switch0" \
@@ -484,7 +482,8 @@ ar71xx_setup_macs()
 		wan_mac=$(mtd_get_mac_binary caldata 6)
 		;;
 	tl-wr1043nd-v4)
-		wan_mac=$(mtd_get_mac_binary config 0x1017c)
+		lan_mac=$(mtd_get_mac_binary product-info 8)
+		wan_mac=$(macaddr_add "$lan_mac" 1)
 		;;
 	esr900)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")

+ 3 - 0
target/linux/ar71xx/base-files/etc/diag.sh

@@ -29,6 +29,9 @@ get_status_led() {
 	xd3200)
 		status_led="$board:green:system"
 		;;
+	ap121f)
+		status_led="$board:green:vpn"
+		;;
 	ap132|\
 	db120|\
 	dr344|\

+ 0 - 133
target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata

@@ -1,133 +0,0 @@
-#!/bin/sh
-
-ath10kcal_die() {
-	echo "ath10cal: " "$*"
-	exit 1
-}
-
-ath10kcal_from_file() {
-	local source=$1
-	local offset=$2
-	local count=$3
-
-	dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
-		ath10kcal_die "failed to extract calibration data from $source"
-}
-
-ath10kcal_extract() {
-	local part=$1
-	local offset=$2
-	local count=$3
-	local mtd
-
-	mtd=$(find_mtd_chardev $part)
-	[ -n "$mtd" ] || \
-		ath10kcal_die "no mtd device found for partition $part"
-
-	dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
-		ath10kcal_die "failed to extract calibration data from $mtd"
-}
-
-ath10kcal_patch_mac() {
-	local mac=$1
-
-	[ -z "$mac" ] && return
-
-	macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
-}
-
-[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/ar71xx.sh
-. /lib/functions.sh
-. /lib/functions/system.sh
-
-board=$(ar71xx_board_name)
-
-case "$FIRMWARE" in
-"ath10k/cal-pci-0000:00:00.0.bin")
-	case $board in
-	cf-e380ac-v1|\
-	cf-e380ac-v2|\
-	dlan-pro-1200-ac|\
-	sr3200|\
-	xd3200)
-		ath10kcal_extract "art" 20480 2116
-		;;
-	dap-2695-a1)
-		ath10kcal_extract "radiocfg" 20480 2116
-		ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
-		;;
-	dir-869-a1 | \
-	qihoo-c301)
-		ath10kcal_extract "radiocfg" 20480 2116
-		ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
-		;;
-	dw33d)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(mtd_get_mac_binary art 18)
-		;;
-	epg5000 | \
-	esr1750)
-		ath10kcal_extract "caldata" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
-		;;
-	mc-mac1200r)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
-		;;
-	a40 | \
-	a60 | \
-	mr1750 | \
-	mr1750v2 | \
-	om5p-acv2)
-		ath10kcal_extract "ART" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
-		;;
-	r6100)
-		ath10kcal_extract "caldata" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
-		;;
-	re450)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
-		;;
-	tl-wdr6500-v2)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
-		;;
-	tl-wpa8630)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
-		;;
-	unifiac-lite | \
-	unifiac-pro)
-		ath10kcal_extract "EEPROM" 20480 2116
-		;;
-	esac
-	;;
-"ath10k/cal-pci-0000:01:00.0.bin")
-	case $board in
-	archer-c5 | \
-	archer-c7)
-		ath10kcal_extract "art" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
-		;;
-	nbg6616 | \
-	nbg6716)
-		ath10kcal_extract "RFdata" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
-		;;
-	om5p-ac)
-		ath10kcal_extract "ART" 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
-		;;
-	rb-911g-5hpacd)
-		ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
-		;;
-	esac
-	;;
-*)
-	exit 1
-	;;
-esac

+ 4 - 0
target/linux/ar71xx/base-files/etc/uci-defaults/04_led_migration

@@ -52,6 +52,10 @@ dir-835-a1)
 	migrate_leds ":orange:=:amber:" ":wifi_bgn=:wlan2g"
 	;;
 
+dr344)
+	migrate_leds ":red:=:green:" ":yellow:=:green:"
+	;;
+
 wndap360)
 	migrate_leds "wndap360:=netgear:"
 	;;

+ 5 - 5
target/linux/ar71xx/base-files/lib/ar71xx.sh

@@ -433,6 +433,9 @@ ar71xx_board_detect() {
 	*AP121-MINI)
 		name="ap121-mini"
 		;;
+	*"AP121F")
+		name="ap121f"
+		;;
 	*"AP132 reference board")
 		name="ap132"
 		;;
@@ -620,9 +623,6 @@ ar71xx_board_detect() {
 	*"GL AR150")
 		name="gl-ar150"
 		;;
-	*"GL USB150")
-		name="gl-usb150"
-		;;
 	*"GL AR300")
 		name="gl-ar300"
 		;;
@@ -1091,9 +1091,9 @@ ar71xx_board_detect() {
 	*"TL-MR13U v1")
 		name="tl-mr13u"
 		;;
-	*"TPE-R1100 Think Penguin Mini Router")
+        *"TPE-R1100 Think Penguin Mini Router")
                 name="tpe-r1100"
-                ;;
+		;;
 	*"Tube2H")
 		name="tube2h"
 		;;

+ 0 - 54
target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k

@@ -1,54 +0,0 @@
-#!/bin/sh
-
-. /lib/functions/system.sh
-. /lib/ar71xx.sh
-
-
-do_patch_ath10k_firmware() {
-	local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
-
-	# bail out if firmware does not exist
-	[ -f "$firmware_file" ] || {
-		return
-	}
-
-	local mac_offset=276
-	local mac_length=6
-	local default_mac="00:03:07:12:34:56"
-	local current_mac="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x:" 1/1 "%02x"' $firmware_file  2>/dev/null)"
-
-	# check if mac address was already patched
-	[ "$default_mac" = "$current_mac" ] || {
-		return
-	}
-
-	# some boards have bogus mac in otp (= directly in the PCIe card's EEPROM).
-	# we have to patch the default mac in the firmware because we cannot change
-	# the otp.
-	case $(ar71xx_board_name) in
-		dgl-5500-a1 | tew-823dru)
-			local mac
-			mac=$(mtd_get_mac_ascii nvram wlan1_mac)
-
-			cp $firmware_file /tmp/ath10k-firmware.bin
-			macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \
-				conv=notrunc bs=1 seek=$mac_offset count=$mac_length
-
-		;;
-	esac
-	[ -f /tmp/ath10k-firmware.bin ] || {
-		return
-	}
-	cp /tmp/ath10k-firmware.bin $firmware_file
-	rm /tmp/ath10k-firmware.bin
-}
-
-check_patch_ath10k_firmware() {
-	case $(ar71xx_board_name) in
-		dgl-5500-a1 | tew-823dru)
-			do_patch_ath10k_firmware
-		;;
-	esac
-}
-
-boot_hook_add preinit_main check_patch_ath10k_firmware

+ 2 - 2
target/linux/ar71xx/base-files/lib/upgrade/platform.sh

@@ -111,7 +111,7 @@ tplink_pharos_check_image() {
 	# is accepted (loading the first 1.5M of a remote image for this check seems
 	# a bit extreme)
 	dd if="$1" bs=1 skip=1511432 count=1024 2>/dev/null | while read line; do
-		[ "$line" == "$model_string" ] && break
+		[ "$line" = "$model_string" ] && break
 	done || {
 		echo "Unsupported image (model not in support-list)"
 		return 1
@@ -203,6 +203,7 @@ platform_check_image() {
 	airgatewaypro|\
 	airgateway|\
 	airrouter|\
+	ap121f|\
 	ap132|\
 	ap90q|\
 	bullet-m|\
@@ -237,7 +238,6 @@ platform_check_image() {
 	ew-dorin-router|\
 	ew-dorin|\
 	gl-ar150|\
-	gl-usb150|\
 	gl-ar300m|\
 	gl-ar300|\
 	gl-domino|\

+ 1 - 1
target/linux/ar71xx/config-4.4

@@ -42,6 +42,7 @@ CONFIG_ATH79_MACH_ANTMINER_S1=y
 CONFIG_ATH79_MACH_ANTMINER_S3=y
 CONFIG_ATH79_MACH_ANTROUTER_R1=y
 CONFIG_ATH79_MACH_AP121=y
+CONFIG_ATH79_MACH_AP121F=y
 CONFIG_ATH79_MACH_AP132=y
 CONFIG_ATH79_MACH_AP136=y
 CONFIG_ATH79_MACH_AP143=y
@@ -102,7 +103,6 @@ CONFIG_ATH79_MACH_ESR900=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
 CONFIG_ATH79_MACH_GL_AR150=y
-CONFIG_ATH79_MACH_GL_USB150=y
 CONFIG_ATH79_MACH_GL_AR300=y
 CONFIG_ATH79_MACH_GL_AR300M=y
 CONFIG_ATH79_MACH_GL_DOMINO=y

+ 15 - 13
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt

@@ -16,6 +16,16 @@ config ATH79_MACH_ALFA_AP120C
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
 
+config ATH79_MACH_AP121F
+	bool "ALFA Network AP121F support"
+	select SOC_AR933X
+	select ATH79_DEV_ETH
+	select ATH79_DEV_GPIO_BUTTONS
+	select ATH79_DEV_LEDS_GPIO
+	select ATH79_DEV_M25P80
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+
 config ATH79_MACH_ALFA_AP96
 	bool "ALFA Network AP96 board support"
 	select SOC_AR71XX
@@ -252,6 +262,7 @@ config ATH79_MACH_ESR1750
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_SOM9331
 	bool "SOM9331 support"
@@ -458,7 +469,6 @@ config ATH79_MACH_DIR_505_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_DIR_600_A1
 	bool "D-Link DIR-600 A1/DIR-615 E1/DIR-615 E4 support"
@@ -489,7 +499,6 @@ config ATH79_MACH_DIR_615_I1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_DIR_825_B1
 	bool "D-Link DIR-825 rev. B1 board support"
@@ -521,6 +530,7 @@ config ATH79_MACH_DIR_869_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_DLAN_HOTSPOT
 	bool "devolo dLAN Hotspot support"
@@ -617,6 +627,7 @@ config ATH79_MACH_ESR900
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_EW_DORIN
 	bool "embedded wireless Dorin Platform support"
@@ -710,15 +721,6 @@ config ATH79_MACH_GL_INET
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
 
-config ATH79_MACH_GL_USB150
-        bool "GL.iNet GL-USB150 support"
-        select SOC_AR933X
-        select ATH79_DEV_ETH
-        select ATH79_DEV_GPIO_BUTTONS
-        select ATH79_DEV_LEDS_GPIO
-        select ATH79_DEV_M25P80
-        select ATH79_DEV_WMAC
-
 config ATH79_MACH_EAP120
 	bool "TP-LINK EAP120 support"
 	select SOC_AR934X
@@ -1612,7 +1614,6 @@ config ATH79_MACH_TEW_673GRU
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_USB
-	select ATH79_NVRAM
 
 config ATH79_MACH_TEW_712BR
 	bool "TRENDnet TEW-712BR support"
@@ -1622,7 +1623,6 @@ config ATH79_MACH_TEW_712BR
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
-	select ATH79_NVRAM
 
 config ATH79_MACH_TEW_732BR
 	bool "TRENDnet TEW-732BR support"
@@ -1753,6 +1753,7 @@ config ATH79_MACH_NBG6716
 	select ATH79_DEV_NFC
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_CARAMBOLA2
 	bool "8devices Carambola2 board"
@@ -1855,6 +1856,7 @@ config ATH79_MACH_DAP_2695_A1
 	select ATH79_DEV_LEDS_GPIO
 	select ATH79_DEV_M25P80
 	select ATH79_DEV_WMAC
+	select ATH79_NVRAM
 
 config ATH79_MACH_TL_WPA8630
 	bool "TP-Link TL-WPA8630 support"

+ 1 - 1
target/linux/ar71xx/files/arch/mips/ath79/Makefile

@@ -48,6 +48,7 @@ obj-$(CONFIG_ATH79_MACH_ANTMINER_S1)		+= mach-antminer-s1.o
 obj-$(CONFIG_ATH79_MACH_ANTMINER_S3)		+= mach-antminer-s3.o
 obj-$(CONFIG_ATH79_MACH_ANTROUTER_R1)		+= mach-antrouter-r1.o
 obj-$(CONFIG_ATH79_MACH_AP121)			+= mach-ap121.o
+obj-$(CONFIG_ATH79_MACH_AP121F)			+= mach-ap121f.o
 obj-$(CONFIG_ATH79_MACH_AP132)			+= mach-ap132.o
 obj-$(CONFIG_ATH79_MACH_AP136)			+= mach-ap136.o
 obj-$(CONFIG_ATH79_MACH_AP143)			+= mach-ap143.o
@@ -105,7 +106,6 @@ obj-$(CONFIG_ATH79_MACH_ESR1750)		+= mach-esr1750.o
 obj-$(CONFIG_ATH79_MACH_ESR900)			+= mach-esr900.o
 obj-$(CONFIG_ATH79_MACH_EW_DORIN)		+= mach-ew-dorin.o
 obj-$(CONFIG_ATH79_MACH_F9K1115V2)		+= mach-f9k1115v2.o
-obj-$(CONFIG_ATH79_MACH_GL_USB150)              += mach-gl-usb150.o
 obj-$(CONFIG_ATH79_MACH_GL_AR150)		+= mach-gl-ar150.o
 obj-$(CONFIG_ATH79_MACH_GL_AR300)		+= mach-gl-ar300.o
 obj-$(CONFIG_ATH79_MACH_GL_AR300M)		+= mach-gl-ar300m.o

+ 37 - 42
target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c

@@ -19,10 +19,11 @@
  *
  */
 
+#include <linux/gpio.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/ath9k_platform.h>
-#include <linux/ar8216_platform.h>
+#include <linux/platform_data/phy-at803x.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 
@@ -38,15 +39,16 @@
 #include "dev-wmac.h"
 #include "machtypes.h"
 
-#define DR344_GPIO_LED_SIG1	15
-#define DR344_GPIO_LED_SIG2	11
-#define DR344_GPIO_LED_SIG3	12
-#define DR344_GPIO_LED_SIG4	13
-#define DR344_GPIO_EXTERNAL_LNA0       18
-#define DR344_GPIO_EXTERNAL_LNA1       19
-#define DR344_GPIO_LED_STATUS	14
+#define DR344_GPIO_LED_SIG1		12
+#define DR344_GPIO_LED_SIG2		13
+#define DR344_GPIO_LED_SIG3		14
+#define DR344_GPIO_LED_SIG4		15
+#define DR344_GPIO_LED_STATUS		11
+#define DR344_GPIO_LED_LAN		17
+#define DR344_GPIO_EXTERNAL_LNA0	18
+#define DR344_GPIO_EXTERNAL_LNA1	19
 
-#define DR344_GPIO_BTN_RESET	12
+#define DR344_GPIO_BTN_RESET		16
 
 #define DR344_KEYS_POLL_INTERVAL	20	/* msecs */
 #define DR344_KEYS_DEBOUNCE_INTERVAL	(3 * DR344_KEYS_POLL_INTERVAL)
@@ -57,18 +59,23 @@
 #define DR344_PCIE_CALDATA_OFFSET	0x5000
 
 static struct gpio_led dr344_leds_gpio[] __initdata = {
+	{
+		.name		= "dr344:green:lan",
+		.gpio		= DR344_GPIO_LED_LAN,
+		.active_low	= 1,
+	},
 	{
 		.name		= "dr344:green:status",
 		.gpio		= DR344_GPIO_LED_STATUS,
 		.active_low	= 1,
 	},
 	{
-		.name		= "dr344:red:sig1",
+		.name		= "dr344:green:sig1",
 		.gpio		= DR344_GPIO_LED_SIG1,
 		.active_low	= 1,
 	},
 	{
-		.name		= "dr344:yellow:sig2",
+		.name		= "dr344:green:sig2",
 		.gpio		= DR344_GPIO_LED_SIG2,
 		.active_low	= 1,
 	},
@@ -95,47 +102,35 @@ static struct gpio_keys_button dr344_gpio_keys[] __initdata = {
 	},
 };
 
-static struct ar8327_pad_cfg dr344_ar8327_pad0_cfg = {
-	.mode = AR8327_PAD_MAC_RGMII,
-	.txclk_delay_en = true,
-	.rxclk_delay_en = true,
-	.txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
-	.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
-};
-
-static struct ar8327_led_cfg dr344_ar8327_led_cfg = {
-	.led_ctrl0 = 0x00000000,
-	.led_ctrl1 = 0xc737c737,
-	.led_ctrl2 = 0x00000000,
-	.led_ctrl3 = 0x00c30c00,
-	.open_drain = true,
-};
-
-static struct ar8327_platform_data dr344_ar8327_data = {
-	.pad0_cfg = &dr344_ar8327_pad0_cfg,
-	.port0_cfg = {
-		.force_link = 1,
-		.speed = AR8327_PORT_SPEED_1000,
-		.duplex = 1,
-		.txpause = 1,
-		.rxpause = 1,
-	},
-	.led_cfg = &dr344_ar8327_led_cfg,
+static struct at803x_platform_data dr344_at803x_data = {
+	.disable_smarteee = 1,
+	.enable_rgmii_rx_delay = 1,
+	.enable_rgmii_tx_delay = 1,
 };
 
 static struct mdio_board_info dr344_mdio0_info[] = {
 	{
 		.bus_id = "ag71xx-mdio.0",
 		.phy_addr = 0,
-		.platform_data = &dr344_ar8327_data,
+		.platform_data = &dr344_at803x_data,
 	},
 };
 
 static void __init dr344_setup(void)
 {
 	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f03f810);
 
 	ath79_register_m25p80(NULL);
+
+	ath79_gpio_direction_select(DR344_GPIO_LED_STATUS, true);
+	gpio_set_value(DR344_GPIO_LED_STATUS, 1);
+	ath79_gpio_output_select(DR344_GPIO_LED_STATUS, 0);
+
+	ath79_gpio_direction_select(DR344_GPIO_LED_LAN, true);
+	gpio_set_value(DR344_GPIO_LED_LAN, 1);
+	ath79_gpio_output_select(DR344_GPIO_LED_LAN, 0);
+
 	ath79_register_leds_gpio(-1, ARRAY_SIZE(dr344_leds_gpio),
 				 dr344_leds_gpio);
 	ath79_register_gpio_keys_polled(-1, DR344_KEYS_POLL_INTERVAL,
@@ -158,17 +153,17 @@ static void __init dr344_setup(void)
 	ath79_register_mdio(1, 0x0);
 	ath79_register_mdio(0, 0x0);
 
-	ath79_init_mac(ath79_eth0_data.mac_addr, art + DR344_MAC0_OFFSET, 0);
-       ath79_init_mac(ath79_eth1_data.mac_addr, art + DR344_MAC1_OFFSET, 0);
+	ath79_init_mac(ath79_eth0_data.mac_addr, mac + DR344_MAC0_OFFSET, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, mac + DR344_MAC1_OFFSET, 0);
 
 	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
 				   AR934X_ETH_CFG_SW_ONLY_MODE);
 
-	/* GMAC0 is connected to an AR8327 switch */
+	/* GMAC0 is connected to an AR8035 Gbps PHY */
 	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
 	ath79_eth0_data.phy_mask = BIT(0);
 	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
-	ath79_eth0_pll_data.pll_1000 = 0x0e000000;
+	ath79_eth0_pll_data.pll_1000 = 0x02000000;
 	ath79_eth0_pll_data.pll_100 = 0x0101;
 	ath79_eth0_pll_data.pll_10 = 0x1313;
 

+ 0 - 87
target/linux/ar71xx/files/arch/mips/ath79/mach-gl-usb150.c

@@ -1,87 +0,0 @@
-/*
- * GL.iNet GL-USB150 board support
- *
- * Copyright (C) 2017 Piotr Dymacz <pepe2k@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- */
-
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-ath79/ath79.h>
-#include <asm/mach-ath79/ar71xx_regs.h>
-
-#include "common.h"
-#include "dev-eth.h"
-#include "dev-gpio-buttons.h"
-#include "dev-leds-gpio.h"
-#include "dev-m25p80.h"
-#include "dev-wmac.h"
-#include "machtypes.h"
-
-#define GL_USB150_GPIO_LED_POWER	13
-#define GL_USB150_GPIO_LED_WLAN		0
-#define GL_USB150_GPIO_LAN_RESET	7
-#define GL_USB150_GPIO_BTN_RESET	11
-
-#define GL_USB150_KEYS_POLL_INTERVAL		20
-#define GL_USB150_KEYS_DEBOUNCE_INTERVAL	\
-					(3 * GL_USB150_KEYS_POLL_INTERVAL)
-
-#define GL_USB150_WMAC_CALDATA_OFFSET	0x1000
-
-static struct gpio_led gl_usb150_leds_gpio[] __initdata = {
-	{
-		.name		= "gl-usb150:green:power",
-		.gpio		= GL_USB150_GPIO_LED_POWER,
-		.active_low	= 0,
-	}, {
-		.name		= "gl-usb150:green:wlan",
-		.gpio		= GL_USB150_GPIO_LED_WLAN,
-		.active_low	= 0,
-	},
-};
-
-static struct gpio_keys_button gl_usb150_gpio_keys[] __initdata = {
-	{
-		.desc			= "reset",
-		.type			= EV_KEY,
-		.code			= KEY_RESTART,
-		.debounce_interval	= GL_USB150_KEYS_DEBOUNCE_INTERVAL,
-		.gpio			= GL_USB150_GPIO_BTN_RESET,
-		.active_low		= 0,
-	},
-};
-
-static void __init gl_usb150_setup(void)
-{
-	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
-
-	ath79_register_m25p80(NULL);
-
-	ath79_setup_ar933x_phy4_switch(false, false);
-
-	/* LAN (PHY4 connected with Realtek RTL8152B) */
-	ath79_init_mac(ath79_eth0_data.mac_addr, art, 0);
-	ath79_register_mdio(0, 0x0);
-	ath79_register_eth(0);
-
-	ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_usb150_leds_gpio),
-				 gl_usb150_leds_gpio);
-
-	ath79_register_gpio_keys_polled(-1, GL_USB150_KEYS_POLL_INTERVAL,
-					ARRAY_SIZE(gl_usb150_gpio_keys),
-					gl_usb150_gpio_keys);
-
-	gpio_request_one(GL_USB150_GPIO_LAN_RESET,
-			 GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
-			 "LAN reset");
-
-	ath79_register_wmac(art + GL_USB150_WMAC_CALDATA_OFFSET, NULL);
-}
-
-MIPS_MACHINE(ATH79_MACH_GL_USB150, "GL-USB150", "GL.iNet GL-USB150",
-	     gl_usb150_setup);

+ 2 - 0
target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c

@@ -165,6 +165,8 @@ static int rb95x_nand_scan_fixup(struct mtd_info *mtd)
 		chip->ecc.layout = &rb95x_nand_ecclayout;
 	}
 
+	chip->options = NAND_NO_SUBPAGE_WRITE;
+
 	return 0;
 }
 

+ 1 - 1
target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c

@@ -57,7 +57,7 @@
 #define TL_WR1043_V4_KEYS_POLL_INTERVAL		20 /* msecs */
 #define TL_WR1043_V4_KEYS_DEBOUNCE_INTERVAL	(3 * TL_WR1043_V4_KEYS_POLL_INTERVAL)
 
-#define TL_WR1043_V4_MAC_LOCATION		0x1ff80174
+#define TL_WR1043_V4_MAC_LOCATION		0x1ff50008
 
 #define TL_WR1043_V4_EEPROM_ADDR		0x1fff0000
 #define TL_WR1043_V4_WMAC_CALDATA_OFFSET	0x1000

+ 1 - 1
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h

@@ -30,6 +30,7 @@ enum ath79_mach_type {
 	ATH79_MACH_ANTROUTER_R1,		/* Antrouter R1 */
 	ATH79_MACH_AP121,			/* Atheros AP121 reference board */
 	ATH79_MACH_AP121_MINI,			/* Atheros AP121-MINI reference board */
+	ATH79_MACH_AP121F,			/* ALFA Network AP121F */
 	ATH79_MACH_AP132,			/* Atheros AP132 reference board */
 	ATH79_MACH_AP135_020,			/* Atheros AP135-020 reference board */
 	ATH79_MACH_AP136_010,			/* Atheros AP136-010 reference board */
@@ -102,7 +103,6 @@ enum ath79_mach_type {
 	ATH79_MACH_GL_DOMINO,			/* Domino */
 	ATH79_MACH_GL_INET,			/* GL-CONNECT GL-INET */
 	ATH79_MACH_GL_MIFI,			/* GL-MIFI support */
-	ATH79_MACH_GL_USB150,                   /* GL.iNet GL-USB150 */
 	ATH79_MACH_GS_MINIBOX_V1,		/* Gainstrong MiniBox V1.0 */
 	ATH79_MACH_GS_OOLITE,			/* GS OOLITE V1.0 */
 	ATH79_MACH_HIWIFI_HC6361,		/* HiWiFi HC6361 */

+ 17 - 62
target/linux/ar71xx/image/generic.mk

@@ -1,3 +1,16 @@
+define Device/ap121f
+  DEVICE_TITLE := ALFA Network AP121F
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage -swconfig
+  BOARDNAME := AP121F
+  IMAGE_SIZE := 16064k
+  CONSOLE := ttyATH0,115200
+  MTDPARTS := spi0.0:192k(u-boot)ro,64k(u-boot-env),64k(art)ro,-(firmware)
+  SUPPORTED_DEVICES := ap121f
+  IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
+	append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += ap121f
+
 define Device/ap90q
   DEVICE_TITLE := YunCore AP90Q
   BOARDNAME = AP90Q
@@ -117,25 +130,12 @@ define Device/gl-ar150
   MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
 endef
 
-define Device/gl-usb150
-  DEVICE_TITLE := GL.iNet GL-USB150
-  DEVICE_PACKAGES := -swconfig
-  BOARDNAME := GL-USB150
-  IMAGE_SIZE := 16000k
-  CONSOLE := ttyATH0,115200
-  MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
-  SUPPORTED_DEVICES := gl-usb150
-  IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
-        append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
-endef
-TARGET_DEVICES += gl-usb150
-
 define Device/tpe-r1100
   $(Device/gl-ar150)
   DEVICE_TITLE := TPE-R1100 Think Penguin Mini Router
 endef
 
-TARGET_DEVICES += tpe-r1100
+TARGET_DEVICES += gl-ar150 tpe-r1100
 
 define Device/gl-ar300
   DEVICE_TITLE := GL AR300
@@ -505,43 +505,6 @@ define Device/oolite
 endef
 TARGET_DEVICES += oolite
 
-
-define Device/NBG6616
-  DEVICE_TITLE := ZyXEL NBG6616
-  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-rtc-pcf8563
-  BOARDNAME = NBG6616
-  KERNEL_SIZE = 2048k
-  IMAGE_SIZE = 15323k
-  MTDPARTS = spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
-  CMDLINE += mem=128M
-  IMAGES := sysupgrade.bin
-  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage
-  IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
-  # We cannot currently build a factory image. It is the sysupgrade image
-  # prefixed with a header (which is actually written into the MTD device).
-  # The header is 2kiB and is filled with 0xff. The format seems to be:
-  #   2 bytes:  0x0000
-  #   2 bytes:  checksum of the data partition (big endian)
-  #   4 bytes:  length of the contained image file (big endian)
-  #  32 bytes:  Firmware Version string (NUL terminated, 0xff padded)
-  #   2 bytes:  0x0000
-  #   2 bytes:  checksum over the header partition (big endian)
-  #  32 bytes:  Model (e.g. "NBG6616", NUL termiated, 0xff padded)
-  #      rest: 0xff padding
-  #
-  # The checksums are calculated by adding up all bytes and if a 16bit
-  # overflow occurs, one is added and the sum is masked to 16 bit:
-  #   csum = csum + databyte; if (csum > 0xffff) { csum += 1; csum &= 0xffff };
-  # Should the file have an odd number of bytes then the byte len-0x800 is
-  # used additionally.
-  # The checksum for the header is calcualted over the first 2048 bytes with
-  # the firmware checksum as the placeholder during calculation.
-  #
-  # The header is padded with 0xff to the erase block size of the device.
-endef
-
-TARGET_DEVICES += NBG6616
-
 define Device/c-55
   DEVICE_TITLE := AirTight Networks C-55
   DEVICE_PACKAGES := kmod-ath9k
@@ -631,17 +594,7 @@ $(Device/seama)
   SEAMA_SIGNATURE := wrgnd13_wd_av
 endef
 
-define Device/qihoo-c301
-$(Device/seama)
-  DEVICE_TITLE := Qihoo C301
-  DEVICE_PACKAGES :=  kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
-  BOARDNAME = QIHOO-C301
-  IMAGE_SIZE = 15744k
-  MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
-  SEAMA_SIGNATURE := wrgac26_qihoo360_360rg
-endef
-
-TARGET_DEVICES += dir-869-a1 mynet-n600 mynet-n750 qihoo-c301
+TARGET_DEVICES += dir-869-a1 mynet-n600 mynet-n750
 
 define Build/mkwrggimg
 	$(STAGING_DIR_HOST)/bin/mkwrggimg -b \
@@ -655,6 +608,8 @@ define Build/wrgg-pad-rootfs
 	$(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
 endef
 
+TARGET_DEVICES += dap-2695-a1
+
 define Build/mkbuffaloimg
 	$(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \
 		-R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \

+ 0 - 25
target/linux/ar71xx/image/legacy-devices.mk

@@ -1,10 +1,3 @@
-define LegacyDevice/A60
-   DEVICE_TITLE := OpenMesh A40/A60
-   DEVICE_PACKAGES := om-watchdog \
-	mod-usb-core kmod-usb2
-endef
-LEGACY_DEVICES += A60
-
 define LegacyDevice/ALFANX
   DEVICE_TITLE := ALFA Network N2/N5 board
 endef
@@ -292,12 +285,6 @@ define LegacyDevice/DGL5500A1
 endef
 LEGACY_DEVICES += DGL5500A1
 
-define LegacyDevice/TEW823DRU
-  DEVICE_TITLE := TRENDNet TEW-823DRU
-  DEVICE_PACKAGES := kmod-usb-core kmod-usb2
-endef
-LEGACY_DEVICES += TEW823DRU
-
 define LegacyDevice/DHP1565A1
   DEVICE_TITLE := D-Link DHP-1565 rev. A1
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2
@@ -367,18 +354,6 @@ define LegacyDevice/ESR900
 endef
 LEGACY_DEVICES += ESR900
 
-define LegacyDevice/ESR1750
-  DEVICE_TITLE := EnGenius ESR1750
-  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage
-endef
-LEGACY_DEVICES += ESR1750
-
-define LegacyDevice/EPG5000
-  DEVICE_TITLE := EnGenius EPG5000
-  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage
-endef
-LEGACY_DEVICES += EPG5000
-
 define LegacyDevice/WP543_4M
   DEVICE_TITLE := Compex WP543/WPJ543 (4MB flash)
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2

+ 2 - 2
target/linux/ar71xx/image/legacy.mk

@@ -498,11 +498,11 @@ define Image/Build/Belkin
 	$(eval rootsize=$(call mtdpartsize,rootfs,$(4)))
 	$(call Sysupgrade/RKuImage,$(1),$(2),$(kernsize),$(rootsize))
 	if [ -e "$(call sysupname,$(1),$(2))" ]; then \
-		edimax_fw_header -m $(5) -v "$(shell echo -n LEDE$(REVISION) | cut -c -13)" \
+		edimax_fw_header -m $(5) -v "$(shell echo -n libreCMC$(REVISION) | cut -c -13)" \
 			-n "uImage" \
 			-i $(KDIR_TMP)/vmlinux-$(2).uImage \
 			-o $(KDIR_TMP)/$(2)-uImage; \
-		edimax_fw_header -m $(5) -v "$(shell echo -n LEDE$(REVISION) | cut -c -13)" \
+		edimax_fw_header -m $(5) -v "$(shell echo -n libreCMC$(REVISION) | cut -c -13)" \
 			-n "rootfs" \
 			-i $(KDIR)/root.$(1) \
 			-o $(KDIR_TMP)/$(2)-rootfs; \

+ 2 - 2
target/linux/ar71xx/image/mikrotik.mk

@@ -1,6 +1,6 @@
 define Device/mikrotik
   PROFILES := Default
-  DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport nand-utils
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport
   BOARD_NAME := routerboard
   KERNEL_INITRAMFS :=
   KERNEL_NAME := loader-generic.elf
@@ -26,7 +26,7 @@ TARGET_DEVICES += nand-64m nand-large
 
 define Device/rb-nor-flash-16M
   DEVICE_TITLE := MikroTik RouterBoard with 16 MB NOR flash
-  DEVICE_PACKAGES := rbcfg
+  DEVICE_PACKAGES := rbcfg -nand-utils
   BLOCKSIZE := 64k
   IMAGE_SIZE := 16000k
   LOADER_TYPE := elf

+ 9 - 41
target/linux/ar71xx/image/tp-link.mk

@@ -215,15 +215,6 @@ $(Device/tplink-4mlzma)
 endef
 TARGET_DEVICES += tl-wdr3320-v2
 
-define Device/archer-c5-v1
-    $(Device/tplink-16mlzma)
-    DEVICE_TITLE := TP-LINK Archer C5
-    DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
-    BOARDNAME := ARCHER-C5
-    DEVICE_PROFILE := ARCHERC7
-    TPLINK_HWID := 0xc5000001
-endef
-
 define Device/archer-c7-v1
     $(Device/tplink-8mlzma)
     DEVICE_TITLE := TP-LINK Archer C7 v1
@@ -233,37 +224,7 @@ define Device/archer-c7-v1
     TPLINK_HWID := 0x75000001
 endef
 
-define Device/archer-c7-v2
-    $(Device/tplink-16mlzma)
-    DEVICE_TITLE := TP-LINK Archer C7 v2
-    DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
-    BOARDNAME := ARCHER-C7-V2
-    DEVICE_PROFILE := ARCHERC7
-    TPLINK_HWID := 0xc7000002
-    IMAGES := sysupgrade.bin factory.bin factory-us.bin factory-eu.bin
-    IMAGE/factory-us.bin := append-rootfs | mktplinkfw factory -C US
-    IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
-endef
-
-define Device/archer-c7-v2-il
-    $(Device/tplink-16mlzma)
-    DEVICE_TITLE := TP-LINK Archer C7 v2 IL
-    DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
-    BOARDNAME := ARCHER-C7-V2
-    DEVICE_PROFILE := ARCHERC7
-    TPLINK_HWID := 0xc7000002
-    TPLINK_HWREV := 0x494c0001
-endef
-
-define Device/tl-wdr7500-v3
-    $(Device/tplink-8mlzma)
-    DEVICE_TITLE := TP-LINK Archer C7 v3
-    DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
-    BOARDNAME := ARCHER-C7
-    DEVICE_PROFILE := ARCHERC7
-    TPLINK_HWID := 0x75000003
-endef
-TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 archer-c7-v2-il tl-wdr7500-v3
+TARGET_DEVICES += archer-c7-v1
 
 define Device/tl-mr10u-v1
     $(Device/tplink-4mlzma)
@@ -402,6 +363,7 @@ define Device/tl-wr710n-v1
     DEVICE_PROFILE := TLWR710
     TPLINK_HWID := 0x07100001
     CONSOLE := ttyATH0,115200
+    IMAGE/factory.bin := append-rootfs | mktplinkfw factory -C US
 endef
 
 define Device/tl-wr710n-v2
@@ -629,6 +591,12 @@ define Device/tl-wr841-v11
    IMAGE/factory-eu.bin := append-rootfs | mktplinkfw factory -C EU
 endef
 
+define Device/tl-wr841-v12
+  $(Device/tl-wr841-v11)
+  DEVICE_TITLE := TP-LINK TL-WR841N/ND v12
+  TPLINK_HWID := 0x08410012
+endef
+
 define Device/tl-wr842n-v1
     $(Device/tplink-8m)
     DEVICE_TITLE := TP-LINK TL-WR842N/ND v1
@@ -671,7 +639,7 @@ define Device/tl-wr847n-v8
     DEVICE_PROFILE := TLWR841
     TPLINK_HWID := 0x08470008
 endef
-TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
+TARGET_DEVICES += tl-wr841-v1.5 tl-wr841-v3 tl-wr841-v5 tl-wr841-v7 tl-wr841-v8 tl-wr841-v9 tl-wr841-v10 tl-wr841-v11 tl-wr841-v12 tl-wr842n-v1 tl-wr842n-v2 tl-wr842n-v3 tl-wr843nd-v1 tl-wr847n-v8
 
 define Device/tl-wr941nd-v2
     $(Device/tplink-4m)

+ 1 - 0
target/linux/ar71xx/mikrotik/config-default

@@ -8,6 +8,7 @@
 # CONFIG_ATH79_MACH_ANTMINER_S3 is not set
 # CONFIG_ATH79_MACH_ANTROUTER_R1 is not set
 # CONFIG_ATH79_MACH_AP121 is not set
+# CONFIG_ATH79_MACH_AP121F is not set
 # CONFIG_ATH79_MACH_AP132 is not set
 # CONFIG_ATH79_MACH_AP136 is not set
 # CONFIG_ATH79_MACH_AP143 is not set

+ 2 - 0
target/linux/ar71xx/mikrotik/target.mk

@@ -1,6 +1,8 @@
 BOARDNAME:=Mikrotik devices with NAND/NOR flash
 FEATURES += squashfs ramdisk minor nand
 
+DEFAULT_PACKAGES += nand-utils
+
 define Target/Description
 	Build firmware images for Atheros AR71xx/AR913x based Mikrotik boards.
 	e.g. MikroTik RB-4xx or RB-750

+ 1 - 0
target/linux/ar71xx/nand/config-default

@@ -4,6 +4,7 @@
 # CONFIG_ATH79_MACH_ALL0258N is not set
 # CONFIG_ATH79_MACH_ALL0315N is not set
 # CONFIG_ATH79_MACH_AP121 is not set
+# CONFIG_ATH79_MACH_AP121F is not set
 # CONFIG_ATH79_MACH_AP132 is not set
 # CONFIG_ATH79_MACH_AP136 is not set
 # CONFIG_ATH79_MACH_AP147 is not set

+ 1 - 1
target/linux/generic/patches-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch

@@ -75,7 +75,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
 
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
-@@ -5345,7 +5345,7 @@ static void __init_refok alloc_node_mem_
+@@ -5357,7 +5357,7 @@ static void __init_refok alloc_node_mem_
  		mem_map = NODE_DATA(0)->node_mem_map;
  #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
  		if (page_to_pfn(mem_map) != pgdat->node_start_pfn)

+ 9 - 9
target/linux/generic/patches-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch

@@ -143,7 +143,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  static const struct rt6_info ip6_blk_hole_entry_template = {
  	.dst = {
  		.__refcnt	= ATOMIC_INIT(1),
-@@ -1889,6 +1906,11 @@ static struct rt6_info *ip6_route_info_c
+@@ -1898,6 +1915,11 @@ static struct rt6_info *ip6_route_info_c
  			rt->dst.output = ip6_pkt_prohibit_out;
  			rt->dst.input = ip6_pkt_prohibit;
  			break;
@@ -155,7 +155,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case RTN_THROW:
  		case RTN_UNREACHABLE:
  		default:
-@@ -2492,6 +2514,17 @@ static int ip6_pkt_prohibit_out(struct n
+@@ -2501,6 +2523,17 @@ static int ip6_pkt_prohibit_out(struct n
  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  }
  
@@ -173,7 +173,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  /*
   *	Allocate a dst for local (unicast / anycast) address.
   */
-@@ -2734,7 +2767,8 @@ static int rtm_to_fib6_config(struct sk_
+@@ -2743,7 +2776,8 @@ static int rtm_to_fib6_config(struct sk_
  	if (rtm->rtm_type == RTN_UNREACHABLE ||
  	    rtm->rtm_type == RTN_BLACKHOLE ||
  	    rtm->rtm_type == RTN_PROHIBIT ||
@@ -183,7 +183,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		cfg->fc_flags |= RTF_REJECT;
  
  	if (rtm->rtm_type == RTN_LOCAL)
-@@ -3087,6 +3121,9 @@ static int rt6_fill_node(struct net *net
+@@ -3096,6 +3130,9 @@ static int rt6_fill_node(struct net *net
  		case -EACCES:
  			rtm->rtm_type = RTN_PROHIBIT;
  			break;
@@ -193,7 +193,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		case -EAGAIN:
  			rtm->rtm_type = RTN_THROW;
  			break;
-@@ -3366,6 +3403,8 @@ static int ip6_route_dev_notify(struct n
+@@ -3375,6 +3412,8 @@ static int ip6_route_dev_notify(struct n
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  		net->ipv6.ip6_prohibit_entry->dst.dev = dev;
  		net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  		net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
  		net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  #endif
-@@ -3588,6 +3627,17 @@ static int __net_init ip6_route_net_init
+@@ -3597,6 +3636,17 @@ static int __net_init ip6_route_net_init
  	net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
  	dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
  			 ip6_template_metrics, true);
@@ -220,7 +220,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  
  	net->ipv6.sysctl.flush_delay = 0;
-@@ -3606,6 +3656,8 @@ out:
+@@ -3615,6 +3665,8 @@ out:
  	return ret;
  
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -229,7 +229,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  out_ip6_prohibit_entry:
  	kfree(net->ipv6.ip6_prohibit_entry);
  out_ip6_null_entry:
-@@ -3623,6 +3675,7 @@ static void __net_exit ip6_route_net_exi
+@@ -3632,6 +3684,7 @@ static void __net_exit ip6_route_net_exi
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
  	kfree(net->ipv6.ip6_prohibit_entry);
  	kfree(net->ipv6.ip6_blk_hole_entry);
@@ -237,7 +237,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  }
-@@ -3696,6 +3749,9 @@ void __init ip6_route_init_special_entri
+@@ -3705,6 +3758,9 @@ void __init ip6_route_init_special_entri
  	init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
  	init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
  	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);

+ 0 - 11
target/linux/generic/patches-4.4/704-phy-no-genphy-soft-reset.patch

@@ -1,11 +0,0 @@
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -1465,7 +1465,7 @@ static struct phy_driver genphy_driver[]
- 	.phy_id         = 0xffffffff,
- 	.phy_id_mask    = 0xffffffff,
- 	.name           = "Generic 10G PHY",
--	.soft_reset	= gen10g_soft_reset,
-+	.soft_reset	= genphy_no_soft_reset,
- 	.config_init    = gen10g_config_init,
- 	.features       = 0,
- 	.config_aneg    = gen10g_config_aneg,

+ 3 - 3
target/linux/generic/patches-4.4/811-pci_disable_usb_common_quirks.patch

@@ -10,7 +10,7 @@
  static struct amd_chipset_info {
  	struct pci_dev	*nb_dev;
  	struct pci_dev	*smbus_dev;
-@@ -457,6 +459,10 @@ void usb_amd_dev_put(void)
+@@ -458,6 +460,10 @@ void usb_amd_dev_put(void)
  }
  EXPORT_SYMBOL_GPL(usb_amd_dev_put);
  
@@ -21,7 +21,7 @@
  /*
   * Make sure the controller is completely inactive, unable to
   * generate interrupts or do DMA.
-@@ -536,8 +542,17 @@ reset_needed:
+@@ -537,8 +543,17 @@ reset_needed:
  	uhci_reset_hc(pdev, base);
  	return 1;
  }
@@ -39,7 +39,7 @@
  static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
  {
  	u16 cmd;
-@@ -1102,3 +1117,4 @@ static void quirk_usb_early_handoff(stru
+@@ -1103,3 +1118,4 @@ static void quirk_usb_early_handoff(stru
  }
  DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
  			PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff);

+ 1 - 1
target/linux/ramips/Makefile

@@ -10,7 +10,7 @@ ARCH:=mipsel
 BOARD:=ramips
 BOARDNAME:=MediaTek Ralink MIPS
 SUBTARGETS:=rt305x mt7620 mt7621 mt7628 mt7688 rt3883 rt288x
-FEATURES:=squashfs gpio mips16
+FEATURES:=squashfs gpio
 MAINTAINER:=John Crispin <john@phrozen.org>
 
 KERNEL_PATCHVER:=4.4

+ 9 - 6
target/linux/ramips/base-files/etc/board.d/01_leds

@@ -90,7 +90,6 @@ c20i)
 	ucidef_set_led_wlan "wlan" "wlan" "$board:blue:wlan" "phy0radio"
 	;;
 c50)
-	ucidef_set_led_default "power" "power" "$board:green:power" "0"
 	ucidef_set_led_switch "lan" "lan" "$board:green:lan" "switch0" "0x1e"
 	ucidef_set_led_switch "wan" "wan" "$board:green:wan" "switch0" "0x01"
 	set_usb_led "$board:green:usb"
@@ -109,6 +108,10 @@ d105)
 	ucidef_set_led_default "power" "POWER" "$board:red:power" "1"
 	set_usb_led "$board:green:usb"
 	;;
+d240)
+	set_wifi_led "$board:blue:wifi"
+	set_usb_led "$board:blue:usb"
+	;;
 db-wrt01)
 	ucidef_set_led_default "power" "power" "$board:orange:power" "1"
 	;;
@@ -155,7 +158,8 @@ vr500)
 dir-860l-b1)
 	ucidef_set_led_netdev "wan" "wan" "$board:green:net" "eth0.2"
 	;;
-ex2700)
+ex2700|\
+wn3000rpv3)
 	ucidef_set_led_default "power_r" "POWER (red)" "$board:red:power" "0"
 	set_wifi_led "$board:green:router"
 	;;
@@ -171,10 +175,6 @@ fonera20n)
 	set_usb_led "$board:orange:usb"
 	set_wifi_led "$board:orange:wifi"
 	;;
-gb-pc1)
-	ucidef_set_led_netdev "lan" "lan" "$board:green:lan" "eth0.1"
-	ucidef_set_led_netdev "wan" "wan" "$board:green:wan" "eth0.2"
-	;;
 gl-mt300a|\
 gl-mt300n|\
 gl-mt750)
@@ -315,6 +315,9 @@ vocore)
 	ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0"
 	set_wifi_led "$board:green:status"
 	;;
+vocore2)
+	set_wifi_led "$board:fuchsia:status"
+	;;
 w502u)
 	set_usb_led "$board:blue:usb"
 	set_wifi_led "rt2800pci-phy0::radio"

+ 34 - 10
target/linux/ramips/base-files/etc/board.d/02_network

@@ -53,6 +53,8 @@ ramips_setup_interfaces()
 	microwrt|\
 	mpr-a2|\
 	ncs601w|\
+	omega2 | \
+	omega2p | \
 	timecloud|\
 	w150m|\
 	widora-neo|\
@@ -70,12 +72,12 @@ ramips_setup_interfaces()
 	3g-6200n|\
 	ac1200pro|\
 	ai-br100|\
+	d240|\
 	db-wrt01|\
 	dir-300-b7|\
 	dir-320-b1|\
 	dir-610-a1|\
 	dir-615-h1|\
-	gb-pc1|\
 	firewrt|\
 	hlk-rm04|\
 	mac1200rv2|\
@@ -123,7 +125,6 @@ ramips_setup_interfaces()
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
 		;;
 	asl26555|\
-	re6500|\
 	rp-n53)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
@@ -132,9 +133,7 @@ ramips_setup_interfaces()
 	awm002-evb|\
 	awm003-evb|\
 	c20i|\
-	c50|\
 	dir-645|\
-	dir-860l-b1|\
 	f5d8235-v2|\
 	gl-mt300a|\
 	gl-mt300n|\
@@ -192,9 +191,18 @@ ramips_setup_interfaces()
 	pbr-d1|\
 	wli-tx4-ag300n|\
 	wmr-300|\
+	wn3000rpv3|\
 	wrh-300cr)
 		ucidef_set_interface_lan "eth0"
 		;;
+	c50)
+		ucidef_add_switch "switch0" \
+			"1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
+		;;
+	dir-860l-b1)
+		ucidef_add_switch "switch0" \
+			"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
+		;;
 	duzun-dm06)
 		ucidef_add_switch "switch0" \
 			"1:lan" "0:wan" "6@eth0"
@@ -211,7 +219,7 @@ ramips_setup_interfaces()
 		;;
 	kn_rc|\
 	kn_rf)
-		ucidef_add_switch "switch" \
+		ucidef_add_switch "switch0" \
 			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
 		;;
 	kng_rc)
@@ -234,11 +242,12 @@ ramips_setup_interfaces()
 			"0:lan" "4:lan" "6t@eth0"
 		;;
 	newifi-d1)
-		ucidef_set_interface_lan_wan "eth0.1" "eth0.2"
 		ucidef_add_switch "switch0" \
-			"0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6t@eth0" "7t@eth0"
-		ucidef_add_switch "switch1" \
-			"4:lan" "6t@eth0" "7t@eth0"
+		"1:lan:2" "2:lan:1" "4:wan" "6@eth0"
+		;;
+	re6500)
+		ucidef_add_switch "switch0" \
+			"0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "6@eth0"
 		;;
 	rt-n56u)
 		ucidef_add_switch "switch0" \
@@ -250,6 +259,10 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
 		;;
+	vocore2)
+		ucidef_add_switch "switch0" \
+			"0:lan" "2:lan" "6t@eth0"
+		;;
 	f5d8235-v1|\
 	tew-714tru|\
 	v11st-fe|\
@@ -340,8 +353,10 @@ ramips_setup_macs()
 		[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
 		wan_mac=$(macaddr_add "$lan_mac" 1)
 		;;
+	kn_rc|\
+	kn_rf|\
 	kng_rc)
-		wan_mac=$(mtd_get_mac_binary factory 28)
+		wan_mac=$(mtd_get_mac_binary factory 40)
 		;;
 	linkits7688 | \
 	linkits7688d)
@@ -352,6 +367,10 @@ ramips_setup_macs()
 		lan_mac=$(mtd_get_mac_binary factory_info 13)
 		wan_mac=$(macaddr_add "$lan_mac" 1)
 		;;
+	miwifi-mini)
+		wan_mac=$(cat /sys/class/net/eth0/address)
+		lan_mac=$(macaddr_setbit_la "$wan_mac")
+		;;
 	m3|\
 	m4|\
 	x5|\
@@ -363,6 +382,11 @@ ramips_setup_macs()
 		lan_mac=$(cat /sys/class/net/eth0/address)
 		lan_mac=$(macaddr_add "$lan_mac" 2)
 		;;
+	omega2|\
+	omega2p)
+		wan_mac=$(mtd_get_mac_binary factory 4)
+		lan_mac=$(mtd_get_mac_binary factory 46)
+		;;
 	oy-0001)
 		lan_mac=$(mtd_get_mac_binary factory 40)
 		wan_mac=$(mtd_get_mac_binary factory 46)

+ 11 - 2
target/linux/ramips/base-files/etc/diag.sh

@@ -24,6 +24,7 @@ get_status_led() {
 	dir-860l-b1|\
 	e1700|\
 	fonera20n|\
+	hg255d|\
 	kn_rc|\
 	kn_rf|\
 	kng_rc|\
@@ -53,7 +54,8 @@ get_status_led() {
 	jhr-n825r|\
 	mpr-a1|\
 	mpr-a2|\
-	mzk-ex750np)
+	mzk-ex750np|\
+	wn3000rpv3)
 		status_led="$board:red:power"
 		;;
 	ac1200pro|\
@@ -69,7 +71,6 @@ get_status_led() {
 	dir-620-a1|\
 	dir-620-d1|\
 	dwr-512-b|\
-	gb-pc1|\
 	hpm|\
 	hw550-3g|\
 	mac1200rv2|\
@@ -108,6 +109,7 @@ get_status_led() {
 	w502u)
 		status_led="$board:blue:wps"
 		;;
+	d240|\
 	dap-1350|\
 	na930|\
 	pbr-m1|\
@@ -173,6 +175,10 @@ get_status_led() {
 	newifi-d1)
 		status_led="$board:blue:status"
 		;;
+	omega2| \
+	omega2p)
+		status_led="$board:amber:system"
+		;;
 	oy-0001|\
 	sl-r7205|\
 	zbt-we826)
@@ -207,6 +213,9 @@ get_status_led() {
 	v22rw-2x2)
 		status_led="$board:green:security"
 		;;
+	vocore2)
+		status_led="$board:fuchsia:status"
+		;;
 	w306r-v20|\
 	witi|\
 	zbt-wr8305rt)

+ 16 - 4
target/linux/ramips/base-files/lib/ramips.sh

@@ -112,6 +112,9 @@ ramips_board_detect() {
 	*"D105")
 		name="d105"
 		;;
+	*"D240")
+		name="d240"
+		;;
 	*"DAP-1350")
 		name="dap-1350"
 		;;
@@ -202,9 +205,6 @@ ramips_board_detect() {
 	*"FreeStation5")
 		name="freestation5"
 		;;
-	*"GB-PC1")
-		name="gb-pc1"
-		;;
 	*"GL-MT300A")
 		name="gl-mt300a"
 		;;
@@ -272,7 +272,7 @@ ramips_board_detect() {
 		name="m2m"
 		;;
 	*"Mercury MAC1200R v2")
-		name="mac1200r-v2"
+		name="mac1200rv2"
 		;;
 	*"MicroWRT")
 		name="microwrt"
@@ -367,6 +367,12 @@ ramips_board_detect() {
 	*"NW718")
 		name="nw718"
 		;;
+	*"Onion Omega2")
+		name="omega2"
+		;;
+	*"Onion Omega2+")
+		name="omega2p"
+		;;
 	*"OY-0001")
 		name="oy-0001"
 		;;
@@ -478,6 +484,9 @@ ramips_board_detect() {
 	*"VoCore (16M)")
 		name="vocore-16M"
 		;;
+	*"VoCore2")
+		name="vocore2"
+		;;
 	*"VR500")
 		name="vr500"
 		;;
@@ -547,6 +556,9 @@ ramips_board_detect() {
 	*"WMR-300")
 		name="wmr-300"
 		;;
+	*"WN3000RPv3")
+		name="wn3000rpv3"
+		;;
 	*"WNCE2001")
 		name="wnce2001"
 		;;

+ 5 - 1
target/linux/ramips/base-files/lib/upgrade/platform.sh

@@ -35,6 +35,7 @@ platform_check_image() {
 	cf-wr800n|\
 	cs-qr10|\
 	d105|\
+	d240|\
 	dap-1350|\
 	db-wrt01|\
 	dcs-930|\
@@ -57,7 +58,6 @@ platform_check_image() {
 	firewrt|\
 	fonera20n|\
 	freestation5|\
-	gb-pc1|\
 	gl-mt300a|\
 	gl-mt300n|\
 	gl-mt750|\
@@ -103,6 +103,8 @@ platform_check_image() {
 	newifi-d1|\
 	nixcore|\
 	nw718|\
+	omega2|\
+	omega2p|\
 	oy-0001|\
 	pbr-d1|\
 	pbr-m1|\
@@ -134,6 +136,7 @@ platform_check_image() {
 	ur-336un|\
 	v22rw-2x2|\
 	vocore|\
+	vocore2|\
 	vr500|\
 	w150m|\
 	w2914nsv2|\
@@ -155,6 +158,7 @@ platform_check_image() {
 	wli-tx4-ag300n|\
 	wlr-6000|\
 	wmr-300|\
+	wn3000rpv3|\
 	wnce2001|\
 	wndr3700v5|\
 	wr512-3gn|\

+ 1 - 0
target/linux/ramips/base-files/sbin/fixup-mac-address

@@ -1,6 +1,7 @@
 #!/bin/sh
 . /lib/functions.sh
 . /lib/functions/system.sh
+. /lib/ramips.sh
 
 partname=""
 offset=""

+ 0 - 1
target/linux/ramips/dts/3G150B.dts

@@ -55,7 +55,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25fl064k";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/3G300M.dts

@@ -70,7 +70,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/A5-V11.dts

@@ -61,7 +61,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "pm25lq032";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/AI-BR100.dts

@@ -52,7 +52,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0 0>;
-		linux,modalias = "m25p80", "en25q64";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/AIR3GII.dts

@@ -48,7 +48,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "en25q32b";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ALL0256N-4M.dts

@@ -53,7 +53,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ALL0256N-8M.dts

@@ -53,7 +53,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ALL5002.dts

@@ -54,7 +54,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l25635e";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ALL5003.dts

@@ -54,7 +54,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l25635e";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ASL26555-16M.dts

@@ -84,7 +84,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25sl12801";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/ASL26555-8M.dts

@@ -84,7 +84,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "s25sl064p";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/AWAPN2403.dts

@@ -39,7 +39,6 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		linux,modalias = "m25p80", "mx25l3205d";
 		spi-max-frequency = <10000000>;
 
 		partition@0 {

+ 0 - 1
target/linux/ramips/dts/AWM002-4M.dtsi

@@ -7,5 +7,4 @@
 
 &m25p80 {
 	compatible = "jedec,spi-nor";
-	linux,modalias = "m25p80", "mx25l3205d";
 };

+ 0 - 1
target/linux/ramips/dts/AWM002-8M.dtsi

@@ -7,5 +7,4 @@
 
 &m25p80 {
 	compatible = "jedec,spi-nor";
-	linux,modalias = "m25p80", "mx25l6405d";
 };

Some files were not shown because too many files changed in this diff