[openwrt/openwrt] ppp: add sourcefilter option support

LEDE Commits lede-commits at lists.infradead.org
Mon Apr 22 00:13:16 PDT 2024


981213 pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/34161444184f62914652e505758353e517e5c6ac

commit 34161444184f62914652e505758353e517e5c6ac
Author: Chen Minqiang <ptpt52 at gmail.com>
AuthorDate: Mon Jan 22 22:35:41 2024 +0800

    ppp: add sourcefilter option support
    
    This make source based IPv6 routing option available for
    ppp/pptp/pppoe/pppoa
    
    Signed-off-by: Chen Minqiang <ptpt52 at gmail.com>
---
 package/network/services/ppp/files/lib/netifd/ppp6-up | 1 +
 package/network/services/ppp/files/ppp.sh             | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/network/services/ppp/files/lib/netifd/ppp6-up b/package/network/services/ppp/files/lib/netifd/ppp6-up
index 3852bf63ff..9355f59678 100755
--- a/package/network/services/ppp/files/lib/netifd/ppp6-up
+++ b/package/network/services/ppp/files/lib/netifd/ppp6-up
@@ -27,6 +27,7 @@ if [ -n "$AUTOIPV6" ]; then
 	[ -n "$EXTENDPREFIX" ] && json_add_string extendprefix 1
 	[ -n "$IP6TABLE" ] && json_add_string ip6table $IP6TABLE
 	[ -n "$PEERDNS" ] && json_add_boolean peerdns $PEERDNS
+	[ "$NOSOURCEFILTER" = "1" ] && json_add_boolean sourcefilter "0"
 	json_close_object
 	ubus call network add_dynamic "$(json_dump)"
 fi
diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh
index 6d3a8e29ff..074c1f12c8 100755
--- a/package/network/services/ppp/files/ppp.sh
+++ b/package/network/services/ppp/files/ppp.sh
@@ -82,13 +82,14 @@ ppp_generic_init_config() {
 	proto_config_add_boolean persist
 	proto_config_add_int maxfail
 	proto_config_add_int holdoff
+	proto_config_add_boolean sourcefilter
 }
 
 ppp_generic_setup() {
 	local config="$1"; shift
 	local localip
 
-	json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns
+	json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns sourcefilter
 
 	[ ! -e /proc/sys/net/ipv6 ] && ipv6=0 || json_get_var ipv6 ipv6
 
@@ -133,6 +134,7 @@ ppp_generic_setup() {
 	[ "${keepalive_adaptive:-1}" -lt 1 ] && lcp_adaptive=""
 	[ -n "$connect" ] || json_get_var connect connect
 	[ -n "$disconnect" ] || json_get_var disconnect disconnect
+	[ "$sourcefilter" = "0" ] || sourcefilter=""
 
 	proto_run_command "$config" /usr/sbin/pppd \
 		nodetach ipparam "$config" \
@@ -143,6 +145,7 @@ ppp_generic_setup() {
 		${autoipv6:+set AUTOIPV6=1} \
 		${ip6table:+set IP6TABLE=$ip6table} \
 		${peerdns:+set PEERDNS=$peerdns} \
+		${sourcefilter:+set NOSOURCEFILTER=1} \
 		nodefaultroute \
 		usepeerdns \
 		$demand $persist maxfail $maxfail \




More information about the lede-commits mailing list