Skip to content

Commit 1322647

Browse files
RickLiuM2A1T90MQ-9Ansuel
authored andcommitted
ppp: add reqprefix norelease ac_mac
Use ppp and enable autoipv6, odhcp6c supports reqprefix and norelease to minimize the chance of IPv6 PD changes.[1] PPPoE supports connecting to a specific AC/BRAS by using the pppoe-mac parameter.[2] 1. https://github.com/openwrt/openwrt/blob/master/package/network/ipv6/odhcp6c/files/dhcpv6.sh#L67 https://github.com/openwrt/openwrt/blob/master/package/network/ipv6/odhcp6c/files/dhcpv6.sh#L77 2. https://github.com/ppp-project/ppp/blob/master/pppd/plugins/pppoe/plugin.c#L93 Signed-off-by: Andy Chiang <[email protected]> Link: openwrt/openwrt#19978 Signed-off-by: Robert Marko <[email protected]> (cherry picked from commit 7079e45) Link: openwrt/openwrt#20824 Signed-off-by: Christian Marangi <[email protected]>
1 parent e781816 commit 1322647

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

package/network/services/ppp/files/lib/netifd/ppp6-up

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ if [ -n "$AUTOIPV6" ]; then
2626
[ -n "$ZONE" ] && json_add_string zone "$ZONE"
2727
[ -n "$EXTENDPREFIX" ] && json_add_string extendprefix 1
2828
[ -n "$IP6TABLE" ] && json_add_string ip6table $IP6TABLE
29+
[ -n "$REQPREFIX" ] && json_add_string reqprefix $REQPREFIX
2930
[ -n "$PEERDNS" ] && json_add_boolean peerdns $PEERDNS
3031
[ "$NOSOURCEFILTER" = "1" ] && json_add_boolean sourcefilter "0"
3132
[ "$DELEGATE" = "0" ] && json_add_boolean delegate "0"
33+
[ -n "$NORELEASE" ] && json_add_boolean norelease "1"
3234
json_close_object
3335
ubus call network add_dynamic "$(json_dump)"
3436
fi

package/network/services/ppp/files/ppp.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ ppp_generic_init_config() {
7979
proto_config_add_int mtu
8080
proto_config_add_string pppname
8181
proto_config_add_string unnumbered
82+
proto_config_add_string reqprefix
8283
proto_config_add_boolean persist
8384
proto_config_add_int maxfail
8485
proto_config_add_int holdoff
8586
proto_config_add_boolean sourcefilter
8687
proto_config_add_boolean delegate
88+
proto_config_add_boolean norelease
8789
}
8890

8991
ppp_generic_setup() {
9092
local config="$1"; shift
9193
local localip
9294

93-
json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns sourcefilter delegate
95+
json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered reqprefix persist maxfail holdoff peerdns sourcefilter delegate norelease
9496

9597
[ ! -e /proc/sys/net/ipv6 ] && ipv6=0 || json_get_var ipv6 ipv6
9698

@@ -101,6 +103,11 @@ ppp_generic_setup() {
101103
autoipv6=1
102104
fi
103105

106+
if [ "$autoipv6" != 1 ]; then
107+
reqprefix=""
108+
norelease=""
109+
fi
110+
104111
if [ "${demand:-0}" -gt 0 ]; then
105112
demand="precompiled-active-filter /etc/ppp/filter demand idle $demand"
106113
else
@@ -137,6 +144,7 @@ ppp_generic_setup() {
137144
[ -n "$disconnect" ] || json_get_var disconnect disconnect
138145
[ "$sourcefilter" = "0" ] || sourcefilter=""
139146
[ "$delegate" != "0" ] && delegate=""
147+
[ "$norelease" = "1" ] || norelease=""
140148

141149
proto_run_command "$config" /usr/sbin/pppd \
142150
nodetach ipparam "$config" \
@@ -145,6 +153,8 @@ ppp_generic_setup() {
145153
${lcp_failure:+lcp-echo-interval $lcp_interval lcp-echo-failure $lcp_failure $lcp_adaptive} \
146154
${ipv6:++ipv6} \
147155
${autoipv6:+set AUTOIPV6=1} \
156+
${reqprefix:+set REQPREFIX=$reqprefix} \
157+
${norelease:+set NORELEASE=1} \
148158
${ip6table:+set IP6TABLE=$ip6table} \
149159
${peerdns:+set PEERDNS=$peerdns} \
150160
${sourcefilter:+set NOSOURCEFILTER=1} \
@@ -215,6 +225,7 @@ proto_pppoe_init_config() {
215225
ppp_generic_init_config
216226
proto_config_add_string "ac"
217227
proto_config_add_string "service"
228+
proto_config_add_string "ac_mac"
218229
proto_config_add_string "host_uniq"
219230
proto_config_add_int "padi_attempts"
220231
proto_config_add_int "padi_timeout"
@@ -233,6 +244,7 @@ proto_pppoe_setup() {
233244

234245
json_get_var ac ac
235246
json_get_var service service
247+
json_get_var ac_mac ac_mac
236248
json_get_var host_uniq host_uniq
237249
json_get_var padi_attempts padi_attempts
238250
json_get_var padi_timeout padi_timeout
@@ -241,6 +253,7 @@ proto_pppoe_setup() {
241253
plugin pppoe.so \
242254
${ac:+rp_pppoe_ac "$ac"} \
243255
${service:+rp_pppoe_service "$service"} \
256+
${ac_mac:+pppoe-mac "$ac_mac"} \
244257
${host_uniq:+host-uniq "$host_uniq"} \
245258
${padi_attempts:+pppoe-padi-attempts $padi_attempts} \
246259
${padi_timeout:+pppoe-padi-timeout $padi_timeout} \

0 commit comments

Comments
 (0)