Properly support devices with only one ethernet interface

This commit is contained in:
Matthias Schiffer 2014-01-22 20:44:34 +01:00
parent bb4a9fd5af
commit b8820bab61
2 changed files with 17 additions and 3 deletions

View File

@ -15,7 +15,14 @@ get_primary_mac() {
esac esac
} }
lan_ifname="$(uci get network.lan.ifname)"
wan_ifname="$(uci get network.wan.ifname)"
if [ -n "$wan_ifname" ]; then
[ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname"
sysconfig_set wan_ifname "$wan_ifname"
else
sysconfig_set wan_ifname "$lan_ifname"
fi
sysconfig_set lan_ifname "$(uci get network.lan.ifname)"
sysconfig_set wan_ifname "$(uci get network.wan.ifname)"
sysconfig_set primary_mac "$(get_primary_mac)" sysconfig_set primary_mac "$(get_primary_mac)"

View File

@ -3,9 +3,16 @@
. /lib/functions.sh . /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh . /lib/gluon/functions/sysconfig.sh
lan_ifname="$(sysconfig lan_ifname)"
uci_add network interface client uci_add network interface client
uci_set network client ifname "$(sysconfig lan_ifname) bat0"
if [ -n "$lan_ifname" ]; then
uci_set network client ifname "$lan_ifname bat0"
else
uci_set network client ifname "bat0"
fi
uci_set network client type 'bridge' uci_set network client type 'bridge'
uci_set network client proto 'dhcpv6' uci_set network client proto 'dhcpv6'
uci_set network client reqprefix 'no' uci_set network client reqprefix 'no'