summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2015-04-30 17:26:47 +0000
committerDaniel Golle2015-04-30 17:34:10 +0000
commite26942118bced52ead0ce753f3c9d931436110b0 (patch)
treedf8aa26a2b5f49860374fa78c22d23f8e7f86abb
parent25d637576d44a5c1ab01b7895e92898d9cf1e8ca (diff)
downloadrouting-e26942118bced52ead0ce753f3c9d931436110b0.tar.gz
cjdns: uci-defaults: work around missing lan interface
The current uci-defaults scripts assumes than a network interface named 'lan' always exists. Check if this is true before adding ETHInterface section. This is a temporary work-around until cjdrouteconf gets the Linux interface from netifd via ubus... Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--cjdns/files/cjdns.defaults30
1 files changed, 16 insertions, 14 deletions
diff --git a/cjdns/files/cjdns.defaults b/cjdns/files/cjdns.defaults
index 0624daf..f2baf6d 100644
--- a/cjdns/files/cjdns.defaults
+++ b/cjdns/files/cjdns.defaults
@@ -22,22 +22,24 @@ EOF
exit 1
fi
- # enable auto-peering on ethernet
- uci show network.lan | grep bridge >/dev/null 2>&1
+ # enable auto-peering on ethernet interface lan, if existing
+ uci get network.lan | grep interface >/dev/null 2>&1
if [ $? -eq 0 ]; then
- # most routers will set up an ethernet bridge for the lan
- ifname="br-lan"
- else
- # docker containers don't have permission to create bridges by default,
- # so we bind to the underlying interface instead (likely eth0)
- ifname=`uci get network.lan.ifname`
- fi
- uci -q batch <<-EOF >/dev/null
- add cjdns eth_interface
- set cjdns.@eth_interface[-1].beacon=2
- set cjdns.@eth_interface[-1].bind=$ifname
+ uci get network.lan.type | grep bridge >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # most routers will set up an ethernet bridge for the lan
+ ifname="br-lan"
+ else
+ # docker containers don't have permission to create bridges by default,
+ # so we bind to the underlying interface instead (likely eth0)
+ ifname=`uci get network.lan.ifname`
+ fi
+ uci -q batch <<-EOF >/dev/null
+ add cjdns eth_interface
+ set cjdns.@eth_interface[-1].beacon=2
+ set cjdns.@eth_interface[-1].bind=$ifname
EOF
-
+ fi
# set the tun interface name
uci set cjdns.cjdns.tun_device=tuncjdns