diff --git a/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile b/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile index 4efaa66434919c71fc993dde1ba2b19b465266e7..8c80802784e8d4ba03b5ddb3a0bf5694a01b17a7 100644 --- a/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile +++ b/src/packages/fff/fff-hoods/files/usr/lib/functions/fff/hoodfile @@ -53,6 +53,30 @@ getWirelessHoodfile() { fi } +getEthernetHoodfile() { + if [ $# != 1 ]; then + echo "Usage: getEthernetHoodfile <target-file>" + return 1 + fi + file=$1 + + echo "Trying to get hoodfile from ethernet neighbor..." + + if ! ethmesh_dev=$(uci -q get network.ethmesh.ifname); then + # no ethmesh interface + return 1 + fi + + neighbor_addrs=$(ping6 -c2 ff02::1%"${ethmesh_dev}" | grep seq | grep DUP | cut -d " " -f4 | sed s/:$//g | sort -u) + + for addr in $neighbor_addrs; do + wget -T2 -t1 -qO "$file" "http://[${addr}%${ethmesh_dev}]:2342/keyxchangev2data" && return 0 + done + + # got no hoodfile + return 1 +} + getGatewayHoodfile() { if [ $# != 1 ]; then echo "Usage: getGatewayHoodfile <target-file>" diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 144063961b37a0be234a003a325ff5fdc479816d..1399e112b56f93dd3a96050fbc50a7ff72260b96 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -98,7 +98,7 @@ else sleep 30 # Wait for the config AP, which may be created at the same time as this script has started - getWirelessHoodfile "$hoodfile" + getEthernetHoodfile "$hoodfile" || getWirelessHoodfile "$hoodfile" #UPLINK: Set up uplink data on first contact: if [ -s /tmp/keyxchangev2data ]; then