From 860a5d1e6a270f74db8696ba382c0f4fb5b81695 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 19:42:46 -0800 Subject: [PATCH 01/10] Revert "luci-app-ssr-plus:ssr-ad separate control use (#3592)" This reverts commit 84bf3aadcd77ce722a28aca49fb8c59661f69561. --- .../luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 95e81ca6a9..9a1023beb9 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -524,9 +524,6 @@ start() { conf-dir=/tmp/dnsmasq.oversea EOF fi - if [ -e "/tmp/dnsmasq.d/ad.conf" ]; then - rm -f /tmp/dnsmasq.d/ad.conf - fi if [ $(uci_get_by_type global adblock 0) == "0" ]; then rm -f /tmp/dnsmasq.ssr/ad.conf fi @@ -582,14 +579,9 @@ stop() { else kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 fi - if [ $(uci_get_by_type global adblock 0) == "0" ]; then - rm -f /tmp/dnsmasq.d/ad.conf - else - cp -f /etc/dnsmasq.ssr/ad.conf /tmp/dnsmasq.d/ad.conf - fi if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf + /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi - /etc/init.d/dnsmasq restart >/dev/null 2>&1 del_cron } From 174fb41716773d1abad766b82448c5672f489111 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 19:46:43 -0800 Subject: [PATCH 02/10] luci-app-ssr-plus:disable ipv6 to fix upd relay --- package/lean/default-settings/Makefile | 2 +- package/lean/default-settings/files/zzz-default-settings | 2 +- package/lean/luci-app-ssr-plus/Makefile | 4 ++-- .../lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package/lean/default-settings/Makefile b/package/lean/default-settings/Makefile index 2740bed3a0..25da54c5ce 100644 --- a/package/lean/default-settings/Makefile +++ b/package/lean/default-settings/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=default-settings PKG_VERSION:=1.1 -PKG_RELEASE:=52 +PKG_RELEASE:=53 PKG_LICENSE:=GPLv3 PKG_LICENSE_FILES:=LICENSE diff --git a/package/lean/default-settings/files/zzz-default-settings b/package/lean/default-settings/files/zzz-default-settings index 0f71938e60..23c92cd4ab 100755 --- a/package/lean/default-settings/files/zzz-default-settings +++ b/package/lean/default-settings/files/zzz-default-settings @@ -43,7 +43,7 @@ sed -i '/option disabled/d' /etc/config/wireless sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release -echo "DISTRIB_REVISION='R20.3.5'" >> /etc/openwrt_release +echo "DISTRIB_REVISION='R20.3.8'" >> /etc/openwrt_release sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index abe9880cb0..b2606b1541 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus -PKG_VERSION:=163 -PKG_RELEASE:=6 +PKG_VERSION:=164 +PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 9a1023beb9..b7d13350a0 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -90,7 +90,7 @@ gen_config_file() { { "server": "$hostip", "server_port": $(uci_get_by_name $1 server_port), - "local_address": "::", + "local_address": "0.0.0.0", "local_port": $(uci_get_by_name $1 local_port), "password": "$(uci_get_by_name $1 password)", "timeout": $(uci_get_by_name $1 timeout 60), @@ -111,7 +111,7 @@ gen_config_file() { { "server": "$hostip", "server_port": $(uci_get_by_name $1 server_port), - "local_address": "::", + "local_address": "0.0.0.0", "local_port": $(uci_get_by_name $1 local_port), "password": "$(uci_get_by_name $1 password)", "timeout": $(uci_get_by_name $1 timeout 60), @@ -360,7 +360,7 @@ start_redir() { lua /usr/share/shadowsocksr/gentrojanconfig.lua $GLOBAL_SERVER client 10801 >/var/etc/trojan-ssr-reudp.json sed -i 's/\\//g' /var/etc/trojan-ssr-reudp.json $ucmd --config /var/etc/trojan-ssr-reudp.json >/dev/null 2>&1 & - ipt2socks -U -b 0.0.0.0 -B :: -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 & + ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 & elif [ "$utype" == "socks5" ]; then /usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) $(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \ $(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0) $(uci_get_by_name $UDP_RELAY_SERVER username) $(uci_get_by_name $UDP_RELAY_SERVER password) @@ -412,7 +412,7 @@ gen_service_file() { fi cat <<-EOF >$2 { - "server": "::", + "server": "0.0.0.0", "server_port": $(uci_get_by_name $1 server_port), "password": "$(uci_get_by_name $1 password)", "timeout": $(uci_get_by_name $1 timeout 60), From 3cf2d8b1a4a222fa9af91cd3d0db2563783d727e Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 19:49:53 -0800 Subject: [PATCH 03/10] adbyby: add aarch64 arm 64bit support --- package/lean/adbyby/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package/lean/adbyby/Makefile b/package/lean/adbyby/Makefile index 20b9b8d448..5082ed88af 100644 --- a/package/lean/adbyby/Makefile +++ b/package/lean/adbyby/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adbyby PKG_VERSION:=2.7 -PKG_RELEASE:=20200307 +PKG_RELEASE:=20200308 include $(INCLUDE_DIR)/package.mk @@ -16,7 +16,7 @@ define Package/$(PKG_NAME) SECTION:=net CATEGORY:=Network TITLE:=Powerful adblock module to block ad. - DEPENDS:=@(x86||x86_64||arm||mipsel||mips) + DEPENDS:=@(x86||x86_64||arm||mipsel||mips||aarch64) URL:=http://www.adbyby.com/ endef @@ -45,6 +45,9 @@ ifeq ($(ARCH),arm) ADBYBY_DIR:=arm endif endif +ifeq ($(ARCH),aarch64) + ADBYBY_DIR:=armv7 +endif define Build/Prepare endef From 46c9581a5fb41716e0ba4dccccd924f6095921b9 Mon Sep 17 00:00:00 2001 From: CN_SZTL <22235437+1715173329@users.noreply.github.com> Date: Sun, 8 Mar 2020 11:55:50 +0800 Subject: [PATCH 04/10] ppp: bump to 2.4.8 (#3644) - openwrt/openwrt@983605e pppd: update to 2.4.8 - openwrt/openwrt@3589051 ppp: backport security fixes - openwrt/openwrt@2c3c83e ppp: activate PIE ASLR by default Signed-off-by: CN_SZTL --- package/network/services/ppp/Makefile | 54 ++-- package/network/services/ppp/files/ppp.sh | 13 +- .../ppp/patches/001-honor-ldflags.patch | 39 --- .../ppp/patches/100-debian_ip-ip_option.patch | 22 +- .../patches/101-debian_close_dev_ppp.patch | 2 +- .../patches/103-debian_fix_link_pidfile.patch | 2 +- .../ppp/patches/105-debian_demand.patch | 14 +- .../ppp/patches/110-debian_defaultroute.patch | 65 ++--- .../120-debian_ipv6_updown_option.patch | 18 +- .../121-debian_adaptive_lcp_echo.patch | 8 +- .../services/ppp/patches/130-no_cdefs_h.patch | 11 - .../patches/131-missing_prototype_macro.patch | 23 -- .../ppp/patches/132-fix_linux_includes.patch | 40 --- .../ppp/patches/133-fix_sha1_include.patch | 4 +- .../ppp/patches/140-pppoe_compile_fix.patch | 53 +--- .../services/ppp/patches/200-makefile.patch | 12 +- .../ppp/patches/201-mppe_mppc_1.1.patch | 26 +- .../services/ppp/patches/202-no_strip.patch | 4 +- .../services/ppp/patches/203-opt_flags.patch | 23 +- .../ppp/patches/204-radius_config.patch | 2 +- .../patches/205-no_exponential_timeout.patch | 4 +- .../patches/206-compensate_time_change.patch | 12 +- .../ppp/patches/207-lcp_mtu_max.patch | 2 +- .../ppp/patches/208-fix_status_code.patch | 2 +- .../300-filter-pcap-includes-lib.patch | 2 +- .../ppp/patches/310-precompile_filter.patch | 8 +- .../ppp/patches/320-custom_iface_names.patch | 135 --------- ...multilink_support_custom_iface_names.patch | 22 +- .../330-retain_foreign_default_routes.patch | 2 +- .../340-populate_default_gateway.patch | 6 +- .../patches/400-simplify_kernel_checks.patch | 20 +- .../ppp/patches/401-no_record_file.patch | 6 +- .../services/ppp/patches/403-no_wtmp.patch | 4 +- .../404-remove_obsolete_protocol_names.patch | 16 +- .../ppp/patches/405-no_multilink_option.patch | 2 +- .../services/ppp/patches/511-syncppp.patch | 59 ++-- .../services/ppp/patches/520-uniq.patch | 269 ------------------ .../ppp/patches/530-pppoe_send_padt.patch | 11 - .../531-pppoe_no_disconnect_warning.patch | 14 - .../patches/540-save-pppol2tp_fd_str.patch | 6 +- .../ppp/patches/550-fix-printer-args.patch | 11 - ...openssl-for-the-DES-instead-of-the-l.patch | 94 ++++++ ...-Prevent-buffer-overflow-in-rc_mksid.patch | 30 ++ ...01-pppd-Fix-bounds-check-in-EAP-code.patch | 37 +++ ...ived-EAP-messages-when-not-doing-EAP.patch | 61 ++++ 45 files changed, 461 insertions(+), 809 deletions(-) delete mode 100644 package/network/services/ppp/patches/001-honor-ldflags.patch delete mode 100644 package/network/services/ppp/patches/130-no_cdefs_h.patch delete mode 100644 package/network/services/ppp/patches/131-missing_prototype_macro.patch delete mode 100644 package/network/services/ppp/patches/132-fix_linux_includes.patch delete mode 100644 package/network/services/ppp/patches/320-custom_iface_names.patch delete mode 100644 package/network/services/ppp/patches/520-uniq.patch delete mode 100644 package/network/services/ppp/patches/530-pppoe_send_padt.patch delete mode 100644 package/network/services/ppp/patches/531-pppoe_no_disconnect_warning.patch delete mode 100644 package/network/services/ppp/patches/550-fix-printer-args.patch create mode 100644 package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch create mode 100644 package/network/services/ppp/patches/700-radius-Prevent-buffer-overflow-in-rc_mksid.patch create mode 100644 package/network/services/ppp/patches/701-pppd-Fix-bounds-check-in-EAP-code.patch create mode 100644 package/network/services/ppp/patches/702-pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 0a4551c76d..421ca10218 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -9,20 +9,22 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_VERSION:=2.4.7 -PKG_RELEASE:=15 +PKG_RELEASE:=3 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/ -PKG_HASH:=02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/paulusmack/ppp +PKG_SOURCE_VERSION:=78cd384ce0f48bb5edb84e4fe9a574eab4a4ad14 +PKG_MIRROR_HASH:=cf284c312b0c90974d11f8aeece173bcac8475f5b810911f4feb2c5a4db263fe PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause PKG_CPE_ID:=cpe:/a:samba:ppp -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_RELEASE_VERSION:=2.4.8 +PKG_VERSION:=$(PKG_RELEASE_VERSION) PKG_BUILD_DEPENDS:=libpcap +PKG_ASLR_PIE_REGULAR:=1 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -36,7 +38,7 @@ endef define Package/ppp $(call Package/ppp/Default) - DEPENDS:=+kmod-ppp +kmod-mppe +libpthread +shellsync + DEPENDS:=+kmod-ppp +libpthread +shellsync TITLE:=PPP daemon VARIANT:=default endef @@ -215,7 +217,7 @@ define Package/ppp/script_install endef define Package/ppp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/ppp @@ -232,21 +234,21 @@ endef Package/ppp-multilink/install=$(Package/ppp/install) define Package/ppp-mod-pppoa/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/pppoatm.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoatm.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ endef define Package/ppp-mod-pppoe/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/rp-pppoe.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ endef define Package/ppp-mod-radius/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/radius.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/radius.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/ $(INSTALL_DIR) $(1)/etc/ppp/radius @@ -257,23 +259,23 @@ define Package/ppp-mod-radius/install endef define Package/ppp-mod-pppol2tp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/pppol2tp.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppol2tp.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ endef define Package/ppp-mod-pptp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/pptp.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pptp.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/options.pptp $(1)/etc/ppp/ endef define Package/ppp-mod-passwordfd/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_VERSION)/passwordfd.so \ - $(1)/usr/lib/pppd/$(PKG_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/passwordfd.so \ + $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ endef define Package/chat/install diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index b56b83c72d..0fe29993e3 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -89,6 +89,7 @@ ppp_generic_setup() { local localip json_get_vars ipv6 ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns + if [ "$ipv6" = 0 ]; then ipv6="" elif [ -z "$ipv6" -o "$ipv6" = auto ]; then @@ -207,6 +208,9 @@ proto_pppoe_init_config() { proto_config_add_string "ac" proto_config_add_string "service" proto_config_add_string "host_uniq" + proto_config_add_int "padi_attempts" + proto_config_add_int "padi_timeout" + lasterror=1 } @@ -224,20 +228,25 @@ proto_pppoe_setup() { json_get_var ac ac json_get_var service service json_get_var host_uniq host_uniq + json_get_var padi_attempts padi_attempts + json_get_var padi_timeout padi_timeout -#By 蝈蝈:并发拨号同步的前期准备 +#By 铦堣潏锛氬苟鍙戞嫧鍙峰悓姝ョ殑鍓嶆湡鍑嗗 syncppp_option="" [ "$(uci get syncdial.config.enabled)" == "1" ] && { ppp_if_cnt=$(cat /etc/config/network | grep -c "proto 'pppoe'") syncppp_option="syncppp $ppp_if_cnt" shellsync $ppp_if_cnt 10 } - ppp_generic_setup "$config" \ + + ppp_generic_setup "$config" \ $syncppp_option \ plugin rp-pppoe.so \ ${ac:+rp_pppoe_ac "$ac"} \ ${service:+rp_pppoe_service "$service"} \ ${host_uniq:+host-uniq "$host_uniq"} \ + ${padi_attempts:+pppoe-padi-attempts $padi_attempts} \ + ${padi_timeout:+pppoe-padi-timeout $padi_timeout} \ "nic-$iface" } diff --git a/package/network/services/ppp/patches/001-honor-ldflags.patch b/package/network/services/ppp/patches/001-honor-ldflags.patch deleted file mode 100644 index fae66a5ec7..0000000000 --- a/package/network/services/ppp/patches/001-honor-ldflags.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/pppd/plugins/radius/Makefile.linux -+++ b/pppd/plugins/radius/Makefile.linux -@@ -43,13 +43,13 @@ install: all - $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) - - radius.so: radius.o libradiusclient.a -- $(CC) -o radius.so -shared radius.o libradiusclient.a -+ $(CC) $(CFLAGS) -o radius.so -shared radius.o libradiusclient.a - - radattr.so: radattr.o -- $(CC) -o radattr.so -shared radattr.o -+ $(CC) $(CFLAGS) -o radattr.so -shared radattr.o - - radrealms.so: radrealms.o -- $(CC) -o radrealms.so -shared radrealms.o -+ $(CC) $(CFLAGS) -o radrealms.so -shared radrealms.o - - CLIENTOBJS = avpair.o buildreq.o config.o dict.o ip_util.o \ - clientid.o sendserver.o lock.o util.o md5.o ---- a/pppd/plugins/rp-pppoe/Makefile.linux -+++ b/pppd/plugins/rp-pppoe/Makefile.linux -@@ -30,7 +30,7 @@ CFLAGS=$(COPTS) -I../../../include '-DRP - all: rp-pppoe.so pppoe-discovery - - pppoe-discovery: pppoe-discovery.o debug.o -- $(CC) -o pppoe-discovery pppoe-discovery.o debug.o -+ $(CC) $(CFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o - - pppoe-discovery.o: pppoe-discovery.c - $(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c -@@ -39,7 +39,7 @@ debug.o: debug.c - $(CC) $(CFLAGS) -c -o debug.o debug.c - - rp-pppoe.so: plugin.o discovery.o if.o common.o -- $(CC) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o -+ $(CC) $(CFLAGS) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/package/network/services/ppp/patches/100-debian_ip-ip_option.patch b/package/network/services/ppp/patches/100-debian_ip-ip_option.patch index 703311fb47..335ce72b0a 100644 --- a/package/network/services/ppp/patches/100-debian_ip-ip_option.patch +++ b/package/network/services/ppp/patches/100-debian_ip-ip_option.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/ipcp.c +++ b/pppd/ipcp.c -@@ -1958,7 +1958,7 @@ ipcp_up(f) +@@ -1957,7 +1957,7 @@ ipcp_up(f) */ if (ipcp_script_state == s_down && ipcp_script_pid == 0) { ipcp_script_state = s_up; @@ -21,7 +21,7 @@ Signed-off-by: Jo-Philipp Wich } } -@@ -2008,7 +2008,7 @@ ipcp_down(f) +@@ -2007,7 +2007,7 @@ ipcp_down(f) /* Execute the ip-down script */ if (ipcp_script_state == s_up && ipcp_script_pid == 0) { ipcp_script_state = s_down; @@ -30,7 +30,7 @@ Signed-off-by: Jo-Philipp Wich } } -@@ -2062,13 +2062,13 @@ ipcp_script_done(arg) +@@ -2061,13 +2061,13 @@ ipcp_script_done(arg) case s_up: if (ipcp_fsm[0].state != OPENED) { ipcp_script_state = s_down; @@ -48,7 +48,7 @@ Signed-off-by: Jo-Philipp Wich } --- a/pppd/main.c +++ b/pppd/main.c -@@ -316,6 +316,9 @@ main(argc, argv) +@@ -306,6 +306,9 @@ main(argc, argv) struct protent *protp; char numbuf[16]; @@ -60,18 +60,18 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/options.c +++ b/pppd/options.c -@@ -114,6 +114,8 @@ char linkname[MAXPATHLEN]; /* logical na - bool tune_kernel; /* may alter kernel settings */ +@@ -117,6 +117,8 @@ bool tune_kernel; /* may alter kernel s int connect_delay = 1000; /* wait this many ms after connect script */ int req_unit = -1; /* requested interface unit */ + char req_ifname[MAXIFNAMELEN]; /* requested interface name */ +char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ +char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ bool multilink = 0; /* Enable multilink operation */ char *bundle_name = NULL; /* bundle name for multilink */ bool dump_options; /* print out option values */ -@@ -299,6 +301,13 @@ option_t general_options[] = { - "Unset user environment variable", - OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint }, +@@ -316,6 +318,13 @@ option_t general_options[] = { + "Metric to use for the default route (Linux only; -1 for default behavior)", + OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 }, + { "ip-up-script", o_string, path_ipup, + "Set pathname of ip-up script", @@ -85,10 +85,10 @@ Signed-off-by: Jo-Philipp Wich "Enable multilink operation", OPT_PRIO | 1 }, --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -318,6 +318,8 @@ extern bool tune_kernel; /* May alter ke - extern int connect_delay; /* Time to delay after connect script */ +@@ -334,6 +334,8 @@ extern int connect_delay; /* Time to del extern int max_data_rate; /* max bytes/sec through charshunt */ extern int req_unit; /* interface unit number to use */ + extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ +extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ +extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ extern bool multilink; /* enable multilink operation */ diff --git a/package/network/services/ppp/patches/101-debian_close_dev_ppp.patch b/package/network/services/ppp/patches/101-debian_close_dev_ppp.patch index 629c232543..62830179b6 100644 --- a/package/network/services/ppp/patches/101-debian_close_dev_ppp.patch +++ b/package/network/services/ppp/patches/101-debian_close_dev_ppp.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -458,6 +458,13 @@ int generic_establish_ppp (int fd) +@@ -467,6 +467,13 @@ int generic_establish_ppp (int fd) if (new_style_driver) { int flags; diff --git a/package/network/services/ppp/patches/103-debian_fix_link_pidfile.patch b/package/network/services/ppp/patches/103-debian_fix_link_pidfile.patch index d5d5851d47..5a764ab9b2 100644 --- a/package/network/services/ppp/patches/103-debian_fix_link_pidfile.patch +++ b/package/network/services/ppp/patches/103-debian_fix_link_pidfile.patch @@ -11,7 +11,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -773,8 +773,7 @@ detach() +@@ -780,8 +780,7 @@ detach() /* update pid files if they have been written already */ if (pidfilename[0]) create_pidfile(pid); diff --git a/package/network/services/ppp/patches/105-debian_demand.patch b/package/network/services/ppp/patches/105-debian_demand.patch index 2502d49689..c68bafa8df 100644 --- a/package/network/services/ppp/patches/105-debian_demand.patch +++ b/package/network/services/ppp/patches/105-debian_demand.patch @@ -18,7 +18,7 @@ #ifdef PPP_FILTER #include #endif -@@ -221,6 +225,14 @@ loop_chars(p, n) +@@ -220,6 +224,14 @@ loop_chars(p, n) int c, rv; rv = 0; @@ -33,7 +33,7 @@ for (; n > 0; --n) { c = *p++; if (c == PPP_FLAG) { -@@ -299,17 +311,102 @@ loop_frame(frame, len) +@@ -298,17 +310,102 @@ loop_frame(frame, len) * loopback, now that the real serial link is up. */ void @@ -139,7 +139,7 @@ } else { --- a/pppd/ipcp.c +++ b/pppd/ipcp.c -@@ -1883,7 +1883,7 @@ ipcp_up(f) +@@ -1882,7 +1882,7 @@ ipcp_up(f) proxy_arp_set[f->unit] = 1; } @@ -150,9 +150,9 @@ } else { --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c -@@ -1232,7 +1232,7 @@ ipv6cp_up(f) - } - +@@ -1252,7 +1252,7 @@ ipv6cp_up(f) + if (sif6defaultroute(f->unit, go->ourid, ho->hisid)) + default_route_set[f->unit] = 1; } - demand_rexmit(PPP_IPV6); + demand_rexmit(PPP_IPV6,0); @@ -161,7 +161,7 @@ } else { --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -585,7 +585,7 @@ void demand_conf __P((void)); /* config +@@ -601,7 +601,7 @@ void demand_conf __P((void)); /* config void demand_block __P((void)); /* set all NPs to queue up packets */ void demand_unblock __P((void)); /* set all NPs to pass packets */ void demand_discard __P((void)); /* set all NPs to discard packets */ diff --git a/package/network/services/ppp/patches/110-debian_defaultroute.patch b/package/network/services/ppp/patches/110-debian_defaultroute.patch index 1005c59ab5..38739a5243 100644 --- a/package/network/services/ppp/patches/110-debian_defaultroute.patch +++ b/package/network/services/ppp/patches/110-debian_defaultroute.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/ipcp.c +++ b/pppd/ipcp.c -@@ -198,6 +198,14 @@ static option_t ipcp_option_list[] = { +@@ -197,6 +197,14 @@ static option_t ipcp_option_list[] = { "disable defaultroute option", OPT_ALIAS | OPT_A2CLR, &ipcp_wantoptions[0].default_route }, @@ -27,7 +27,7 @@ Signed-off-by: Jo-Philipp Wich { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, -@@ -271,7 +279,7 @@ struct protent ipcp_protent = { +@@ -270,7 +278,7 @@ struct protent ipcp_protent = { ip_active_pkt }; @@ -36,7 +36,7 @@ Signed-off-by: Jo-Philipp Wich static void ipcp_script __P((char *, int)); /* Run an up/down script */ static void ipcp_script_done __P((void *)); -@@ -1761,7 +1769,8 @@ ip_demand_conf(u) +@@ -1760,7 +1768,8 @@ ip_demand_conf(u) if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) return 0; if (wo->default_route) @@ -46,7 +46,7 @@ Signed-off-by: Jo-Philipp Wich default_route_set[u] = 1; if (wo->proxy_arp) if (sifproxyarp(u, wo->hisaddr)) -@@ -1849,7 +1858,8 @@ ipcp_up(f) +@@ -1848,7 +1857,8 @@ ipcp_up(f) */ if (demand) { if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { @@ -56,7 +56,7 @@ Signed-off-by: Jo-Philipp Wich if (go->ouraddr != wo->ouraddr) { warn("Local IP address changed to %I", go->ouraddr); script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); -@@ -1874,7 +1884,8 @@ ipcp_up(f) +@@ -1873,7 +1883,8 @@ ipcp_up(f) /* assign a default route through the interface if required */ if (ipcp_wantoptions[f->unit].default_route) @@ -66,7 +66,7 @@ Signed-off-by: Jo-Philipp Wich default_route_set[f->unit] = 1; /* Make a proxy ARP entry if requested. */ -@@ -1924,7 +1935,8 @@ ipcp_up(f) +@@ -1923,7 +1934,8 @@ ipcp_up(f) /* assign a default route through the interface if required */ if (ipcp_wantoptions[f->unit].default_route) @@ -76,7 +76,7 @@ Signed-off-by: Jo-Philipp Wich default_route_set[f->unit] = 1; /* Make a proxy ARP entry if requested. */ -@@ -2002,7 +2014,7 @@ ipcp_down(f) +@@ -2001,7 +2013,7 @@ ipcp_down(f) sifnpmode(f->unit, PPP_IP, NPMODE_DROP); sifdown(f->unit); ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, @@ -85,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich } /* Execute the ip-down script */ -@@ -2018,16 +2030,25 @@ ipcp_down(f) +@@ -2017,16 +2029,25 @@ ipcp_down(f) * proxy arp entries, etc. */ static void @@ -125,9 +125,9 @@ Signed-off-by: Jo-Philipp Wich bool old_vj; /* use old (short) form of VJ option? */ --- a/pppd/pppd.8 +++ b/pppd/pppd.8 -@@ -121,6 +121,11 @@ the gateway, when IPCP negotiation is su +@@ -133,6 +133,11 @@ the gateway, when IPv6CP negotiation is This entry is removed when the PPP connection is broken. This option - is privileged if the \fInodefaultroute\fR option has been specified. + is privileged if the \fInodefaultroute6\fR option has been specified. .TP +.B replacedefaultroute +This option is a flag to the defaultroute option. If defaultroute is @@ -137,7 +137,7 @@ Signed-off-by: Jo-Philipp Wich .B disconnect \fIscript Execute the command specified by \fIscript\fR, by passing it to a shell, after -@@ -734,7 +739,12 @@ disable both forms of hardware flow cont +@@ -746,7 +751,12 @@ disable both forms of hardware flow cont .TP .B nodefaultroute Disable the \fIdefaultroute\fR option. The system administrator who @@ -150,10 +150,10 @@ Signed-off-by: Jo-Philipp Wich +wishes to prevent users from replacing a default route with pppd can do so by placing this option in the /etc/ppp/options file. .TP - .B nodeflate + .B nodefaultroute6 --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -667,7 +667,7 @@ int sif6addr __P((int, eui64_t, eui64_t +@@ -683,7 +683,7 @@ int sif6addr __P((int, eui64_t, eui64_t int cif6addr __P((int, eui64_t, eui64_t)); /* Remove an IPv6 address from i/f */ #endif @@ -164,16 +164,16 @@ Signed-off-by: Jo-Philipp Wich /* Delete default route through i/f */ --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -207,6 +207,8 @@ static unsigned char inbuf[512]; /* buff - static int if_is_up; /* Interface has been marked up */ +@@ -209,6 +209,8 @@ static int if_is_up; /* Interface has be static int if6_is_up; /* Interface has been marked up for IPv6, to help differentiate */ static int have_default_route; /* Gateway for default route added */ + static int have_default_route6; /* Gateway for default IPv6 route added */ +static struct rtentry old_def_rt; /* Old default route */ +static int default_rt_repl_rest; /* replace and restore old default rt */ static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */ static char proxy_arp_dev[16]; /* Device for proxy arp entry */ static u_int32_t our_old_addr; /* for detecting address changes */ -@@ -1552,6 +1554,9 @@ static int read_route_table(struct rtent +@@ -1577,6 +1579,9 @@ static int read_route_table(struct rtent p = NULL; } @@ -183,7 +183,7 @@ Signed-off-by: Jo-Philipp Wich SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16); SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16); SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16); -@@ -1621,20 +1626,51 @@ int have_route_to(u_int32_t addr) +@@ -1649,20 +1654,52 @@ int have_route_to(u_int32_t addr) /******************************************************************** * * sifdefaultroute - assign a default route through the address given. @@ -193,10 +193,10 @@ Signed-off-by: Jo-Philipp Wich -{ - struct rtentry rt; - -- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) { +- if (defaultroute_exists(&rt, dfl_route_metric) && strcmp(rt.rt_dev, ifname) != 0) { - if (rt.rt_flags & RTF_GATEWAY) -- error("not replacing existing default route via %I", -- SIN_ADDR(rt.rt_gateway)); +- error("not replacing existing default route via %I with metric %d", +- SIN_ADDR(rt.rt_gateway), dfl_route_metric); - else + * + * If the global default_rt_repl_rest flag is set, then this function @@ -218,16 +218,16 @@ Signed-off-by: Jo-Philipp Wich + are called again, we will delete the current default route + and set the new default route in this function. + - this is normally only the case the doing demand: */ -+ if (defaultroute_exists(&tmp_rt)) ++ if (defaultroute_exists(&tmp_rt, dfl_route_metric)) + del_rt = &tmp_rt; -+ } else if (defaultroute_exists(&old_def_rt) && ++ } else if (defaultroute_exists(&old_def_rt, dfl_route_metric) && + strcmp(old_def_rt.rt_dev, ifname) != 0) { + /* We did not yet replace an existing default route, let's + check if we should save and replace a default route: */ + if (old_def_rt.rt_flags & RTF_GATEWAY) { + if (!replace) { -+ error("not replacing existing default route via %I", -+ SIN_ADDR(old_def_rt.rt_gateway)); ++ error("not replacing existing default route via %I with metric %d", ++ SIN_ADDR(old_def_rt.rt_gateway), dfl_route_metric); + return 0; + } else { + /* we need to copy rt_dev because we need it permanent too: */ @@ -235,20 +235,21 @@ Signed-off-by: Jo-Philipp Wich + strcpy(tmp_dev, old_def_rt.rt_dev); + old_def_rt.rt_dev = tmp_dev; + -+ notice("replacing old default route to %s [%I]", -+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway)); ++ notice("replacing old default route to %s [%I] with metric %d", ++ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway), ++ dfl_route_metric); + default_rt_repl_rest = 1; + del_rt = &old_def_rt; + } + } else - error("not replacing existing default route through %s", -- rt.rt_dev); + error("not replacing existing default route through %s with metric %d", +- rt.rt_dev, dfl_route_metric); - return 0; -+ old_def_rt.rt_dev); ++ old_def_rt.rt_dev, dfl_route_metric); } memset (&rt, 0, sizeof (rt)); -@@ -1649,10 +1685,16 @@ int sifdefaultroute (int unit, u_int32_t +@@ -1678,10 +1715,16 @@ int sifdefaultroute (int unit, u_int32_t rt.rt_flags = RTF_UP; if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) { @@ -266,7 +267,7 @@ Signed-off-by: Jo-Philipp Wich have_default_route = 1; return 1; -@@ -1683,11 +1725,21 @@ int cifdefaultroute (int unit, u_int32_t +@@ -1715,11 +1758,21 @@ int cifdefaultroute (int unit, u_int32_t rt.rt_flags = RTF_UP; if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) { if (still_ppp()) { @@ -291,7 +292,7 @@ Signed-off-by: Jo-Philipp Wich } --- a/pppd/sys-solaris.c +++ b/pppd/sys-solaris.c -@@ -2039,12 +2039,18 @@ cifaddr(u, o, h) +@@ -2119,12 +2119,18 @@ cifaddr(u, o, h) * sifdefaultroute - assign a default route through the address given. */ int diff --git a/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch b/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch index a575df5f54..4a9ca7d5e7 100644 --- a/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch +++ b/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -318,6 +318,8 @@ main(argc, argv) +@@ -308,6 +308,8 @@ main(argc, argv) strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup)); strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown)); @@ -23,8 +23,8 @@ Signed-off-by: Jo-Philipp Wich new_phase(PHASE_INITIALIZE); --- a/pppd/options.c +++ b/pppd/options.c -@@ -116,6 +116,8 @@ int connect_delay = 1000; /* wait this m - int req_unit = -1; /* requested interface unit */ +@@ -119,6 +119,8 @@ int req_unit = -1; /* requested interfa + char req_ifname[MAXIFNAMELEN]; /* requested interface name */ char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ +char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ @@ -32,7 +32,7 @@ Signed-off-by: Jo-Philipp Wich bool multilink = 0; /* Enable multilink operation */ char *bundle_name = NULL; /* bundle name for multilink */ bool dump_options; /* print out option values */ -@@ -308,6 +310,13 @@ option_t general_options[] = { +@@ -325,6 +327,13 @@ option_t general_options[] = { "Set pathname of ip-down script", OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, @@ -48,7 +48,7 @@ Signed-off-by: Jo-Philipp Wich "Enable multilink operation", OPT_PRIO | 1 }, --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c -@@ -1269,7 +1269,7 @@ ipv6cp_up(f) +@@ -1294,7 +1294,7 @@ ipv6cp_up(f) */ if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) { ipv6cp_script_state = s_up; @@ -57,7 +57,7 @@ Signed-off-by: Jo-Philipp Wich } } -@@ -1321,7 +1321,7 @@ ipv6cp_down(f) +@@ -1346,7 +1346,7 @@ ipv6cp_down(f) /* Execute the ipv6-down script */ if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) { ipv6cp_script_state = s_down; @@ -66,7 +66,7 @@ Signed-off-by: Jo-Philipp Wich } } -@@ -1364,13 +1364,13 @@ ipv6cp_script_done(arg) +@@ -1389,13 +1389,13 @@ ipv6cp_script_done(arg) case s_up: if (ipv6cp_fsm[0].state != OPENED) { ipv6cp_script_state = s_down; @@ -84,8 +84,8 @@ Signed-off-by: Jo-Philipp Wich } --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -320,6 +320,8 @@ extern int max_data_rate; /* max bytes/s - extern int req_unit; /* interface unit number to use */ +@@ -336,6 +336,8 @@ extern int req_unit; /* interface unit n + extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ +extern char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ diff --git a/package/network/services/ppp/patches/121-debian_adaptive_lcp_echo.patch b/package/network/services/ppp/patches/121-debian_adaptive_lcp_echo.patch index b7a62406d0..510c96ba97 100644 --- a/package/network/services/ppp/patches/121-debian_adaptive_lcp_echo.patch +++ b/package/network/services/ppp/patches/121-debian_adaptive_lcp_echo.patch @@ -1,6 +1,6 @@ --- a/pppd/lcp.c +++ b/pppd/lcp.c -@@ -73,6 +73,7 @@ static void lcp_delayed_up __P((void *)) +@@ -72,6 +72,7 @@ static void lcp_delayed_up __P((void *)) */ int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ @@ -8,7 +8,7 @@ bool lax_recv = 0; /* accept control chars in asyncmap */ bool noendpoint = 0; /* don't send/accept endpoint discriminator */ -@@ -151,6 +152,8 @@ static option_t lcp_option_list[] = { +@@ -150,6 +151,8 @@ static option_t lcp_option_list[] = { OPT_PRIO }, { "lcp-echo-interval", o_int, &lcp_echo_interval, "Set time in seconds between LCP echo requests", OPT_PRIO }, @@ -17,7 +17,7 @@ { "lcp-restart", o_int, &lcp_fsm[0].timeouttime, "Set time in seconds between LCP retransmissions", OPT_PRIO }, { "lcp-max-terminate", o_int, &lcp_fsm[0].maxtermtransmits, -@@ -2331,6 +2334,22 @@ LcpSendEchoRequest (f) +@@ -2330,6 +2333,22 @@ LcpSendEchoRequest (f) } } @@ -42,7 +42,7 @@ */ --- a/pppd/pppd.8 +++ b/pppd/pppd.8 -@@ -563,6 +563,11 @@ to 1) if the \fIproxyarp\fR option is us +@@ -575,6 +575,11 @@ to 1) if the \fIproxyarp\fR option is us dynamic IP address option (i.e. set /proc/sys/net/ipv4/ip_dynaddr to 1) in demand mode if the local address changes. .TP diff --git a/package/network/services/ppp/patches/130-no_cdefs_h.patch b/package/network/services/ppp/patches/130-no_cdefs_h.patch deleted file mode 100644 index caa892ec6b..0000000000 --- a/package/network/services/ppp/patches/130-no_cdefs_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/rp-pppoe/config.h -+++ b/pppd/plugins/rp-pppoe/config.h -@@ -102,7 +102,7 @@ - #define HAVE_NETPACKET_PACKET_H 1 - - /* Define if you have the header file. */ --#define HAVE_SYS_CDEFS_H 1 -+/* #undef HAVE_SYS_CDEFS_H */ - - /* Define if you have the header file. */ - /* #undef HAVE_SYS_DLPI_H */ diff --git a/package/network/services/ppp/patches/131-missing_prototype_macro.patch b/package/network/services/ppp/patches/131-missing_prototype_macro.patch deleted file mode 100644 index 868a08b60f..0000000000 --- a/package/network/services/ppp/patches/131-missing_prototype_macro.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -67,6 +67,9 @@ - #define volatile - #endif - -+#undef __P -+#define __P(args) args -+ - #ifdef INET6 - #include "eui64.h" - #endif ---- a/pppd/magic.h -+++ b/pppd/magic.h -@@ -42,6 +42,8 @@ - * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $ - */ - -+#include "pppd.h" -+ - void magic_init __P((void)); /* Initialize the magic number generator */ - u_int32_t magic __P((void)); /* Returns the next magic number */ - diff --git a/package/network/services/ppp/patches/132-fix_linux_includes.patch b/package/network/services/ppp/patches/132-fix_linux_includes.patch deleted file mode 100644 index 696dad1198..0000000000 --- a/package/network/services/ppp/patches/132-fix_linux_includes.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -73,12 +73,12 @@ - #include - #include - #include --#include - #include - #include - #include - #include - -+#include - #include - #include - #include -@@ -102,22 +102,15 @@ - #define MAX_ADDR_LEN 7 - #endif - --#if __GLIBC__ >= 2 - #include /* glibc 2 conflicts with linux/types.h */ - #include - #include - #include - #include --#else --#include --#include --#include --#include --#include --#endif - #include - #include - -+#include - #include - #include - diff --git a/package/network/services/ppp/patches/133-fix_sha1_include.patch b/package/network/services/ppp/patches/133-fix_sha1_include.patch index b5ccd0852d..357d951441 100644 --- a/package/network/services/ppp/patches/133-fix_sha1_include.patch +++ b/package/network/services/ppp/patches/133-fix_sha1_include.patch @@ -1,8 +1,8 @@ --- a/pppd/sha1.c +++ b/pppd/sha1.c -@@ -18,7 +18,7 @@ - +@@ -19,7 +19,7 @@ #include + #include #include /* htonl() */ -#include +#include "pppd.h" diff --git a/package/network/services/ppp/patches/140-pppoe_compile_fix.patch b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch index d9c9b83a33..2253d4f3c1 100644 --- a/package/network/services/ppp/patches/140-pppoe_compile_fix.patch +++ b/package/network/services/ppp/patches/140-pppoe_compile_fix.patch @@ -1,7 +1,7 @@ --- a/pppd/plugins/rp-pppoe/pppoe.h +++ b/pppd/plugins/rp-pppoe/pppoe.h @@ -48,11 +48,7 @@ - #endif + #include /* Ugly header files on some Linux boxes... */ -#if defined(HAVE_LINUX_IF_H) @@ -12,15 +12,13 @@ #ifdef HAVE_NET_IF_TYPES_H #include -@@ -80,22 +76,8 @@ typedef unsigned long UINT32_t; +@@ -80,20 +76,7 @@ typedef unsigned long UINT32_t; #error Could not find a 32-bit integer type #endif -#ifdef HAVE_LINUX_IF_ETHER_H -#include -#endif -- - #include - -#ifdef HAVE_NETINET_IF_ETHER_H -#include @@ -35,49 +33,4 @@ +#include - ---- a/pppd/plugins/rp-pppoe/pppoe-discovery.c -+++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c -@@ -16,6 +16,7 @@ - #include - - #include "pppoe.h" -+#include "pppd/pppd.h" - - #ifdef HAVE_UNISTD_H - #include -@@ -717,6 +718,23 @@ char *xstrdup(const char *s) - return ret; - } - -+void -+error(char *fmt, ...) -+{ -+ va_list pvar; -+ -+#if defined(__STDC__) -+ va_start(pvar, fmt); -+#else -+ char *fmt; -+ va_start(pvar); -+ fmt = va_arg(pvar, char *); -+#endif -+ -+ fprintf(stderr, fmt, pvar); -+ va_end(pvar); -+} -+ - void usage(void) - { - fprintf(stderr, "Usage: pppoe-discovery [options]\n"); ---- a/pppd/plugins/rp-pppoe/Makefile.linux -+++ b/pppd/plugins/rp-pppoe/Makefile.linux -@@ -33,7 +33,7 @@ pppoe-discovery: pppoe-discovery.o debug - $(CC) $(CFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o - - pppoe-discovery.o: pppoe-discovery.c -- $(CC) $(CFLAGS) -c -o pppoe-discovery.o pppoe-discovery.c -+ $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c - - debug.o: debug.c - $(CC) $(CFLAGS) -c -o debug.o debug.c + /* Ethernet frame types according to RFC 2516 */ diff --git a/package/network/services/ppp/patches/200-makefile.patch b/package/network/services/ppp/patches/200-makefile.patch index 143023246c..82b1cc67b9 100644 --- a/package/network/services/ppp/patches/200-makefile.patch +++ b/package/network/services/ppp/patches/200-makefile.patch @@ -23,9 +23,9 @@ Signed-off-by: Jo-Philipp Wich -USE_TDB=y +#USE_TDB=y - HAS_SHADOW=y - #USE_PAM=y -@@ -80,7 +80,7 @@ MAXOCTETS=y + # Uncomment the next line to enable Type=notify services in systemd + # If enabled, and the user sets the up_sdnotify option, then +@@ -85,7 +85,7 @@ MAXOCTETS=y INCLUDE_DIRS= -I../include @@ -34,12 +34,12 @@ Signed-off-by: Jo-Philipp Wich CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"' -@@ -120,10 +120,10 @@ CFLAGS += -DHAS_SHADOW +@@ -125,10 +125,10 @@ CFLAGS += -DHAS_SHADOW #LIBS += -lshadow $(LIBS) endif --ifneq ($(wildcard /usr/include/crypt.h),) -+#ifneq ($(wildcard /usr/include/crypt.h),) +-ifneq ($(wildcard $(shell $(CC) --print-sysroot)/usr/include/crypt.h),) ++#ifneq ($(wildcard $(shell $(CC) --print-sysroot)/usr/include/crypt.h),) CFLAGS += -DHAVE_CRYPT_H=1 LIBS += -lcrypt -endif diff --git a/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch b/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch index 3fc30bb433..bc1b69ebf1 100644 --- a/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch +++ b/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch @@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich */ --- a/pppd/ccp.c +++ b/pppd/ccp.c -@@ -62,12 +62,10 @@ static int setdeflate __P((char **)); +@@ -61,12 +61,10 @@ static int setdeflate __P((char **)); static char bsd_value[8]; static char deflate_value[8]; @@ -104,7 +104,7 @@ Signed-off-by: Jo-Philipp Wich static option_t ccp_option_list[] = { { "noccp", o_bool, &ccp_protent.enabled_flag, -@@ -108,54 +106,36 @@ static option_t ccp_option_list[] = { +@@ -107,54 +105,36 @@ static option_t ccp_option_list[] = { "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, &ccp_allowoptions[0].predictor_1 }, @@ -188,7 +188,7 @@ Signed-off-by: Jo-Philipp Wich #endif /* MPPE */ { NULL } -@@ -241,7 +221,7 @@ static fsm_callbacks ccp_callbacks = { +@@ -240,7 +220,7 @@ static fsm_callbacks ccp_callbacks = { */ #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \ || (opt).predictor_1 || (opt).predictor_2 \ @@ -197,7 +197,7 @@ Signed-off-by: Jo-Philipp Wich /* * Local state (mainly for handling reset-reqs and reset-acks). -@@ -344,6 +324,100 @@ setdeflate(argv) +@@ -343,6 +323,100 @@ setdeflate(argv) return 1; } @@ -298,7 +298,7 @@ Signed-off-by: Jo-Philipp Wich /* * ccp_init - initialize CCP. */ -@@ -378,6 +452,30 @@ ccp_init(unit) +@@ -377,6 +451,30 @@ ccp_init(unit) ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS; ccp_allowoptions[0].predictor_1 = 1; @@ -329,7 +329,7 @@ Signed-off-by: Jo-Philipp Wich } /* -@@ -455,11 +553,11 @@ ccp_input(unit, p, len) +@@ -454,11 +552,11 @@ ccp_input(unit, p, len) if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) { notice("Compression disabled by peer."); #ifdef MPPE @@ -343,7 +343,7 @@ Signed-off-by: Jo-Philipp Wich } /* -@@ -487,6 +585,15 @@ ccp_extcode(f, code, id, p, len) +@@ -486,6 +584,15 @@ ccp_extcode(f, code, id, p, len) break; /* send a reset-ack, which the transmitter will see and reset its compression state. */ @@ -359,7 +359,7 @@ Signed-off-by: Jo-Philipp Wich fsm_sdata(f, CCP_RESETACK, id, NULL, 0); break; -@@ -515,12 +622,11 @@ ccp_protrej(unit) +@@ -514,12 +621,11 @@ ccp_protrej(unit) fsm_lowerdown(&ccp_fsm[unit]); #ifdef MPPE @@ -374,7 +374,7 @@ Signed-off-by: Jo-Philipp Wich } /* -@@ -537,7 +643,7 @@ ccp_resetci(f) +@@ -536,7 +642,7 @@ ccp_resetci(f) all_rejected[f->unit] = 0; #ifdef MPPE @@ -383,7 +383,7 @@ Signed-off-by: Jo-Philipp Wich ccp_options *ao = &ccp_allowoptions[f->unit]; int auth_mschap_bits = auth_done[f->unit]; int numbits; -@@ -551,80 +657,109 @@ ccp_resetci(f) +@@ -550,80 +656,109 @@ ccp_resetci(f) * NB: If MPPE is required, all other compression opts are invalid. * So, we return right away if we can't do it. */ @@ -560,7 +560,7 @@ Signed-off-by: Jo-Philipp Wich opt_buf[0] = CI_BSD_COMPRESS; opt_buf[1] = CILEN_BSD_COMPRESS; @@ -679,7 +814,8 @@ ccp_cilen(f) - + (go->deflate? CILEN_DEFLATE: 0) + + (go->deflate && go->deflate_draft? CILEN_DEFLATE: 0) + (go->predictor_1? CILEN_PREDICTOR_1: 0) + (go->predictor_2? CILEN_PREDICTOR_2: 0) - + (go->mppe? CILEN_MPPE: 0); @@ -1459,7 +1459,7 @@ Signed-off-by: Jo-Philipp Wich bool deflate_draft; /* use draft RFC code for deflate? */ + bool lzs; /* do Stac LZS? */ + bool mppc; /* do MPPC? */ - bool mppe; /* do MPPE? */ + u_char mppe; /* MPPE bitfield */ + bool mppe_40; /* allow 40 bit encryption? */ + bool mppe_56; /* allow 56 bit encryption? */ + bool mppe_128; /* allow 128 bit encryption? */ @@ -1473,7 +1473,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c -@@ -963,13 +963,17 @@ set_mppe_enc_types(int policy, int types +@@ -962,13 +962,17 @@ set_mppe_enc_types(int policy, int types /* * Disable undesirable encryption types. Note that we don't ENABLE * any encryption types, to avoid overriding manual configuration. diff --git a/package/network/services/ppp/patches/202-no_strip.patch b/package/network/services/ppp/patches/202-no_strip.patch index 29d8f746bb..436085f3b3 100644 --- a/package/network/services/ppp/patches/202-no_strip.patch +++ b/package/network/services/ppp/patches/202-no_strip.patch @@ -19,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich clean: --- a/pppd/Makefile.linux +++ b/pppd/Makefile.linux -@@ -102,7 +102,7 @@ ifdef USE_SRP +@@ -107,7 +107,7 @@ ifdef USE_SRP CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto TARGETS += srp-entry @@ -28,7 +28,7 @@ Signed-off-by: Jo-Philipp Wich MANPAGES += srp-entry.8 EXTRACLEAN += srp-entry.o NEEDDES=y -@@ -208,7 +208,7 @@ all: $(TARGETS) +@@ -219,7 +219,7 @@ all: $(TARGETS) install: pppd mkdir -p $(BINDIR) $(MANDIR) $(EXTRAINSTALL) diff --git a/package/network/services/ppp/patches/203-opt_flags.patch b/package/network/services/ppp/patches/203-opt_flags.patch index 069b8585f3..8dfacf3834 100644 --- a/package/network/services/ppp/patches/203-opt_flags.patch +++ b/package/network/services/ppp/patches/203-opt_flags.patch @@ -18,6 +18,23 @@ Signed-off-by: Jo-Philipp Wich # Uncomment the next line to include support for Microsoft's # MS-CHAP authentication protocol. +@@ -43,13 +44,13 @@ install: all + $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) + + radius.so: radius.o libradiusclient.a +- $(CC) $(LDFLAGS) -o radius.so -shared radius.o libradiusclient.a ++ $(CC) $(LDFLAGS) -fPIC -o radius.so -shared radius.o libradiusclient.a + + radattr.so: radattr.o +- $(CC) $(LDFLAGS) -o radattr.so -shared radattr.o ++ $(CC) $(LDFLAGS) -fPIC -o radattr.so -shared radattr.o + + radrealms.so: radrealms.o +- $(CC) $(LDFLAGS) -o radrealms.so -shared radrealms.o ++ $(CC) $(LDFLAGS) -fPIC -o radrealms.so -shared radrealms.o + + CLIENTOBJS = avpair.o buildreq.o config.o dict.o ip_util.o \ + clientid.o sendserver.o lock.o util.o md5.o --- a/pppdump/Makefile.linux +++ b/pppdump/Makefile.linux @@ -2,7 +2,8 @@ DESTDIR = $(INSTROOT)@DESTDIR@ @@ -33,11 +50,11 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/plugins/rp-pppoe/Makefile.linux +++ b/pppd/plugins/rp-pppoe/Makefile.linux @@ -39,7 +39,7 @@ debug.o: debug.c - $(CC) $(CFLAGS) -c -o debug.o debug.c + $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c rp-pppoe.so: plugin.o discovery.o if.o common.o -- $(CC) $(CFLAGS) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o -+ $(CC) $(CFLAGS) -fPIC -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o +- $(CC) $(LDFLAGS) -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o ++ $(CC) $(LDFLAGS) -fPIC -o rp-pppoe.so -shared plugin.o discovery.o if.o common.o install: all $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/package/network/services/ppp/patches/204-radius_config.patch b/package/network/services/ppp/patches/204-radius_config.patch index c97a535079..2f30b9d3dc 100644 --- a/package/network/services/ppp/patches/204-radius_config.patch +++ b/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -369,31 +369,37 @@ static int test_config(char *filename) +@@ -371,31 +371,37 @@ static int test_config(char *filename) } #endif diff --git a/package/network/services/ppp/patches/205-no_exponential_timeout.patch b/package/network/services/ppp/patches/205-no_exponential_timeout.patch index 1395ca5177..7f752e3137 100644 --- a/package/network/services/ppp/patches/205-no_exponential_timeout.patch +++ b/package/network/services/ppp/patches/205-no_exponential_timeout.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/plugins/rp-pppoe/discovery.c +++ b/pppd/plugins/rp-pppoe/discovery.c -@@ -644,7 +644,9 @@ discovery(PPPoEConnection *conn) +@@ -632,7 +632,9 @@ discovery(PPPoEConnection *conn) conn->discoveryState = STATE_SENT_PADI; waitForPADO(conn, timeout); @@ -17,7 +17,7 @@ Signed-off-by: Jo-Philipp Wich } while (conn->discoveryState == STATE_SENT_PADI); timeout = conn->discoveryTimeout; -@@ -659,7 +661,9 @@ discovery(PPPoEConnection *conn) +@@ -647,7 +649,9 @@ discovery(PPPoEConnection *conn) sendPADR(conn); conn->discoveryState = STATE_SENT_PADR; waitForPADS(conn, timeout); diff --git a/package/network/services/ppp/patches/206-compensate_time_change.patch b/package/network/services/ppp/patches/206-compensate_time_change.patch index 31a582a202..a1eb6a716c 100644 --- a/package/network/services/ppp/patches/206-compensate_time_change.patch +++ b/package/network/services/ppp/patches/206-compensate_time_change.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -90,6 +90,7 @@ +@@ -89,6 +89,7 @@ #include #include #include @@ -21,7 +21,7 @@ Signed-off-by: Jo-Philipp Wich #include "pppd.h" #include "magic.h" -@@ -228,6 +229,7 @@ static struct subprocess *children; +@@ -226,6 +227,7 @@ static struct subprocess *children; /* Prototypes for procedures local to this file. */ @@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich static void setup_signals __P((void)); static void create_pidfile __P((int pid)); static void create_linkpidfile __P((int pid)); -@@ -535,6 +537,7 @@ main(argc, argv) +@@ -525,6 +527,7 @@ main(argc, argv) info("Starting link"); } @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich gettimeofday(&start_time, NULL); script_unsetenv("CONNECT_TIME"); script_unsetenv("BYTES_SENT"); -@@ -1267,6 +1270,36 @@ struct callout { +@@ -1274,6 +1277,36 @@ struct callout { static struct callout *callout = NULL; /* Callout list */ static struct timeval timenow; /* Current time */ @@ -74,7 +74,7 @@ Signed-off-by: Jo-Philipp Wich /* * timeout - Schedule a timeout. -@@ -1337,6 +1370,8 @@ calltimeout() +@@ -1344,6 +1377,8 @@ calltimeout() { struct callout *p; @@ -83,7 +83,7 @@ Signed-off-by: Jo-Philipp Wich while (callout != NULL) { p = callout; -@@ -1364,6 +1399,8 @@ timeleft(tvp) +@@ -1371,6 +1406,8 @@ timeleft(tvp) { if (callout == NULL) return NULL; diff --git a/package/network/services/ppp/patches/207-lcp_mtu_max.patch b/package/network/services/ppp/patches/207-lcp_mtu_max.patch index f406f685e0..7aa8d4e129 100644 --- a/package/network/services/ppp/patches/207-lcp_mtu_max.patch +++ b/package/network/services/ppp/patches/207-lcp_mtu_max.patch @@ -8,7 +8,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/lcp.c +++ b/pppd/lcp.c -@@ -1917,12 +1917,12 @@ lcp_up(f) +@@ -1916,12 +1916,12 @@ lcp_up(f) * the interface MTU is set to the lowest of that, the * MTU we want to use, and our link MRU. */ diff --git a/package/network/services/ppp/patches/208-fix_status_code.patch b/package/network/services/ppp/patches/208-fix_status_code.patch index eb24b0a055..31460148a4 100644 --- a/package/network/services/ppp/patches/208-fix_status_code.patch +++ b/package/network/services/ppp/patches/208-fix_status_code.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -1048,7 +1048,8 @@ get_input() +@@ -1055,7 +1055,8 @@ get_input() } notice("Modem hangup"); hungup = 1; diff --git a/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch b/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch index 68a56aa6e1..00fb835029 100644 --- a/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch +++ b/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/Makefile.linux +++ b/pppd/Makefile.linux -@@ -178,8 +178,8 @@ endif +@@ -189,8 +189,8 @@ endif ifdef FILTER ifneq ($(wildcard /usr/include/pcap-bpf.h),) diff --git a/package/network/services/ppp/patches/310-precompile_filter.patch b/package/network/services/ppp/patches/310-precompile_filter.patch index 701e49d321..a65c19cf1c 100644 --- a/package/network/services/ppp/patches/310-precompile_filter.patch +++ b/package/network/services/ppp/patches/310-precompile_filter.patch @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich # Uncomment the next line to enable multilink PPP (enabled by default) # Linux distributions: Please leave multilink ENABLED in your builds # of pppd! -@@ -183,6 +186,14 @@ CFLAGS += -DPPP_FILTER -I$(STAGING_DIR) +@@ -194,6 +197,14 @@ CFLAGS += -DPPP_FILTER -I$(STAGING_DIR) endif endif @@ -48,7 +48,7 @@ Signed-off-by: Jo-Philipp Wich /* * There have been 3 or 4 different names for this in libpcap CVS, but * this seems to be what they have settled on... -@@ -165,6 +166,13 @@ static int setlogfile __P((char **)); +@@ -169,6 +170,13 @@ static int setlogfile __P((char **)); static int loadplugin __P((char **)); #endif @@ -62,7 +62,7 @@ Signed-off-by: Jo-Philipp Wich #ifdef PPP_FILTER static int setpassfilter __P((char **)); static int setactivefilter __P((char **)); -@@ -344,6 +352,14 @@ option_t general_options[] = { +@@ -361,6 +369,14 @@ option_t general_options[] = { "set filter for active pkts", OPT_PRIO }, #endif @@ -77,7 +77,7 @@ Signed-off-by: Jo-Philipp Wich #ifdef MAXOCTETS { "maxoctets", o_int, &maxoctets, "Set connection traffic limit", -@@ -1493,6 +1509,29 @@ callfile(argv) +@@ -1511,6 +1527,29 @@ callfile(argv) return ok; } diff --git a/package/network/services/ppp/patches/320-custom_iface_names.patch b/package/network/services/ppp/patches/320-custom_iface_names.patch deleted file mode 100644 index 441f9eec61..0000000000 --- a/package/network/services/ppp/patches/320-custom_iface_names.patch +++ /dev/null @@ -1,135 +0,0 @@ -pppd: Support arbitrary interface names - -This patch implements a new string option "ifname" which allows to specify -fully custom PPP interface names on Linux. It does so by renaming the -allocated pppX device immediately after it has been created to the requested -interface name. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -745,8 +745,11 @@ void - set_ifunit(iskey) - int iskey; - { -- info("Using interface %s%d", PPP_DRV_NAME, ifunit); -- slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit); -+ if (use_ifname[0] == 0) -+ slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit); -+ else -+ slprintf(ifname, sizeof(ifname), "%s", use_ifname); -+ info("Using interface %s", ifname); - script_setenv("IFNAME", ifname, iskey); - if (iskey) { - create_pidfile(getpid()); /* write pid to file */ ---- a/pppd/options.c -+++ b/pppd/options.c -@@ -112,6 +112,7 @@ int log_to_fd = 1; /* send log messages - bool log_default = 1; /* log_to_fd is default (stdout) */ - int maxfail = 10; /* max # of unsuccessful connection attempts */ - char linkname[MAXPATHLEN]; /* logical name for link */ -+char use_ifname[IFNAMSIZ]; /* physical name for PPP link */ - bool tune_kernel; /* may alter kernel settings */ - int connect_delay = 1000; /* wait this many ms after connect script */ - int req_unit = -1; /* requested interface unit */ -@@ -277,6 +278,9 @@ option_t general_options[] = { - { "linkname", o_string, linkname, - "Set logical name for link", - OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXPATHLEN }, -+ { "ifname", o_string, use_ifname, -+ "Set physical name for PPP interface", -+ OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, IFNAMSIZ }, - - { "maxfail", o_int, &maxfail, - "Maximum number of unsuccessful connection attempts to allow", ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -74,6 +74,10 @@ - #include "eui64.h" - #endif - -+#ifndef IFNAMSIZ -+#define IFNAMSIZ 16 -+#endif -+ - /* - * Limits. - */ -@@ -317,6 +321,7 @@ extern char *record_file; /* File to rec - extern bool sync_serial; /* Device is synchronous serial device */ - extern int maxfail; /* Max # of unsuccessful connection attempts */ - extern char linkname[MAXPATHLEN]; /* logical name for link */ -+extern char use_ifname[IFNAMSIZ]; /* physical name for PPP interface */ - extern bool tune_kernel; /* May alter kernel settings as necessary */ - extern int connect_delay; /* Time to delay after connect script */ - extern int max_data_rate; /* max bytes/sec through charshunt */ ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -161,6 +161,10 @@ struct in6_ifreq { - /* We can get an EIO error on an ioctl if the modem has hung up */ - #define ok_error(num) ((num)==EIO) - -+#if !defined(PPP_DRV_NAME) -+#define PPP_DRV_NAME "ppp" -+#endif /* !defined(PPP_DRV_NAME) */ -+ - static int tty_disc = N_TTY; /* The TTY discipline */ - static int ppp_disc = N_PPP; /* The PPP discpline */ - static int initfdflags = -1; /* Initial file descriptor flags for fd */ -@@ -620,7 +624,8 @@ void generic_disestablish_ppp(int dev_fd - */ - static int make_ppp_unit() - { -- int x, flags; -+ struct ifreq ifr; -+ int x, flags, s; - - if (ppp_dev_fd >= 0) { - dbglog("in make_ppp_unit, already had /dev/ppp open?"); -@@ -643,6 +648,30 @@ static int make_ppp_unit() - } - if (x < 0) - error("Couldn't create new ppp unit: %m"); -+ -+ if (use_ifname[0] != 0) { -+ s = socket(PF_INET, SOCK_DGRAM, 0); -+ if (s < 0) -+ s = socket(PF_PACKET, SOCK_DGRAM, 0); -+ if (s < 0) -+ s = socket(PF_INET6, SOCK_DGRAM, 0); -+ if (s < 0) -+ s = socket(PF_UNIX, SOCK_DGRAM, 0); -+ if (s >= 0) { -+ slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", PPP_DRV_NAME, ifunit); -+ slprintf(ifr.ifr_newname, sizeof(ifr.ifr_newname), "%s", use_ifname); -+ x = ioctl(s, SIOCSIFNAME, &ifr); -+ close(s); -+ } else { -+ x = s; -+ } -+ if (x < 0) { -+ error("Couldn't rename %s to %s", ifr.ifr_name, ifr.ifr_newname); -+ close(ppp_dev_fd); -+ ppp_dev_fd = -1; -+ } -+ } -+ - return x; - } - ---- a/pppstats/pppstats.c -+++ b/pppstats/pppstats.c -@@ -506,10 +506,12 @@ main(argc, argv) - if (argc > 0) - interface = argv[0]; - -+#if 0 - if (sscanf(interface, PPP_DRV_NAME "%d", &unit) != 1) { - fprintf(stderr, "%s: invalid interface '%s' specified\n", - progname, interface); - } -+#endif - - #ifndef STREAMS - { diff --git a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index bba5884fa4..75c803650f 100644 --- a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -8,7 +8,15 @@ Signed-off-by: George Kashperko 2 files changed, 53 insertions(+), 14 deletions(-) --- a/pppd/multilink.c +++ b/pppd/multilink.c -@@ -56,7 +56,8 @@ static void iterate_bundle_links __P((vo +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + #include "pppd.h" + #include "fsm.h" +@@ -56,7 +57,8 @@ static void iterate_bundle_links __P((vo static int get_default_epdisc __P((struct epdisc *)); static int parse_num __P((char *str, const char *key, int *valp)); @@ -18,7 +26,7 @@ Signed-off-by: George Kashperko #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ -@@ -197,35 +198,38 @@ mp_join_bundle() +@@ -197,35 +199,38 @@ mp_join_bundle() key.dptr = bundle_id; key.dsize = p - bundle_id; pid = tdb_fetch(pppdb, key); @@ -33,7 +41,7 @@ Signed-off-by: George Kashperko /* make sure the string is null-terminated */ rec.dptr[rec.dsize-1] = 0; - /* parse the interface number */ -- parse_num(rec.dptr, "IFNAME=ppp", &unit); +- parse_num(rec.dptr, "UNIT=", &unit); + /* check the pid value */ if (!parse_num(rec.dptr, "PPPD_PID=", &pppd_pid) @@ -65,7 +73,7 @@ Signed-off-by: George Kashperko } /* we have to make a new bundle */ -@@ -408,22 +412,45 @@ parse_num(str, key, valp) +@@ -408,22 +413,45 @@ parse_num(str, key, valp) return 0; } @@ -106,7 +114,7 @@ Signed-off-by: George Kashperko TDB_DATA kd, vd; int ret = 0; -- slprintf(ifkey, sizeof(ifkey), "IFNAME=ppp%d", unit); +- slprintf(ifkey, sizeof(ifkey), "UNIT=%d", unit); + slprintf(ifkey, sizeof(ifkey), "IFNAME=%s", ifname); + kd.dptr = ifkey; @@ -118,7 +126,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -698,6 +698,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -700,6 +700,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -135,7 +143,7 @@ Signed-off-by: George Kashperko /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -716,6 +726,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -718,6 +728,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch b/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch index 45fc4b9449..6c0849cc6c 100644 --- a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch +++ b/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch @@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1756,6 +1756,7 @@ int cifdefaultroute (int unit, u_int32_t +@@ -1767,6 +1767,7 @@ int cifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index 5a694476d9..ae385dfc9b 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1710,6 +1710,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -1717,6 +1717,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -21,9 +21,9 @@ Signed-off-by: Jo-Philipp Wich + SIN_ADDR(rt.rt_gateway) = gateway; + rt.rt_dev = ifname; + rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */ - if (kernel_version > KVERSION(2,1,0)) { -@@ -1717,7 +1720,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -1725,7 +1728,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index cea9e16c2e..0754f8f4d6 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -196,7 +196,7 @@ static int driver_is_old = 0; +@@ -200,7 +200,7 @@ static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -214,8 +214,8 @@ static int looped; /* 1 if using loop +@@ -219,8 +219,8 @@ static int looped; /* 1 if using loop static int link_mtu; /* mtu for the link (not bundle) */ static struct utsname utsname; /* for the kernel version */ @@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich #define MAX_IFS 100 -@@ -1451,11 +1451,12 @@ int ccp_fatal_error (int unit) +@@ -1453,11 +1453,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +44,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1477,6 +1478,7 @@ static char *path_to_procfs(const char * +@@ -1479,6 +1480,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2129,15 +2131,19 @@ int ppp_available(void) +@@ -2332,15 +2334,19 @@ int ppp_available(void) int my_version, my_modification, my_patch; int osmaj, osmin, ospatch; @@ -72,7 +72,7 @@ Signed-off-by: Jo-Philipp Wich /* XXX should get from driver */ driver_version = 2; -@@ -2197,6 +2203,7 @@ int ppp_available(void) +@@ -2400,6 +2406,7 @@ int ppp_available(void) if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) ok = 0; @@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich /* * This is the PPP device. Validate the version of the driver at this -@@ -2730,6 +2737,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2936,6 +2943,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } #endif /* TIOCGPTN */ @@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -2748,6 +2756,7 @@ get_pty(master_fdp, slave_fdp, slave_nam +@@ -2954,6 +2962,7 @@ get_pty(master_fdp, slave_fdp, slave_nam } } } @@ -125,7 +125,7 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -371,10 +368,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -394,10 +391,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { @@ -138,7 +138,7 @@ Signed-off-by: Jo-Philipp Wich info("RP-PPPoE plugin version %s compiled against pppd %s", --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -486,12 +486,7 @@ static void pppol2tp_cleanup(void) +@@ -490,12 +490,7 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { diff --git a/package/network/services/ppp/patches/401-no_record_file.patch b/package/network/services/ppp/patches/401-no_record_file.patch index f5079fac4b..56a9f02eb8 100644 --- a/package/network/services/ppp/patches/401-no_record_file.patch +++ b/package/network/services/ppp/patches/401-no_record_file.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/pppd.h +++ b/pppd/pppd.h -@@ -317,7 +317,6 @@ extern int holdoff; /* Dead time before +@@ -325,7 +325,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ @@ -17,7 +17,7 @@ Signed-off-by: Jo-Philipp Wich extern char linkname[MAXPATHLEN]; /* logical name for link */ --- a/pppd/tty.c +++ b/pppd/tty.c -@@ -146,7 +146,7 @@ char *disconnect_script = NULL; /* Scrip +@@ -145,7 +145,7 @@ char *disconnect_script = NULL; /* Scrip char *welcomer = NULL; /* Script to run after phys link estab. */ char *ptycommand = NULL; /* Command to run on other side of pty */ bool notty = 0; /* Stdin/out is not a tty */ @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich int max_data_rate; /* max bytes/sec through charshunt */ bool sync_serial = 0; /* Device is synchronous serial device */ char *pty_socket = NULL; /* Socket to connect to pty */ -@@ -202,8 +202,10 @@ option_t tty_options[] = { +@@ -201,8 +201,10 @@ option_t tty_options[] = { "Send and receive over socket, arg is host:port", OPT_PRIO | OPT_DEVNAM }, diff --git a/package/network/services/ppp/patches/403-no_wtmp.patch b/package/network/services/ppp/patches/403-no_wtmp.patch index 98d6133c43..537a1b0c7f 100644 --- a/package/network/services/ppp/patches/403-no_wtmp.patch +++ b/package/network/services/ppp/patches/403-no_wtmp.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -2267,6 +2267,7 @@ int ppp_available(void) +@@ -2470,6 +2470,7 @@ int ppp_available(void) void logwtmp (const char *line, const char *name, const char *host) { @@ -15,7 +15,7 @@ Signed-off-by: Jo-Philipp Wich struct utmp ut, *utp; pid_t mypid = getpid(); #if __GLIBC__ < 2 -@@ -2332,6 +2333,7 @@ void logwtmp (const char *line, const ch +@@ -2535,6 +2536,7 @@ void logwtmp (const char *line, const ch close (wtmp); } #endif diff --git a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch index 3b35fe0030..1d94873f35 100644 --- a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch +++ b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -882,14 +882,17 @@ struct protocol_list { +@@ -886,14 +886,17 @@ struct protocol_list { const char *name; } protocol_list[] = { { 0x21, "IP" }, @@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich { 0x33, "Stream Protocol ST-II" }, { 0x35, "Banyan Vines" }, { 0x39, "AppleTalk EDDP" }, -@@ -903,8 +906,11 @@ struct protocol_list { +@@ -907,8 +910,11 @@ struct protocol_list { { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x4b, "SNA over 802.2" }, { 0x4d, "SNA" }, @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich { 0x53, "Encryption" }, { 0x55, "Individual Link Encryption" }, { 0x57, "IPv6" }, -@@ -915,12 +921,15 @@ struct protocol_list { +@@ -919,12 +925,15 @@ struct protocol_list { { 0x65, "RTP IPHC Compressed non-TCP" }, { 0x67, "RTP IPHC Compressed UDP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" }, @@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich { 0x0203, "IBM Source Routing BPDU" }, { 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0207, "Cisco Discovery Protocol" }, -@@ -932,15 +941,19 @@ struct protocol_list { +@@ -936,15 +945,19 @@ struct protocol_list { { 0x0231, "Luxcom" }, { 0x0233, "Sigma Network Systems" }, { 0x0235, "Apple Client Server Protocol" }, @@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich { 0x4001, "Cray Communications Control Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4005, "Expand accelerator protocol" }, -@@ -951,8 +964,10 @@ struct protocol_list { +@@ -955,8 +968,10 @@ struct protocol_list { { 0x4023, "RefTek Protocol" }, { 0x4025, "Fibre Channel" }, { 0x4027, "EMIT Protocols" }, @@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8023, "OSI Network Layer Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" }, -@@ -961,7 +976,9 @@ struct protocol_list { +@@ -965,7 +980,9 @@ struct protocol_list { { 0x8031, "Bridging NCP" }, { 0x8033, "Stream Protocol Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" }, @@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich { 0x803f, "NETBIOS Framing Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" }, { 0x8043, "Ascom Timeplex" }, -@@ -970,18 +987,24 @@ struct protocol_list { +@@ -974,18 +991,24 @@ struct protocol_list { { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804d, "SNA Control Protocol" }, @@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8207, "Cisco Discovery Protocol Control" }, { 0x8209, "Netcs Twin Routing" }, { 0x820b, "STP - Control Protocol" }, -@@ -990,24 +1013,29 @@ struct protocol_list { +@@ -994,24 +1017,29 @@ struct protocol_list { { 0x8281, "MPLSCP" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, diff --git a/package/network/services/ppp/patches/405-no_multilink_option.patch b/package/network/services/ppp/patches/405-no_multilink_option.patch index b17747a5ec..ce87d039a3 100644 --- a/package/network/services/ppp/patches/405-no_multilink_option.patch +++ b/package/network/services/ppp/patches/405-no_multilink_option.patch @@ -9,7 +9,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/options.c +++ b/pppd/options.c -@@ -336,13 +336,14 @@ option_t general_options[] = { +@@ -349,13 +349,14 @@ option_t general_options[] = { "Enable multilink operation", OPT_PRIOSUB | OPT_ALIAS | 1 }, { "nomultilink", o_bool, &multilink, "Disable multilink operation", OPT_PRIOSUB | 0 }, diff --git a/package/network/services/ppp/patches/511-syncppp.patch b/package/network/services/ppp/patches/511-syncppp.patch index fe58b8cc81..8b8b6cce6a 100644 --- a/package/network/services/ppp/patches/511-syncppp.patch +++ b/package/network/services/ppp/patches/511-syncppp.patch @@ -1,6 +1,5 @@ -diff -Naur ppp-2.4.5.0/pppd/chap-new.c ppp-2.4.5/pppd/chap-new.c ---- ppp-2.4.5.0/pppd/chap-new.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/chap-new.c 2012-04-19 20:24:28.000000000 +0800 +--- a/pppd/chap-new.c ++++ b/pppd/chap-new.c @@ -37,6 +37,8 @@ #include "chap-new.h" #include "chap-md5.h" @@ -10,7 +9,7 @@ diff -Naur ppp-2.4.5.0/pppd/chap-new.c ppp-2.4.5/pppd/chap-new.c #ifdef CHAPMS #include "chap_ms.h" #define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) -@@ -481,6 +483,19 @@ +@@ -492,6 +494,19 @@ chap_respond(struct chap_client_state *c p[2] = len >> 8; p[3] = len; @@ -30,10 +29,9 @@ diff -Naur ppp-2.4.5.0/pppd/chap-new.c ppp-2.4.5/pppd/chap-new.c output(0, response, PPP_HDRLEN + len); } -diff -Naur ppp-2.4.5.0/pppd/Makefile.linux ppp-2.4.5/pppd/Makefile.linux ---- ppp-2.4.5.0/pppd/Makefile.linux 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/Makefile.linux 2012-04-19 20:01:05.000000000 +0800 -@@ -13,16 +13,16 @@ +--- a/pppd/Makefile.linux ++++ b/pppd/Makefile.linux +@@ -13,16 +13,16 @@ TARGETS = pppd PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \ ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \ @@ -53,27 +51,26 @@ diff -Naur ppp-2.4.5.0/pppd/Makefile.linux ppp-2.4.5/pppd/Makefile.linux # # include dependencies if present -@@ -33,7 +33,7 @@ +@@ -33,7 +33,7 @@ endif # CC = gcc # COPTS = -O2 -pipe -Wall -g -LIBS = +LIBS = -lpthread - # Uncomment the next 2 lines to include support for Microsoft's + # Uncomment the next line to include support for Microsoft's # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. -diff -Naur ppp-2.4.5.0/pppd/options.c ppp-2.4.5/pppd/options.c ---- ppp-2.4.5.0/pppd/options.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/options.c 2012-04-19 20:24:49.000000000 +0800 -@@ -126,6 +126,7 @@ +--- a/pppd/options.c ++++ b/pppd/options.c +@@ -128,6 +128,7 @@ bool dump_options; /* print out option bool dryrun; /* print out option values and exit */ char *domain; /* domain name set by domain option */ int child_wait = 5; /* # seconds to wait for children at exit */ +int npppd = 0; /* synchronize between multiple pppd */ struct userenv *userenv_list; /* user environment variables */ + int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */ - #ifdef MAXOCTETS -@@ -311,6 +312,10 @@ +@@ -342,6 +343,10 @@ option_t general_options[] = { "Set pathname of ipv6-down script", OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, @@ -84,10 +81,9 @@ diff -Naur ppp-2.4.5.0/pppd/options.c ppp-2.4.5/pppd/options.c #ifdef HAVE_MULTILINK { "multilink", o_bool, &multilink, "Enable multilink operation", OPT_PRIO | 1 }, -diff -Naur ppp-2.4.5.0/pppd/pppd.h ppp-2.4.5/pppd/pppd.h ---- ppp-2.4.5.0/pppd/pppd.h 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/pppd.h 2012-04-19 20:25:02.000000000 +0800 -@@ -327,6 +327,7 @@ +--- a/pppd/pppd.h ++++ b/pppd/pppd.h +@@ -343,6 +343,7 @@ extern char *bundle_name; /* bundle name extern bool dump_options; /* print out option values */ extern bool dryrun; /* check everything, print options, exit */ extern int child_wait; /* # seconds to wait for children at end */ @@ -95,9 +91,8 @@ diff -Naur ppp-2.4.5.0/pppd/pppd.h ppp-2.4.5/pppd/pppd.h #ifdef MAXOCTETS extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ -diff -Naur ppp-2.4.5.0/pppd/syncppp.c ppp-2.4.5/pppd/syncppp.c ---- ppp-2.4.5.0/pppd/syncppp.c 1970-01-01 08:00:00.000000000 +0800 -+++ ppp-2.4.5/pppd/syncppp.c 2012-04-18 15:46:59.000000000 +0800 +--- /dev/null ++++ b/pppd/syncppp.c @@ -0,0 +1,75 @@ +#include +#include @@ -174,26 +169,23 @@ diff -Naur ppp-2.4.5.0/pppd/syncppp.c ppp-2.4.5/pppd/syncppp.c + return 0; +} + -diff -Naur ppp-2.4.5.0/pppd/syncppp.h ppp-2.4.5/pppd/syncppp.h ---- ppp-2.4.5.0/pppd/syncppp.h 1970-01-01 08:00:00.000000000 +0800 -+++ ppp-2.4.5/pppd/syncppp.h 2012-04-18 15:46:59.000000000 +0800 +--- /dev/null ++++ b/pppd/syncppp.h @@ -0,0 +1,3 @@ +#define SEM_BLOCK_NAME "block" +#define SEM_COUNT_NAME "count" +#define SYNCPPP_TIMEOUT 5 -diff -Naur ppp-2.4.5.0/pppd/upap.c ppp-2.4.5/pppd/upap.c ---- ppp-2.4.5.0/pppd/upap.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/upap.c 2012-04-19 20:26:22.000000000 +0800 -@@ -52,6 +52,8 @@ +--- a/pppd/upap.c ++++ b/pppd/upap.c +@@ -52,6 +52,7 @@ #include "pppd.h" #include "upap.h" +#include "syncppp.h" -+ - static const char rcsid[] = RCSID; static bool hide_password = 1; -@@ -568,6 +570,18 @@ + +@@ -567,6 +568,18 @@ upap_sauthreq(u) PUTCHAR(u->us_passwdlen, outp); BCOPY(u->us_passwd, outp, u->us_passwdlen); @@ -212,3 +204,4 @@ diff -Naur ppp-2.4.5.0/pppd/upap.c ppp-2.4.5/pppd/upap.c output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); TIMEOUT(upap_timeout, u, u->us_timeouttime); + diff --git a/package/network/services/ppp/patches/520-uniq.patch b/package/network/services/ppp/patches/520-uniq.patch deleted file mode 100644 index 65d0e96bc0..0000000000 --- a/package/network/services/ppp/patches/520-uniq.patch +++ /dev/null @@ -1,269 +0,0 @@ ---- a/pppd/plugins/rp-pppoe/common.c -+++ b/pppd/plugins/rp-pppoe/common.c -@@ -119,15 +119,11 @@ sendPADT(PPPoEConnection *conn, char con - conn->session = 0; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Copy error message */ ---- a/pppd/plugins/rp-pppoe/discovery.c -+++ b/pppd/plugins/rp-pppoe/discovery.c -@@ -80,13 +80,10 @@ static void - parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data, - void *extra) - { -- int *val = (int *) extra; -- if (type == TAG_HOST_UNIQ && len == sizeof(pid_t)) { -- pid_t tmp; -- memcpy(&tmp, data, len); -- if (tmp == getpid()) { -- *val = 1; -- } -+ PPPoETag *tag = extra; -+ -+ if (type == TAG_HOST_UNIQ && len == ntohs(tag->length)) { -+ tag->length = memcmp(data, tag->payload, len); - } - } - -@@ -104,16 +101,16 @@ parseForHostUniq(UINT16_t type, UINT16_t - static int - packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet) - { -- int forMe = 0; -+ PPPoETag hostUniq = conn->hostUniq; - - /* If packet is not directed to our MAC address, forget it */ - if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; - - /* If we're not using the Host-Unique tag, then accept the packet */ -- if (!conn->useHostUniq) return 1; -+ if (!conn->hostUniq.length) return 1; - -- parsePacket(packet, parseForHostUniq, &forMe); -- return forMe; -+ parsePacket(packet, parseForHostUniq, &hostUniq); -+ return (hostUniq.length == 0); - } - - /********************************************************************** -@@ -301,16 +298,12 @@ sendPADI(PPPoEConnection *conn) - } - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len + TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Add our maximum MTU/MRU */ -@@ -478,16 +471,12 @@ sendPADR(PPPoEConnection *conn) - cursor += namelen + TAG_HDR_SIZE; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid)+TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len+TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - /* Add our maximum MTU/MRU */ ---- a/pppd/plugins/rp-pppoe/plugin.c -+++ b/pppd/plugins/rp-pppoe/plugin.c -@@ -65,6 +65,7 @@ static char *existingSession = NULL; - static int printACNames = 0; - static char *pppoe_reqd_mac = NULL; - unsigned char pppoe_reqd_mac_addr[6]; -+static char *host_uniq = NULL; - - static int PPPoEDevnameHook(char *cmd, char **argv, int doit); - static option_t Options[] = { -@@ -82,6 +83,8 @@ static option_t Options[] = { - "Be verbose about discovered access concentrators"}, - { "pppoe-mac", o_string, &pppoe_reqd_mac, - "Only connect to specified MAC address" }, -+ { "host-uniq", o_string, &host_uniq, -+ "Specify custom Host-Uniq" }, - { NULL } - }; - int (*OldDevnameHook)(char *cmd, char **argv, int doit) = NULL; -@@ -107,7 +110,6 @@ PPPOEInitDevice(void) - conn->ifName = devnam; - conn->discoverySocket = -1; - conn->sessionSocket = -1; -- conn->useHostUniq = 1; - conn->printACNames = printACNames; - conn->discoveryTimeout = PADI_TIMEOUT; - return 1; -@@ -163,6 +165,9 @@ PPPOEConnectDevice(void) - if (lcp_wantoptions[0].mru > ifr.ifr_mtu - TOTAL_OVERHEAD) - lcp_wantoptions[0].mru = ifr.ifr_mtu - TOTAL_OVERHEAD; - -+ if (host_uniq && !parseHostUniq(host_uniq, &conn->hostUniq)) -+ fatal("Illegal value for host-uniq option"); -+ - conn->acName = acName; - conn->serviceName = pppd_pppoe_service; - strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam)); ---- a/pppd/plugins/rp-pppoe/pppoe-discovery.c -+++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c -@@ -348,7 +348,7 @@ packetIsForMe(PPPoEConnection *conn, PPP - if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; - - /* If we're not using the Host-Unique tag, then accept the packet */ -- if (!conn->useHostUniq) return 1; -+ if (!conn->hostUniq.length) return 1; - - parsePacket(packet, parseForHostUniq, &forMe); - return forMe; -@@ -474,16 +474,12 @@ sendPADI(PPPoEConnection *conn) - cursor += namelen + TAG_HDR_SIZE; - - /* If we're using Host-Uniq, copy it over */ -- if (conn->useHostUniq) { -- PPPoETag hostUniq; -- pid_t pid = getpid(); -- hostUniq.type = htons(TAG_HOST_UNIQ); -- hostUniq.length = htons(sizeof(pid)); -- memcpy(hostUniq.payload, &pid, sizeof(pid)); -- CHECK_ROOM(cursor, packet.payload, sizeof(pid) + TAG_HDR_SIZE); -- memcpy(cursor, &hostUniq, sizeof(pid) + TAG_HDR_SIZE); -- cursor += sizeof(pid) + TAG_HDR_SIZE; -- plen += sizeof(pid) + TAG_HDR_SIZE; -+ if (conn->hostUniq.length) { -+ int len = ntohs(conn->hostUniq.length); -+ CHECK_ROOM(cursor, packet.payload, len + TAG_HDR_SIZE); -+ memcpy(cursor, &conn->hostUniq, len + TAG_HDR_SIZE); -+ cursor += len + TAG_HDR_SIZE; -+ plen += len + TAG_HDR_SIZE; - } - - packet.length = htons(plen); -@@ -645,7 +641,7 @@ int main(int argc, char *argv[]) - - memset(conn, 0, sizeof(PPPoEConnection)); - -- while ((opt = getopt(argc, argv, "I:D:VUAS:C:h")) > 0) { -+ while ((opt = getopt(argc, argv, "I:D:VUW:AS:C:h")) > 0) { - switch(opt) { - case 'S': - conn->serviceName = xstrdup(optarg); -@@ -654,7 +650,23 @@ int main(int argc, char *argv[]) - conn->acName = xstrdup(optarg); - break; - case 'U': -- conn->useHostUniq = 1; -+ if(conn->hostUniq.length) { -+ fprintf(stderr, "-U and -W are mutually exclusive\n"); -+ exit(EXIT_FAILURE); -+ } -+ char pidbuf[5]; -+ snprintf(pidbuf, sizeof(pidbuf), "%04x", getpid()); -+ parseHostUniq(pidbuf, &conn->hostUniq); -+ break; -+ case 'W': -+ if(conn->hostUniq.length) { -+ fprintf(stderr, "-U and -W are mutually exclusive\n"); -+ exit(EXIT_FAILURE); -+ } -+ if (!parseHostUniq(optarg, &conn->hostUniq)) { -+ fprintf(stderr, "Invalid host-uniq argument: %s\n", optarg); -+ exit(EXIT_FAILURE); -+ } - break; - case 'D': - conn->debugFile = fopen(optarg, "w"); ---- a/pppd/plugins/rp-pppoe/pppoe.h -+++ b/pppd/plugins/rp-pppoe/pppoe.h -@@ -21,6 +21,8 @@ - - #include /* For FILE */ - #include /* For pid_t */ -+#include -+#include - - /* How do we access raw Ethernet devices? */ - #undef USE_LINUX_PACKET -@@ -217,7 +219,7 @@ typedef struct PPPoEConnectionStruct { - char *serviceName; /* Desired service name, if any */ - char *acName; /* Desired AC name, if any */ - int synchronous; /* Use synchronous PPP */ -- int useHostUniq; /* Use Host-Uniq tag */ -+ PPPoETag hostUniq; /* Use Host-Uniq tag */ - int printACNames; /* Just print AC names */ - FILE *debugFile; /* Debug file for dumping packets */ - int numPADOs; /* Number of PADO packets received */ -@@ -273,6 +275,33 @@ void pppoe_printpkt(PPPoEPacket *packet, - void (*printer)(void *, char *, ...), void *arg); - void pppoe_log_packet(const char *prefix, PPPoEPacket *packet); - -+static inline int parseHostUniq(const char *uniq, PPPoETag *tag) -+{ -+ int i, len = strlen(uniq); -+ -+#define hex(x) \ -+ (((x) <= '9') ? ((x) - '0') : \ -+ (((x) <= 'F') ? ((x) - 'A' + 10) : \ -+ ((x) - 'a' + 10))) -+ -+ if (len % 2) -+ return 0; -+ -+ for (i = 0; i < len; i += 2) -+ { -+ if (!isxdigit(uniq[i]) || !isxdigit(uniq[i+1])) -+ return 0; -+ -+ tag->payload[i / 2] = (char)(16 * hex(uniq[i]) + hex(uniq[i+1])); -+ } -+ -+#undef hex -+ -+ tag->type = htons(TAG_HOST_UNIQ); -+ tag->length = htons(len / 2); -+ return 1; -+} -+ - #define SET_STRING(var, val) do { if (var) free(var); var = strDup(val); } while(0); - - #define CHECK_ROOM(cursor, start, len) \ diff --git a/package/network/services/ppp/patches/530-pppoe_send_padt.patch b/package/network/services/ppp/patches/530-pppoe_send_padt.patch deleted file mode 100644 index 40fa420216..0000000000 --- a/package/network/services/ppp/patches/530-pppoe_send_padt.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/rp-pppoe/plugin.c -+++ b/pppd/plugins/rp-pppoe/plugin.c -@@ -275,7 +275,7 @@ PPPOEDisconnectDevice(void) - sizeof(struct sockaddr_pppox)) < 0) - error("Failed to disconnect PPPoE socket: %d %m", errno); - close(conn->sessionSocket); -- /* don't send PADT?? */ -+ sendPADT(conn, NULL); - if (conn->discoverySocket >= 0) - close(conn->discoverySocket); - } diff --git a/package/network/services/ppp/patches/531-pppoe_no_disconnect_warning.patch b/package/network/services/ppp/patches/531-pppoe_no_disconnect_warning.patch deleted file mode 100644 index 799e961cd7..0000000000 --- a/package/network/services/ppp/patches/531-pppoe_no_disconnect_warning.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/pppd/plugins/rp-pppoe/plugin.c -+++ b/pppd/plugins/rp-pppoe/plugin.c -@@ -271,9 +271,8 @@ PPPOEDisconnectDevice(void) - sp.sa_addr.pppoe.sid = 0; - memcpy(sp.sa_addr.pppoe.dev, conn->ifName, IFNAMSIZ); - memcpy(sp.sa_addr.pppoe.remote, conn->peerEth, ETH_ALEN); -- if (connect(conn->sessionSocket, (struct sockaddr *) &sp, -- sizeof(struct sockaddr_pppox)) < 0) -- error("Failed to disconnect PPPoE socket: %d %m", errno); -+ connect(conn->sessionSocket, (struct sockaddr *) &sp, -+ sizeof(struct sockaddr_pppox)); - close(conn->sessionSocket); - sendPADT(conn, NULL); - if (conn->discoverySocket >= 0) diff --git a/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch b/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch index 7dd2ad844c..d6d44afbd0 100644 --- a/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch +++ b/package/network/services/ppp/patches/540-save-pppol2tp_fd_str.patch @@ -1,8 +1,8 @@ --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -148,6 +148,10 @@ static int setdevname_pppol2tp(char **ar - fatal("PPPoL2TP kernel driver not installed"); - } +@@ -152,6 +152,10 @@ static int setdevname_pppol2tp(char **ar + if (pppol2tp_fd_str == NULL) + novm("PPPoL2TP FD"); + pppol2tp_fd_str = strdup(*argv); + if (pppol2tp_fd_str == NULL) diff --git a/package/network/services/ppp/patches/550-fix-printer-args.patch b/package/network/services/ppp/patches/550-fix-printer-args.patch deleted file mode 100644 index 0eed9428a6..0000000000 --- a/package/network/services/ppp/patches/550-fix-printer-args.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/options.c -+++ b/pppd/options.c -@@ -1013,7 +1013,7 @@ print_option(opt, mainopt, printer, arg) - p = (char *) opt->addr2; - if ((opt->flags & OPT_STATIC) == 0) - p = *(char **)p; -- printer("%q", p); -+ printer(arg, "%q", p); - } else if (opt->flags & OPT_A2LIST) { - struct option_value *ovp; - diff --git a/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch b/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch new file mode 100644 index 0000000000..9676824f5f --- /dev/null +++ b/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch @@ -0,0 +1,94 @@ +From 831dca008699d485f2c8e91749657ef2d0b06166 Mon Sep 17 00:00:00 2001 +From: Martin Schiller +Date: Thu, 6 Dec 2018 08:43:17 +0100 +Subject: [PATCH] Revert "pppd: Use openssl for the DES instead of the libcrypt + / glibc" + +For musl and glibc2.27 we can keep linking to crypt; however if we +switch to glibc 2.28 we will have to link to one of the SSL libraries. + +This reverts commit 3c7b86229f7bd2600d74db14b1fe5b3896be3875. +--- + pppd/Makefile.linux | 7 +++---- + pppd/pppcrypt.c | 18 +++++++++--------- + 2 files changed, 12 insertions(+), 13 deletions(-) + +--- a/pppd/Makefile.linux ++++ b/pppd/Makefile.linux +@@ -35,10 +35,10 @@ endif + COPTS = -O2 -pipe -Wall -g + LIBS = + +-# Uncomment the next line to include support for Microsoft's ++# Uncomment the next 2 lines to include support for Microsoft's + # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. + CHAPMS=y +-#USE_CRYPT=y ++USE_CRYPT=y + # Don't use MSLANMAN unless you really know what you're doing. + #MSLANMAN=y + # Uncomment the next line to include support for MPPE. CHAPMS (above) must +@@ -140,8 +140,7 @@ endif + + ifdef NEEDDES + ifndef USE_CRYPT +-CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl +-LIBS += -lcrypto ++LIBS += -ldes $(LIBS) + else + CFLAGS += -DUSE_CRYPT=1 + endif +--- a/pppd/pppcrypt.c ++++ b/pppd/pppcrypt.c +@@ -64,7 +64,7 @@ u_char *des_key; /* OUT 64 bit DES key w + des_key[7] = Get7Bits(key, 49); + + #ifndef USE_CRYPT +- DES_set_odd_parity((DES_cblock *)des_key); ++ des_set_odd_parity((des_cblock *)des_key); + #endif + } + +@@ -158,25 +158,25 @@ u_char *clear; /* OUT 8 octets */ + } + + #else /* USE_CRYPT */ +-static DES_key_schedule key_schedule; ++static des_key_schedule key_schedule; + + bool + DesSetkey(key) + u_char *key; + { +- DES_cblock des_key; ++ des_cblock des_key; + MakeKey(key, des_key); +- DES_set_key(&des_key, &key_schedule); ++ des_set_key(&des_key, key_schedule); + return (1); + } + + bool +-DesEncrypt(clear, cipher) ++DesEncrypt(clear, key, cipher) + u_char *clear; /* IN 8 octets */ + u_char *cipher; /* OUT 8 octets */ + { +- DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, +- &key_schedule, 1); ++ des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, ++ key_schedule, 1); + return (1); + } + +@@ -185,8 +185,8 @@ DesDecrypt(cipher, clear) + u_char *cipher; /* IN 8 octets */ + u_char *clear; /* OUT 8 octets */ + { +- DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear, +- &key_schedule, 0); ++ des_ecb_encrypt((des_cblock *)cipher, (des_cblock *)clear, ++ key_schedule, 0); + return (1); + } + diff --git a/package/network/services/ppp/patches/700-radius-Prevent-buffer-overflow-in-rc_mksid.patch b/package/network/services/ppp/patches/700-radius-Prevent-buffer-overflow-in-rc_mksid.patch new file mode 100644 index 0000000000..1c5722e6dd --- /dev/null +++ b/package/network/services/ppp/patches/700-radius-Prevent-buffer-overflow-in-rc_mksid.patch @@ -0,0 +1,30 @@ +From 858976b1fc3107f1261aae337831959b511b83c2 Mon Sep 17 00:00:00 2001 +From: Paul Mackerras +Date: Sat, 4 Jan 2020 12:01:32 +1100 +Subject: [PATCH] radius: Prevent buffer overflow in rc_mksid() + +On some systems getpid() can return a value greater than 65535. +Increase the size of buf[] to allow for this, and use slprintf() +to make sure we never overflow it. + +Signed-off-by: Paul Mackerras +--- + pppd/plugins/radius/util.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pppd/plugins/radius/util.c b/pppd/plugins/radius/util.c +index 6f976a712951..740131e8377c 100644 +--- a/pppd/plugins/radius/util.c ++++ b/pppd/plugins/radius/util.c +@@ -73,9 +73,9 @@ void rc_mdelay(int msecs) + char * + rc_mksid (void) + { +- static char buf[15]; ++ static char buf[32]; + static unsigned short int cnt = 0; +- sprintf (buf, "%08lX%04X%02hX", ++ slprintf(buf, sizeof(buf), "%08lX%04X%02hX", + (unsigned long int) time (NULL), + (unsigned int) getpid (), + cnt & 0xFF); diff --git a/package/network/services/ppp/patches/701-pppd-Fix-bounds-check-in-EAP-code.patch b/package/network/services/ppp/patches/701-pppd-Fix-bounds-check-in-EAP-code.patch new file mode 100644 index 0000000000..c2ca9729ec --- /dev/null +++ b/package/network/services/ppp/patches/701-pppd-Fix-bounds-check-in-EAP-code.patch @@ -0,0 +1,37 @@ +From 8d7970b8f3db727fe798b65f3377fe6787575426 Mon Sep 17 00:00:00 2001 +From: Paul Mackerras +Date: Mon, 3 Feb 2020 15:53:28 +1100 +Subject: [PATCH] pppd: Fix bounds check in EAP code + +Given that we have just checked vallen < len, it can never be the case +that vallen >= len + sizeof(rhostname). This fixes the check so we +actually avoid overflowing the rhostname array. + +Reported-by: Ilja Van Sprundel +Signed-off-by: Paul Mackerras +--- + pppd/eap.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pppd/eap.c b/pppd/eap.c +index 94407f56a336..1b93db01aebd 100644 +--- a/pppd/eap.c ++++ b/pppd/eap.c +@@ -1420,7 +1420,7 @@ int len; + } + + /* Not so likely to happen. */ +- if (vallen >= len + sizeof (rhostname)) { ++ if (len - vallen >= sizeof (rhostname)) { + dbglog("EAP: trimming really long peer name down"); + BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1); + rhostname[sizeof (rhostname) - 1] = '\0'; +@@ -1846,7 +1846,7 @@ int len; + } + + /* Not so likely to happen. */ +- if (vallen >= len + sizeof (rhostname)) { ++ if (len - vallen >= sizeof (rhostname)) { + dbglog("EAP: trimming really long peer name down"); + BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1); + rhostname[sizeof (rhostname) - 1] = '\0'; diff --git a/package/network/services/ppp/patches/702-pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch b/package/network/services/ppp/patches/702-pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch new file mode 100644 index 0000000000..7286d81a56 --- /dev/null +++ b/package/network/services/ppp/patches/702-pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch @@ -0,0 +1,61 @@ +From 8d45443bb5c9372b4c6a362ba2f443d41c5636af Mon Sep 17 00:00:00 2001 +From: Paul Mackerras +Date: Mon, 3 Feb 2020 16:31:42 +1100 +Subject: [PATCH] pppd: Ignore received EAP messages when not doing EAP + +This adds some basic checks to the subroutines of eap_input to check +that we have requested or agreed to doing EAP authentication before +doing any processing on the received packet. The motivation is to +make it harder for a malicious peer to disrupt the operation of pppd +by sending unsolicited EAP packets. Note that eap_success() already +has a check that the EAP client state is reasonable, and does nothing +(apart from possibly printing a debug message) if not. + +Signed-off-by: Paul Mackerras +--- + pppd/eap.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/pppd/eap.c b/pppd/eap.c +index 1b93db01aebd..082e95343120 100644 +--- a/pppd/eap.c ++++ b/pppd/eap.c +@@ -1328,6 +1328,12 @@ int len; + int fd; + #endif /* USE_SRP */ + ++ /* ++ * Ignore requests if we're not open ++ */ ++ if (esp->es_client.ea_state <= eapClosed) ++ return; ++ + /* + * Note: we update es_client.ea_id *only if* a Response + * message is being generated. Otherwise, we leave it the +@@ -1736,6 +1742,12 @@ int len; + u_char dig[SHA_DIGESTSIZE]; + #endif /* USE_SRP */ + ++ /* ++ * Ignore responses if we're not open ++ */ ++ if (esp->es_server.ea_state <= eapClosed) ++ return; ++ + if (esp->es_server.ea_id != id) { + dbglog("EAP: discarding Response %d; expected ID %d", id, + esp->es_server.ea_id); +@@ -2047,6 +2059,12 @@ u_char *inp; + int id; + int len; + { ++ /* ++ * Ignore failure messages if we're not open ++ */ ++ if (esp->es_client.ea_state <= eapClosed) ++ return; ++ + if (!eap_client_active(esp)) { + dbglog("EAP unexpected failure message in state %s (%d)", + eap_state_name(esp->es_client.ea_state), From a95879a1dea9f05846d31455c3e683fd05e16c7c Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 20:01:48 -0800 Subject: [PATCH 05/10] luci-app-unblockmusic: add to default target --- include/target.mk | 2 +- package/lean/luci-app-unblockmusic/Config.in | 3 ++- package/lean/luci-app-unblockmusic/Makefile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/target.mk b/include/target.mk index cdc9238f83..de2f1deddb 100644 --- a/include/target.mk +++ b/include/target.mk @@ -16,7 +16,7 @@ DEVICE_TYPE?=router DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd \ block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget libustream-openssl ca-certificates \ default-settings luci luci-proto-relay luci-app-ddns luci-app-sqm luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot \ -luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus \ +luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic \ luci-app-zerotier luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \ luci-app-sfe luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol \ ddns-scripts_aliyun ddns-scripts_dnspod diff --git a/package/lean/luci-app-unblockmusic/Config.in b/package/lean/luci-app-unblockmusic/Config.in index cf7c75c6ff..9dae2dc0f0 100644 --- a/package/lean/luci-app-unblockmusic/Config.in +++ b/package/lean/luci-app-unblockmusic/Config.in @@ -1,8 +1,9 @@ config UnblockNeteaseMusic_Go bool "UnblockNeteaseMusic Golang Version" - default y + default y if x86||x86_64||arm||aarch64 config UnblockNeteaseMusic_NodeJS bool "UnblockNeteaseMusic NodeJS Version" depends on HAS_FPU || KERNEL_MIPS_FPU_EMULATOR + default y if x86||x86_64||arm||aarch64 diff --git a/package/lean/luci-app-unblockmusic/Makefile b/package/lean/luci-app-unblockmusic/Makefile index 5f021d2456..37a7218ff7 100644 --- a/package/lean/luci-app-unblockmusic/Makefile +++ b/package/lean/luci-app-unblockmusic/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-unblockmusic PKG_VERSION:=2.3.1 -PKG_RELEASE:=36 +PKG_RELEASE:=38 PKG_CONFIG_DEPENDS := \ CONFIG_UnblockNeteaseMusic_Go \ From 5799a958db89469330ac9194da6998bfc4775401 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 20:07:21 -0800 Subject: [PATCH 06/10] automount: add kmod-usb-storage-uas --- package/lean/automount/Makefile | 4 ++-- package/lean/luci-app-ssr-plus/Makefile | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package/lean/automount/Makefile b/package/lean/automount/Makefile index fca993f47b..d059506ef6 100644 --- a/package/lean/automount/Makefile +++ b/package/lean/automount/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=automount PKG_VERSION:=1 -PKG_RELEASE:=29 +PKG_RELEASE:=30 PKG_ARCH:=all include $(INCLUDE_DIR)/package.mk @@ -17,7 +17,7 @@ include $(INCLUDE_DIR)/package.mk define Package/automount TITLE:=Mount autoconfig hotplug script. MAINTAINER:=Lean - DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +kmod-fs-vfat +kmod-fs-ext4 +kmod-fs-exfat +ntfs-3g + DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +kmod-usb-storage-uas +kmod-fs-vfat +kmod-fs-ext4 +kmod-fs-exfat +ntfs-3g endef define Package/automount/description diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index b2606b1541..d7caa77c3c 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=164 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -11,27 +11,27 @@ include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME)/config config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks bool "Include Shadowsocks New Version" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs bool "Include Shadowsocks Simple-obfs Plugin" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin bool "Include Shadowsocks V2ray Plugin" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray bool "Include V2ray" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan bool "Include Trojan" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 bool "Include Redsocks2" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun bool "Include Kcptun" @@ -39,11 +39,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server bool "Include ShadowsocksR Server" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 config PACKAGE_$(PKG_NAME)_INCLUDE_DNS2SOCKS bool "Include DNS2SOCKS" - default y if x86_64 + default y if x86||x86_64||arm||aarch64 endef define Package/$(PKG_NAME) From 7a293422b72d0a1881a4c51af5303e43bc298f23 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sun, 8 Mar 2020 12:49:10 +0800 Subject: [PATCH 07/10] Revert "Update mt76 wireless driver. (#2782)" (#3650) This reverts commit 49e1a7c9b2a086ec4b6426e1d218364502f3d7ff. --- ...ckports-pci-Include-linux-pci-aspm.h.patch | 13 ---- ..._disable_link_state-wrapper-with-ret.patch | 32 -------- ...al-BSS-receive-time-to-survey-inform.patch | 77 ------------------- .../522-mac80211_configure_antenna_gain.patch | 4 +- package/kernel/mt76/Makefile | 10 +-- 5 files changed, 7 insertions(+), 129 deletions(-) delete mode 100644 package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch delete mode 100644 package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch delete mode 100644 package/kernel/mac80211/patches/subsys/368-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch diff --git a/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch b/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch deleted file mode 100644 index 99b40790f0..0000000000 --- a/package/kernel/mac80211/patches/build/100-backports-pci-Include-linux-pci-aspm.h.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/backport-include/linux/pci.h -+++ b/backport-include/linux/pci.h -@@ -3,6 +3,10 @@ - #include_next - #include - -+#if LINUX_VERSION_IS_LESS(5,4,0) -+#include -+#endif -+ - #ifndef module_pci_driver - /** - * module_pci_driver() - Helper macro for registering a PCI driver diff --git a/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch b/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch deleted file mode 100644 index 2b284c4e5e..0000000000 --- a/package/kernel/mac80211/patches/build/101-backport-add-pci_disable_link_state-wrapper-with-ret.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/backport-include/linux/pci.h -+++ b/backport-include/linux/pci.h -@@ -236,4 +236,29 @@ static inline struct pci_dev *pcie_find_ - (PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX) - #endif - -+#if defined(CONFIG_PCI) && LINUX_VERSION_IS_LESS(5,3,0) -+ -+static inline int -+LINUX_BACKPORT(pci_disable_link_state)(struct pci_dev *pdev, int state) -+{ -+ u16 aspmc; -+ -+ pci_disable_link_state(pdev, state); -+ -+ pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspmc); -+ if ((state & PCIE_LINK_STATE_L0S) && -+ (aspmc & PCI_EXP_LNKCTL_ASPM_L0S)) -+ return -EPERM; -+ -+ if ((state & PCIE_LINK_STATE_L1) && -+ (aspmc & PCI_EXP_LNKCTL_ASPM_L1)) -+ return -EPERM; -+ -+ return 0; -+} -+ -+#define pci_disable_link_state LINUX_BACKPORT(pci_disable_link_state) -+ -+#endif -+ - #endif /* _BACKPORT_LINUX_PCI_H */ diff --git a/package/kernel/mac80211/patches/subsys/368-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch b/package/kernel/mac80211/patches/subsys/368-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch deleted file mode 100644 index e6d384784e..0000000000 --- a/package/kernel/mac80211/patches/subsys/368-cfg80211-add-local-BSS-receive-time-to-survey-inform.patch +++ /dev/null @@ -1,77 +0,0 @@ -From: Felix Fietkau -Date: Wed, 28 Aug 2019 12:13:55 +0200 -Subject: [PATCH] cfg80211: add local BSS receive time to survey information - -This is useful for checking how much airtime is being used up by other -transmissions on the channel, e.g. by calculating (time_rx - time_bss_rx) -or (time_busy - time_bss_rx - time_tx) - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -668,6 +668,7 @@ ieee80211_chandef_max_power(struct cfg80 - * @SURVEY_INFO_TIME_RX: receive time was filled in - * @SURVEY_INFO_TIME_TX: transmit time was filled in - * @SURVEY_INFO_TIME_SCAN: scan time was filled in -+ * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in - * - * Used by the driver to indicate which info in &struct survey_info - * it has filled in during the get_survey(). -@@ -681,6 +682,7 @@ enum survey_info_flags { - SURVEY_INFO_TIME_RX = BIT(5), - SURVEY_INFO_TIME_TX = BIT(6), - SURVEY_INFO_TIME_SCAN = BIT(7), -+ SURVEY_INFO_TIME_BSS_RX = BIT(8), - }; - - /** -@@ -697,6 +699,7 @@ enum survey_info_flags { - * @time_rx: amount of time the radio spent receiving data - * @time_tx: amount of time the radio spent transmitting data - * @time_scan: amount of time the radio spent for scanning -+ * @time_bss_rx: amount of time the radio spent receiving data on a local BSS - * - * Used by dump_survey() to report back per-channel survey information. - * -@@ -711,6 +714,7 @@ struct survey_info { - u64 time_rx; - u64 time_tx; - u64 time_scan; -+ u64 time_bss_rx; - u32 filled; - s8 noise; - }; ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -3693,6 +3693,8 @@ enum nl80211_user_reg_hint_type { - * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan - * (on this channel or globally) - * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment -+ * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent -+ * receiving local BSS data - * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number - * currently defined - * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use -@@ -3709,6 +3711,7 @@ enum nl80211_survey_info { - NL80211_SURVEY_INFO_TIME_TX, - NL80211_SURVEY_INFO_TIME_SCAN, - NL80211_SURVEY_INFO_PAD, -+ NL80211_SURVEY_INFO_TIME_BSS_RX, - - /* keep last */ - __NL80211_SURVEY_INFO_AFTER_LAST, ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -8367,6 +8367,10 @@ static int nl80211_send_survey(struct sk - nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_SCAN, - survey->time_scan, NL80211_SURVEY_INFO_PAD)) - goto nla_put_failure; -+ if ((survey->filled & SURVEY_INFO_TIME_BSS_RX) && -+ nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BSS_RX, -+ survey->time_bss_rx, NL80211_SURVEY_INFO_PAD)) -+ goto nla_put_failure; - - nla_nest_end(msg, infoattr); - diff --git a/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch index cf4fdc13e9..81007b87cc 100644 --- a/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -2972,6 +2972,7 @@ struct cfg80211_external_auth_params { +@@ -2968,6 +2968,7 @@ struct cfg80211_external_auth_params { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3272,6 +3273,7 @@ struct cfg80211_ops { +@@ -3268,6 +3269,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 54a499ecc6..db0bf04d0a 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-01-04 -PKG_SOURCE_VERSION:=8a78567983a16869b77a0254b4917027df4a7ad9 -PKG_MIRROR_HASH:=0cc48bc7093b99dc7f43a5a83a3a00d205709326f529b91b0b14fe0d89cb783d +PKG_SOURCE_DATE:=2019-08-22 +PKG_SOURCE_VERSION:=2a0edbb4473b71dfaa4756f7189abf6cb7f7be8b +PKG_MIRROR_HASH:=a37975c179b929716c40d19fdcd5b131386d7f497eb8cd5d848be74e76d50d21 PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 @@ -246,12 +246,12 @@ define KernelPackage/mt7603/install endef define KernelPackage/mt7615e/install - $(INSTALL_DIR) $(1)/lib/firmware/mediatek + $(INSTALL_DIR) $(1)/lib/firmware cp \ $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \ - $(1)/lib/firmware/mediatek + $(1)/lib/firmware endef $(eval $(call KernelPackage,mt76-core)) From 53872fe931bbd54e49c2bdac9d354ba758b2f47b Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sun, 8 Mar 2020 12:49:24 +0800 Subject: [PATCH 08/10] elfutils: bump to 0.177 (#3648) commit: 40de4c0 elfutils: bump to 0.176 4760541 elfutils: Fix compile with uClibc-ng 0851ce4 elfutils: bump to 0.177 f4da28c elfutils: Add host build --- package/libs/elfutils/Makefile | 19 ++++++++++--------- .../patches/003-libintl-compatibility.patch | 2 +- .../elfutils/patches/100-musl-compat.patch | 13 ++----------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index 0b3cecdfbd..630c48820a 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -1,6 +1,5 @@ # -# Copyright (C) 2010-2014 OpenWrt.org -# Copyright (C) 2016-2017 Luiz Angelo Daros de Luca +# Copyright (C) 2010-2019 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,24 +7,25 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.175 -PKG_RELEASE:=4 +PKG_VERSION:=0.177 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=f7ef925541ee32c6d15ae5cb27da5f119e01a5ccdbe9fe57bf836730d7b7a65b +PKG_HASH:=fa489deccbcae7d8c920f60d85906124c1989c591196d90e0fd668e3dc05042e + PKG_MAINTAINER:=Luiz Angelo Daros de Luca -PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3 PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils -PKG_FIXUP:=autoreconf +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 PKG_USE_MIPS16:=0 - -PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone +PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/nls.mk define Package/elfutils/Default @@ -97,3 +97,4 @@ endef $(eval $(call BuildPackage,libasm)) $(eval $(call BuildPackage,libdw)) $(eval $(call BuildPackage,libelf)) +$(eval $(call HostBuild)) diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch index 35a27113eb..32bfaf8e6d 100644 --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch @@ -60,7 +60,7 @@ Requires.private: zlib --- a/configure.ac +++ b/configure.ac -@@ -538,6 +538,9 @@ AC_CONFIG_FILES([config/libelf.pc config +@@ -543,6 +543,9 @@ AC_CONFIG_FILES([config/libelf.pc config AC_SUBST(USE_NLS, yes) AM_PO_SUBDIRS diff --git a/package/libs/elfutils/patches/100-musl-compat.patch b/package/libs/elfutils/patches/100-musl-compat.patch index 9631ce05d6..109b7ece08 100644 --- a/package/libs/elfutils/patches/100-musl-compat.patch +++ b/package/libs/elfutils/patches/100-musl-compat.patch @@ -44,21 +44,12 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=21002 } --- a/libdwfl/dwfl_error.c +++ b/libdwfl/dwfl_error.c -@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error) - const char * - dwfl_errmsg (int error) - { -+ static __thread char s[64] = ""; - if (error == 0 || error == -1) - { - int last_error = global_error; -@@ -154,7 +155,8 @@ dwfl_errmsg (int error) +@@ -154,7 +154,7 @@ dwfl_errmsg (int error) switch (error &~ 0xffff) { case OTHER_ERROR (ERRNO): - return strerror_r (error & 0xffff, "bad", 0); -+ strerror_r (error & 0xffff, s, sizeof(s)); -+ return s; ++ return strerror_l (error & 0xffff, LC_GLOBAL_LOCALE); case OTHER_ERROR (LIBELF): return elf_errmsg (error & 0xffff); case OTHER_ERROR (LIBDW): From 6c9d45915956d06a81d35a10c6f867ecf9dc2e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A0=E7=81=AB?= <35611650+leaplu@users.noreply.github.com> Date: Sun, 8 Mar 2020 12:50:24 +0800 Subject: [PATCH 09/10] Add frps and luci-app-frps (#3572) --- package/lean/frps/Makefile | 70 +++++++ package/lean/luci-app-frps/Makefile | 39 ++++ .../luci-app-frps/luasrc/controller/frps.lua | 43 ++++ .../luasrc/model/cbi/frps/common.lua | 110 ++++++++++ .../luasrc/model/cbi/frps/server.lua | 43 ++++ .../luasrc/view/frps/status_header.htm | 29 +++ .../lean/luci-app-frps/root/etc/config/frps | 6 + .../lean/luci-app-frps/root/etc/init.d/frps | 189 ++++++++++++++++++ .../root/etc/uci-defaults/40_luci-frps | 25 +++ 9 files changed, 554 insertions(+) create mode 100644 package/lean/frps/Makefile create mode 100644 package/lean/luci-app-frps/Makefile create mode 100644 package/lean/luci-app-frps/luasrc/controller/frps.lua create mode 100644 package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua create mode 100644 package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua create mode 100644 package/lean/luci-app-frps/luasrc/view/frps/status_header.htm create mode 100644 package/lean/luci-app-frps/root/etc/config/frps create mode 100644 package/lean/luci-app-frps/root/etc/init.d/frps create mode 100644 package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps diff --git a/package/lean/frps/Makefile b/package/lean/frps/Makefile new file mode 100644 index 0000000000..ea9829162a --- /dev/null +++ b/package/lean/frps/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=frps +PKG_VERSION:=0.31.2 +PKG_RELEASE:=1 + +ifeq ($(ARCH),mipsel) + FRPC_ARCH:=mipsle +endif +ifeq ($(ARCH),mips) + FRPC_ARCH:=mips +endif +ifeq ($(ARCH),i386) + FRPC_ARCH:=386 +endif +ifeq ($(ARCH),x86_64) + FRPC_ARCH:=amd64 +endif +ifeq ($(ARCH),arm) + FRPC_ARCH:=arm +endif +ifeq ($(ARCH),aarch64) + FRPC_ARCH:=arm64 +endif + +PKG_LICENSE:=Apache-2.0 + +PKG_SOURCE_URL:=https://github.com/fatedier/frp/releases/download/v$(PKG_VERSION) +PKG_SOURCE:=frp_$(PKG_VERSION)_linux_$(FRPC_ARCH).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/frp_$(PKG_VERSION)_linux_$(FRPC_ARCH) +PKG_HASH:=skip + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=FRPC Client + DEPENDS:= + URL:=https://github.com/fatedier/frp/releases +endef + + + +define Package/$(PKG_NAME)/description +frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet +endef + +define Build/Prepare + $(PKG_UNPACK) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/frps $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/luci-app-frps/Makefile b/package/lean/luci-app-frps/Makefile new file mode 100644 index 0000000000..3637e79ee3 --- /dev/null +++ b/package/lean/luci-app-frps/Makefile @@ -0,0 +1,39 @@ +# +# Copyright 2020 Weizheng Li +# Licensed to the public under the MIT License. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-frps +PKG_VERSION:=0.0.1 +PKG_RELEASE:=1 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Weizheng Li + +LUCI_TITLE:=LuCI support for Frps +LUCI_DEPENDS:=+wget +frps +LUCI_PKGARCH:=all + +define Package/$(PKG_NAME)/conffiles +/etc/config/frps +endef + +include $(TOPDIR)/feeds/luci/luci.mk + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/uci-defaults/40_luci-frps ) && rm -f /etc/uci-defaults/40_luci-frps +fi + +chmod 755 "$${IPKG_INSTROOT}/etc/init.d/frps" >/dev/null 2>&1 +ln -sf "../init.d/frps" \ + "$${IPKG_INSTROOT}/etc/rc.d/S99frps" >/dev/null 2>&1 +exit 0 +endef + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-frps/luasrc/controller/frps.lua b/package/lean/luci-app-frps/luasrc/controller/frps.lua new file mode 100644 index 0000000000..94916c0bdd --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/controller/frps.lua @@ -0,0 +1,43 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local http = require "luci.http" +local uci = require "luci.model.uci".cursor() +local sys = require "luci.sys" + +module("luci.controller.frps", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/frps") then + return + end + + entry({"admin", "services", "frps"}, + firstchild(), _("Frps")).dependent = false + + entry({"admin", "services", "frps", "common"}, + cbi("frps/common"), _("Settings"), 1) + + entry({"admin", "services", "frps", "server"}, + cbi("frps/server"), _("Server"), 2).leaf = true + + entry({"admin", "services", "frps", "status"}, call("action_status")) +end + + +function action_status() + local running = false + + local client = uci:get("frps", "main", "client_file") + if client and client ~= "" then + local file_name = client:match(".*/([^/]+)$") or "" + if file_name ~= "" then + running = sys.call("pidof %s >/dev/null" % file_name) == 0 + end + end + + http.prepare_content("application/json") + http.write_json({ + running = running + }) +end diff --git a/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua b/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua new file mode 100644 index 0000000000..ba42f3da64 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua @@ -0,0 +1,110 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local uci = require "luci.model.uci".cursor() +local util = require "luci.util" +local fs = require "nixio.fs" +local sys = require "luci.sys" + +local m, s, o +local server_table = { } + +local function frps_version() + local file = uci:get("frps", "main", "client_file") + + if not file or file == "" or not fs.stat(file) then + return "%s" % translate("Invalid client file") + end + + if not fs.access(file, "rwx", "rx", "rx") then + fs.chmod(file, 755) + end + + local version = util.trim(sys.exec("%s -v 2>/dev/null" % file)) + if version == "" then + return "%s" % translate("Can't get client version") + end + return translatef("Version: %s", version) +end + +m = Map("frps", "%s - %s" % { translate("Frps"), translate("Common Settings") }, +"

%s

%s

" % { + translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."), + translatef("For more information, please visit: %s", + "https://github.com/fatedier/frp") +}) + +m:append(Template("frps/status_header")) + +s = m:section(NamedSection, "main", "frps") +s.addremove = false +s.anonymous = true + +s:tab("general", translate("General Options")) +s:tab("advanced", translate("Advanced Options")) +s:tab("dashboard", translate("Dashboard Options")) + +o = s:taboption("general", Flag, "enabled", translate("Enabled")) + +o = s:taboption("general", Value, "client_file", translate("Client file"), frps_version()) +o.datatype = "file" +o.rmempty = false + +o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user")) +o:value("", translate("-- default --")) +local user +for user in util.execi("cat /etc/passwd | cut -d':' -f1") do + o:value(user) +end + +o = s:taboption("general", Flag, "enable_logging", translate("Enable logging")) + +o = s:taboption("general", Value, "log_file", translate("Log file")) +o:depends("enable_logging", "1") +o.placeholder = "/var/log/frps.log" + +o = s:taboption("general", ListValue, "log_level", translate("Log level")) +o:depends("enable_logging", "1") +o:value("trace", translate("Trace")) +o:value("debug", translate("Debug")) +o:value("info", translate("Info")) +o:value("warn", translate("Warn")) +o:value("error", translate("Error")) +o.default = "warn" + +o = s:taboption("general", Value, "log_max_days", translate("Log max days")) +o:depends("enable_logging", "1") +o.datatype = "uinteger" +o.placeholder = '3' + +o = s:taboption("general", Value, "disable_log_color", translate("Disable log color")) +o:depends("enable_logging", "1") +o.enabled = "true" +o.disabled = "false" + +o = s:taboption("advanced", Value, "max_pool_count", translate("Max pool count"), + translate("pool_count in each proxy will change to max_pool_count if they exceed the maximum value")) +o.datatype = "uinteger" + +o = s:taboption("advanced", Value, "max_ports_per_client", translate("Max ports per-client"), + translate("max ports can be used for each client, default value is 0 means no limit")) +o.datatype = "uinteger" +o.defalut = '0' +o.placeholder = '0' + +o = s:taboption("advanced", Value, "subdomain_host", translate("Subdomain host"), + translatef("if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file; when subdomain is test, the host used by routing is test.frps.com")) +o.datatype = "host" + +o = s:taboption("dashboard", Value, "dashboard_addr", translate("Dashboard addr"), translatef("dashboard addr's default value is same with bind_addr")) +o.datatype = "host" + +o = s:taboption("dashboard", Value, "dashboard_port", translate("Dashboard port"), translatef("dashboard is available only if dashboard_port is set")) +o.datatype = "port" + +o = s:taboption("dashboard", Value, "dashboard_user", translate("Dashboard user"), translatef("dashboard user and passwd for basic auth protect, if not set, both default value is admin")) + +o = s:taboption("dashboard", Value, "dashboard_pwd", translate("Dashboard password")) +o.password = true + +return m diff --git a/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua b/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua new file mode 100644 index 0000000000..44d4b38ca6 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua @@ -0,0 +1,43 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local dsp = require "luci.dispatcher" + +local m, s, o + +m = Map("frps", "%s - %s" % { translate("Frps"), translate("FRPS Server setting") }) + +s = m:section(NamedSection, "main", "frps") +s.anonymous = true +s.addremove = false + +o = s:option(Value, "bind_port", translate("Bind port")) +o.datatype = "port" +o.rmempty = false + +o = s:option(Value, "token", translate("Token")) +o.password = true + +o = s:option(Flag, "tcp_mux", translate("TCP mux")) +o.enabled = "true" +o.disabled = "false" +o.defalut = o.enabled +o.rmempty = false + +o = s:option(Value, "bind_udp_port", translate("UDP bind port"), + translatef("Optional: udp port to help make udp hole to penetrate nat")) +o.datatype = "port" + +o = s:option(Value, "kcp_bind_port", translate("KCP bind port"), + translatef("Optional: udp port used for kcp protocol, it can be same with 'bind port'; if not set, kcp is disabled in frps")) +o.datatype = "port" + +o = s:option(Value, "vhost_http_port", translate("vhost http port"), + translatef("Optional: if you want to support virtual host, you must set the http port for listening")) +o.datatype = "port" + +o = s:option(Value, "vhost_https_port", translate("vhost https port"), + translatef("Optional: Note: http port and https port can be same with bind_port")) +o.datatype = "port" + +return m \ No newline at end of file diff --git a/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm b/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm new file mode 100644 index 0000000000..7df8bf9e64 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm @@ -0,0 +1,29 @@ +<%# + Copyright 2020 Weizheng Li + Licensed to the public under the MIT License. +-%> + +<% +local dsp = require "luci.dispatcher" +-%> + +
+

+ <%:Collecting data...%> +

+
+ + diff --git a/package/lean/luci-app-frps/root/etc/config/frps b/package/lean/luci-app-frps/root/etc/config/frps new file mode 100644 index 0000000000..ab15b33851 --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/config/frps @@ -0,0 +1,6 @@ +config frps 'main' + option enabled '0' + option server 'frps' + option client_file '/usr/bin/frps' + option bind_port '7000' + option tcp_mux 'true' \ No newline at end of file diff --git a/package/lean/luci-app-frps/root/etc/init.d/frps b/package/lean/luci-app-frps/root/etc/init.d/frps new file mode 100644 index 0000000000..b524c5e0be --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/init.d/frps @@ -0,0 +1,189 @@ +#!/bin/sh /etc/rc.common +# +# Copyright 2020 Weizheng Li +# Licensed to the public under the MIT License. +# + +START=99 +USE_PROCD=1 + +NAME="frps" +CONFIG_FOLDER="/var/etc/$NAME" + +_log() { + local level="$1" ; shift + local msg="$@" + logger -p "daemon.$level" -t "$NAME" "$msg" + + echo "[$level] $msg" >&2 +} + +_info() { + _log "info" $@ +} + +_err() { + _log "err" $@ +} + +append_options() { + local file="$1" ; shift + local o v + for o in "$@" ; do + v="$(eval echo "\$$o")" + if [ -n "$v" ] ; then + # add brackets when ipv6 address + if ( echo "$o" | grep -qE 'addr|ip' ) && + ( echo "$v" | grep -q ':' ) ; then + v="[$v]" + fi + + echo "${o} = $v" >>"$file" + fi + done +} + +append_setting() { + local file="$1" ; shift + local s="$1" + if [ -n "$s" ] ; then + echo "$s" >>"$file" + fi +} + +frps_scetion_validate() { + uci_validate_section "$NAME" "frps" "$1" \ + 'enabled:bool:0' \ + 'client_file:file:/usr/bin/frps' \ + 'run_user:string' \ + 'enable_logging:bool:0' \ + 'log_file:string:/var/log/frps.log' \ + 'log_level:or("trace", "debug", "info", "warn", "error"):warn' \ + 'log_max_days:uinteger:3' \ + 'disable_log_color:or("true", "false")' \ + 'max_pool_count:uinteger' \ + 'max_ports_per_client:uinteger:0' \ + 'subdomain_host:host' \ + 'dashboard_addr:host' \ + 'dashboard_port:port' \ + 'dashboard_user:string' \ + 'dashboard_pwd:string' \ + 'bind_port:port' \ + 'token:string' \ + 'tcp_mux:or("true", "false"):true' \ + 'bind_udp_port:port' \ + 'kcp_bind_port:port' \ + 'vhost_http_port:port' \ + 'vhost_https_port:port' +} + +client_file_validate() { + local file="$1" + + test -f "$file" || return 1 + test -x "$file" || chmod 755 "$file" + + eval "$file" -h | grep -q "$NAME" + return $? +} + +add_rule_extra_option() { + append_setting "$2" "$1" +} + +create_config_file() { + local config_file="$1" + local tmp_file="$(mktemp /tmp/frps-XXXXXX)" + + echo "[common]" > "$tmp_file" + + append_options "$tmp_file" \ + "bind_port" "token" "tcp_mux" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port" + + + if [ "x$enable_logging" = "x1" ] ; then + if [ -z "$log_file" ]; then + log_file="/var/log/frps.log" + fi + + append_options "$tmp_file" \ + "log_file" "log_level" "log_max_days" "disable_log_color" + + if [ -f "$log_file" ] ; then + echo > "$log_file" + else + local log_folder="$(dirname "$log_file")" + + if [ ! -d "$log_folder" ] ; then + mkdir -p "$log_folder" + fi + fi + + if [ -n "$run_user" ] && ( user_exists "$run_user" ) ; then + chmod 644 "$log_file" + chown "$run_user" "$log_file" + else + run_user="" + fi + fi + + append_options "$tmp_file" \ + "max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd" + + sed '/^$/d' "$tmp_file" >"$config_file" + + if [ "$?" = "0" ] ; then + rm -f "$tmp_file" + fi +} + +start_instance() { + local section="$1" + + if ! frps_scetion_validate "$section" ; then + _err "Config validate failed." + return 1 + fi + + if [ "x$enabled" != "x1" ] ; then + _info "Instance \"$section\" disabled." + return 1 + fi + + if [ -z "$client_file" ] || ( ! client_file_validate "$client_file" ) ; then + _err "Client file not valid." + return 1 + fi + + test -d "$CONFIG_FOLDER" || mkdir -p "$CONFIG_FOLDER" + + local config_file="$CONFIG_FOLDER/frps.$section.ini" + + create_config_file "$config_file" + + if [ ! -f "$config_file" ] ; then + _err "Could not create config file: \"$config_file\"" + return 1 + fi + + procd_open_instance "$NAME.$section" + procd_set_param command "$client_file" + procd_append_param command -c "$config_file" + procd_set_param respawn + procd_set_param file "$config_file" + + if [ -n "$run_user" ] ; then + procd_set_param user "$run_user" + fi + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "$NAME" +} + +start_service() { + config_load "$NAME" + config_foreach start_instance "frps" +} diff --git a/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps b/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps new file mode 100644 index 0000000000..b0f9d5783a --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps @@ -0,0 +1,25 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@frps[-1] + add ucitrack frps + set ucitrack.@frps[-1].init=frps + commit ucitrack +EOF + +frps=$(uci -q get frps.@frps[-1]) + +if [ -z "$frps" ]; then + uci -q add frps frps +fi + +if [ "x$frps" != "xmain" ]; then + uci -q batch <<-EOF >/dev/null + rename frps.@frps[-1]="main" + set frps.main.enabled="0" + commit frps + EOF +fi + +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +exit 0 From 19ec6b2511601e88ade445e807b199aafdda7933 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Sat, 7 Mar 2020 21:04:40 -0800 Subject: [PATCH 10/10] frp: instead of frpc and frps --- package/lean/frp/Makefile | 68 ++++++++++++++++++++++++++++++++++++ package/lean/frpc/Makefile | 70 -------------------------------------- package/lean/frps/Makefile | 70 -------------------------------------- 3 files changed, 68 insertions(+), 140 deletions(-) create mode 100644 package/lean/frp/Makefile delete mode 100644 package/lean/frpc/Makefile delete mode 100644 package/lean/frps/Makefile diff --git a/package/lean/frp/Makefile b/package/lean/frp/Makefile new file mode 100644 index 0000000000..0d6b4cd4c9 --- /dev/null +++ b/package/lean/frp/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2019 Xingwang Liao +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=frp +PKG_VERSION:=0.31.2 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/fatedier/frp/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=790a18f5651cc645a3d73fc147c719f5b212fc21db0c51c620011ee836b7a28f + +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Xingwang Liao + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/fatedier/frp +GO_PKG_BUILD_PKG:=github.com/fatedier/frp/cmd/... + +GO_PKG_LDFLAGS:=-s -w + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +define frp/templates + define Package/$(1) + TITLE:=A fast reverse proxy ($(1)) + URL:=https://github.com/fatedier/frp + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + DEPENDS:=$$(GO_ARCH_DEPENDS) + endef + + define Package/$(1)/description + frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall + to the internet. As of now, it supports tcp & udp, as well as httpand https protocols, + where requests can be forwarded to internal services by domain name. + + This package contains the $(1). + endef + + define Package/$(1)/install + $$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR)) + + $(STAGING_DIR_HOST)/bin/upx --lzma --best $(PKG_INSTALL_DIR)/usr/bin/$(1) + + $$(INSTALL_DIR) $$(1)/usr/bin + $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/ + endef +endef + +FRP_COMPONENTS:=frpc frps + +$(foreach component,$(FRP_COMPONENTS), \ + $(eval $(call frp/templates,$(component))) \ + $(eval $(call GoBinPackage,$(component))) \ + $(eval $(call BuildPackage,$(component))) \ +) \ No newline at end of file diff --git a/package/lean/frpc/Makefile b/package/lean/frpc/Makefile deleted file mode 100644 index e746daa7b0..0000000000 --- a/package/lean/frpc/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright (C) 2015-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v3. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=frpc -PKG_VERSION:=0.31.2 -PKG_RELEASE:=1 - -ifeq ($(ARCH),mipsel) - FRPC_ARCH:=mipsle -endif -ifeq ($(ARCH),mips) - FRPC_ARCH:=mips -endif -ifeq ($(ARCH),i386) - FRPC_ARCH:=386 -endif -ifeq ($(ARCH),x86_64) - FRPC_ARCH:=amd64 -endif -ifeq ($(ARCH),arm) - FRPC_ARCH:=arm -endif -ifeq ($(ARCH),aarch64) - FRPC_ARCH:=arm64 -endif - -PKG_LICENSE:=Apache-2.0 - -PKG_SOURCE_URL:=https://github.com/fatedier/frp/releases/download/v$(PKG_VERSION) -PKG_SOURCE:=frp_$(PKG_VERSION)_linux_$(FRPC_ARCH).tar.gz -PKG_BUILD_DIR:=$(BUILD_DIR)/frp_$(PKG_VERSION)_linux_$(FRPC_ARCH) -PKG_HASH:=skip - -include $(INCLUDE_DIR)/package.mk - -define Package/$(PKG_NAME) - SECTION:=net - CATEGORY:=Network - TITLE:=FRPC Client - DEPENDS:= - URL:=https://github.com/fatedier/frp/releases -endef - - - -define Package/$(PKG_NAME)/description -frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet -endef - -define Build/Prepare - $(PKG_UNPACK) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/$(PKG_NAME)/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/frpc $(1)/usr/bin/ -endef - -$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/frps/Makefile b/package/lean/frps/Makefile deleted file mode 100644 index ea9829162a..0000000000 --- a/package/lean/frps/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright (C) 2015-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v3. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=frps -PKG_VERSION:=0.31.2 -PKG_RELEASE:=1 - -ifeq ($(ARCH),mipsel) - FRPC_ARCH:=mipsle -endif -ifeq ($(ARCH),mips) - FRPC_ARCH:=mips -endif -ifeq ($(ARCH),i386) - FRPC_ARCH:=386 -endif -ifeq ($(ARCH),x86_64) - FRPC_ARCH:=amd64 -endif -ifeq ($(ARCH),arm) - FRPC_ARCH:=arm -endif -ifeq ($(ARCH),aarch64) - FRPC_ARCH:=arm64 -endif - -PKG_LICENSE:=Apache-2.0 - -PKG_SOURCE_URL:=https://github.com/fatedier/frp/releases/download/v$(PKG_VERSION) -PKG_SOURCE:=frp_$(PKG_VERSION)_linux_$(FRPC_ARCH).tar.gz -PKG_BUILD_DIR:=$(BUILD_DIR)/frp_$(PKG_VERSION)_linux_$(FRPC_ARCH) -PKG_HASH:=skip - -include $(INCLUDE_DIR)/package.mk - -define Package/$(PKG_NAME) - SECTION:=net - CATEGORY:=Network - TITLE:=FRPC Client - DEPENDS:= - URL:=https://github.com/fatedier/frp/releases -endef - - - -define Package/$(PKG_NAME)/description -frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet -endef - -define Build/Prepare - $(PKG_UNPACK) -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/$(PKG_NAME)/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/frps $(1)/usr/bin/ -endef - -$(eval $(call BuildPackage,$(PKG_NAME)))