base-files: do not add relevant sections & options except when ipv6 is support in kernel
Signed-off-by: Rosy Song <rosysong@rosinson.com>
This commit is contained in:
parent
18a2595315
commit
2b637e5ab8
1 changed files with 26 additions and 16 deletions
|
@ -15,10 +15,14 @@ generate_static_network() {
|
||||||
set network.loopback.proto='static'
|
set network.loopback.proto='static'
|
||||||
set network.loopback.ipaddr='127.0.0.1'
|
set network.loopback.ipaddr='127.0.0.1'
|
||||||
set network.loopback.netmask='255.0.0.0'
|
set network.loopback.netmask='255.0.0.0'
|
||||||
delete network.globals
|
|
||||||
set network.globals='globals'
|
|
||||||
set network.globals.ula_prefix='auto'
|
|
||||||
EOF
|
EOF
|
||||||
|
[ -e /proc/sys/net/ipv6 ] && {
|
||||||
|
uci -q batch <<-EOF
|
||||||
|
delete network.globals
|
||||||
|
set network.globals='globals'
|
||||||
|
set network.globals.ula_prefix='auto'
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
if json_is_a dsl object; then
|
if json_is_a dsl object; then
|
||||||
json_select dsl
|
json_select dsl
|
||||||
|
@ -102,21 +106,23 @@ generate_network() {
|
||||||
set network.$1.proto='static'
|
set network.$1.proto='static'
|
||||||
set network.$1.ipaddr='$ipad'
|
set network.$1.ipaddr='$ipad'
|
||||||
set network.$1.netmask='$netm'
|
set network.$1.netmask='$netm'
|
||||||
set network.$1.ip6assign='60'
|
|
||||||
EOF
|
EOF
|
||||||
|
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dhcp)
|
dhcp)
|
||||||
# fixup IPv6 slave interface if parent is a bridge
|
# fixup IPv6 slave interface if parent is a bridge
|
||||||
[ "$type" = "bridge" ] && ifname="br-$1"
|
[ "$type" = "bridge" ] && ifname="br-$1"
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci set network.$1.proto='dhcp'
|
||||||
set network.$1.proto='dhcp'
|
[ -e /proc/sys/net/ipv6 ] && {
|
||||||
delete network.${1}6
|
uci -q batch <<-EOF
|
||||||
set network.${1}6='interface'
|
delete network.${1}6
|
||||||
set network.${1}6.ifname='$ifname'
|
set network.${1}6='interface'
|
||||||
set network.${1}6.proto='dhcpv6'
|
set network.${1}6.ifname='$ifname'
|
||||||
EOF
|
set network.${1}6.proto='dhcpv6'
|
||||||
|
EOF
|
||||||
|
}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
pppoe)
|
pppoe)
|
||||||
|
@ -124,12 +130,16 @@ generate_network() {
|
||||||
set network.$1.proto='pppoe'
|
set network.$1.proto='pppoe'
|
||||||
set network.$1.username='username'
|
set network.$1.username='username'
|
||||||
set network.$1.password='password'
|
set network.$1.password='password'
|
||||||
set network.$1.ipv6='1'
|
|
||||||
delete network.${1}6
|
|
||||||
set network.${1}6='interface'
|
|
||||||
set network.${1}6.ifname='@${1}'
|
|
||||||
set network.${1}6.proto='dhcpv6'
|
|
||||||
EOF
|
EOF
|
||||||
|
[ -e /proc/sys/net/ipv6 ] && {
|
||||||
|
uci -q batch <<-EOF
|
||||||
|
set network.$1.ipv6='1'
|
||||||
|
delete network.${1}6
|
||||||
|
set network.${1}6='interface'
|
||||||
|
set network.${1}6.ifname='@${1}'
|
||||||
|
set network.${1}6.proto='dhcpv6'
|
||||||
|
EOF
|
||||||
|
}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue