summaryrefslogtreecommitdiffhomepage
path: root/contrib/package
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2012-06-03 08:46:46 +0000
committerManuel Munz <freifunk@somakoma.de>2012-06-03 08:46:46 +0000
commit67e8793393935d07160d848801d4ce8c2feb6f45 (patch)
tree30fe1680ee0d76cedf0145aba4652f639e7c3dfd /contrib/package
parent5ff3e0d7ba083c08c7ff57ffabf6f6d3865fac90 (diff)
contrib/meshwizard: Fix getting of mac address when the interface is not up yet, fix typo in setup_olsrd.sh
Diffstat (limited to 'contrib/package')
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh13
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh6
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh2
3 files changed, 13 insertions, 8 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
index e10677cc9f..114c8f9c11 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/gen_auto-ipv6-dhcpv6-ip.sh
@@ -1,7 +1,16 @@
#!/bin/sh
+netrenamed=$1
+
local PREFIX="$(echo $profile_ipv6_prefix| cut -d "/" -f 1| sed 's/::/:/')"
-local MAC="$(ifconfig $1 |grep HWaddr | awk '{ print $5 '})"
-local IPV6_UNIQ="$(echo $MAC | awk -F: '{ print $1$2":"$3$4":"$5$6 }')"
+
+# Get the devices mac address
+local device="$(uci -p/var/state -q get network.$1.ifname)"
+if [ -n "$device" ]; then
+ local MAC="$(ifconfig $netrenamed |grep HWaddr | awk '{ print $5 '})"
+else
+ local MAC="$(cat /sys/class/net/$1/address)"
+ local IPV6_UNIQ="$(echo $MAC | awk -F: '{ print $1$2":"$3$4":"$5$6 }')"
+fi
echo "${PREFIX}${IPV6_UNIQ}:1"
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
index fc3ca9d1b3..c3647c42dc 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
@@ -27,11 +27,7 @@ EOF
local ip6addr
if [ "$profile_ipv6" = 1 ]; then
if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
- # get interface mac
- local device="$(uci -p/var/state -q get network.$netrenamed.ifname)"
- if [ -n "device" ]; then
- ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $device)"
- fi
+ ip6addr="$($dir/helpers/gen_auto-ipv6-dhcpv6-ip.sh $netrenamed)"
uci set network.$netrenamed.ip6addr="${ip6addr}/112"
fi
fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
index f7ba95e860..29258694dc 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
@@ -22,7 +22,7 @@ handle_interfacedefaults() {
config_foreach handle_interfacedefaults InterfaceDefaults
# Set basic olsrd settings
-if [ "profile_ipv6" = 1 ]; then
+if [ "$profile_ipv6" = 1 ]; then
uci set olsrd.olsrd.IpVersion="6and4"
fi
uci_commitverbose "Setup olsr basic settings" olsrd