aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorRosy Song <rosysong@rosinson.com>2018-08-04 19:01:18 +0800
committerJo-Philipp Wich <jo@mein.io>2018-12-18 10:27:36 +0100
commit63a87b4c7a537afdc0c8c3507e29f5bf79b0bfd8 (patch)
tree402ae48cc4cc84bffee0438f89799a59a0ce3959 /package
parentc58c31bf99749b644ff1a3851d361417ef204cc5 (diff)
downloadupstream-63a87b4c7a537afdc0c8c3507e29f5bf79b0bfd8.tar.gz
upstream-63a87b4c7a537afdc0c8c3507e29f5bf79b0bfd8.tar.bz2
upstream-63a87b4c7a537afdc0c8c3507e29f5bf79b0bfd8.zip
base-files: do not add relevant sections & options except when ipv6 is support in kernel
Signed-off-by: Rosy Song <rosysong@rosinson.com> (backported from 2b637e5ab8ae24ff4176930f259dce195983d7ea)
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/bin/config_generate42
1 files changed, 26 insertions, 16 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index fa148685cc..c8b253da5b 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -15,10 +15,14 @@ generate_static_network() {
set network.loopback.proto='static'
set network.loopback.ipaddr='127.0.0.1'
set network.loopback.netmask='255.0.0.0'
- delete network.globals
- set network.globals='globals'
- set network.globals.ula_prefix='auto'
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
json_select dsl
@@ -102,21 +106,23 @@ generate_network() {
set network.$1.proto='static'
set network.$1.ipaddr='$ipad'
set network.$1.netmask='$netm'
- set network.$1.ip6assign='60'
EOF
+ [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
;;
dhcp)
# fixup IPv6 slave interface if parent is a bridge
[ "$type" = "bridge" ] && ifname="br-$1"
- uci -q batch <<-EOF
- set network.$1.proto='dhcp'
- delete network.${1}6
- set network.${1}6='interface'
- set network.${1}6.ifname='$ifname'
- set network.${1}6.proto='dhcpv6'
- EOF
+ uci set network.$1.proto='dhcp'
+ [ -e /proc/sys/net/ipv6 ] && {
+ uci -q batch <<-EOF
+ delete network.${1}6
+ set network.${1}6='interface'
+ set network.${1}6.ifname='$ifname'
+ set network.${1}6.proto='dhcpv6'
+ EOF
+ }
;;
pppoe)
@@ -124,12 +130,16 @@ generate_network() {
set network.$1.proto='pppoe'
set network.$1.username='username'
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
+ [ -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
}