Message ID | 20171006214739.16201-1-fabian@blaese.de |
---|---|
State | Superseded |
Headers | show |
diff --git a/community/franken.cfg b/community/franken.cfg index 833e98e..3ea5353 100644 --- a/community/franken.cfg +++ b/community/franken.cfg @@ -3,6 +3,7 @@ BATMAN_CHANNEL_5GHZ=36 ESSID_AP=franken.freifunk.net ESSID_MESH=batman.franken.freifunk.net BSSID_MESH=02:CA:FF:EE:BA:BE +MESH_ID=mesh.franken.freifunk.net VPN_PROJECT=fff NTPD_IP=fe80::ff:feee:1%br-mesh UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 264a308..4c131e6 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -119,6 +119,7 @@ if [ -s /tmp/keyxchangev2data ]; then json_select hood json_get_var hood name + json_get_var mesh_id mesh_id json_get_var mesh_bssid mesh_bssid json_get_var mesh_essid mesh_essid json_get_var essid essid @@ -126,10 +127,10 @@ if [ -s /tmp/keyxchangev2data ]; then # i think the next things we don't active this in the first version! we can do it later #json_get_var channel2 channel2 #json_get_var mode2 mode2 - #json_get_var type2 type2 + json_get_var type2 type2 #json_get_var channel5 channel5 #json_get_var mode5 mode5 - #json_get_var type5 type5 + json_get_var type5 type5 #json_get_var protocol protocol json_select ".." # back to root @@ -155,9 +156,20 @@ if [ -s /tmp/keyxchangev2data ]; then # here we set a bit for add hidden AP touch /tmp/hiddenapflag - if ! wifiAddAdHocMesh "$radio" "$mesh_essid" "$mesh_bssid"; then - echo "Can't add AP interface on $radio." - exit 1 + # add 802.11s mesh if type == "802.11s" + if [ -n "$radio5" ] && [ "$type5" == "802.11s" ] || [ "$type2" == "802.11s" ]; then + if ! wifiAddMesh "$radio" "$mesh_id"; then + echo "Can't add Mesh interface on $radio." + exit 1 + fi + fi + + # add IBSS mesh if type == "ibss" + if [ -n "$radio5" ] && [ "$type5" == "ibss" ] || [ "$type2" == "ibss" ]; then + if ! wifiAddAdHocMesh "$radio" "$mesh_essid" "$mesh_bssid"; then + echo "Can't add AdHocMesh interface on $radio." + exit 1 + fi fi done diff --git a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless index 2c6dff8..238022a 100644 --- a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless +++ b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless @@ -83,9 +83,9 @@ wifiAddAdHocMesh() { local bssid=$3 local channel=$(uci get "wireless.${radio}.channel") - local iface="w2mesh" + local iface="w2ibss" if [ "$channel" -gt "14" ]; then - iface="w5mesh" + iface="w5ibss" fi uci batch <<-__EOF__ @@ -177,4 +177,38 @@ wifiAddSta() { return 0 } +wifiAddMesh() { + if [ $# -ne "2" ] + then + echo "Usage: wifiAddMesh <radio> <mesh-id>" + fi + + local radio=$1 + local mesh_id=$2 + + local channel=$(uci get "wireless.${radio}.channel") + local iface="w2mesh" + if [ "$channel" -gt "14" ]; then + iface="w5mesh" + fi + uci batch <<-__EOF__ + set wireless.${iface}='wifi-iface' + set wireless.${iface}.device='${radio}' + set wireless.${iface}.network='${iface}' + set wireless.${iface}.ifname='${iface}' + set wireless.${iface}.mode='mesh' + set wireless.${iface}.mesh_id='${mesh_id}' + set wireless.${iface}.encryption='none' + set wireless.${iface}.mesh_fwding=0 + commit wireless + + set network.${iface}='interface' + set network.${iface}.mtu='1528' + set network.${iface}.proto='batadv' + set network.${iface}.mesh='bat0' + commit network + __EOF__ + + echo "${iface}" +} # vim: set noexpandtab:tabstop=4
Hallo, siehe unten. > -----Original Message----- > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf > Of Fabian Bläse > Sent: Freitag, 6. Oktober 2017 23:48 > To: franken-dev@freifunk.net > Subject: [PATCH] Support batman-adv meshing over 802.11s > > Signed-off-by: Fabian Bläse <fabian@blaese.de> > --- > community/franken.cfg | 1 + > .../fff/fff-hoods/files/usr/sbin/configurehood | 22 ++++++++++--- > .../fff-wireless/files/lib/functions/fff/wireless | 38 > ++++++++++++++++++++-- > 3 files changed, 54 insertions(+), 7 deletions(-) > > diff --git a/community/franken.cfg b/community/franken.cfg index > 833e98e..3ea5353 100644 > --- a/community/franken.cfg > +++ b/community/franken.cfg > @@ -3,6 +3,7 @@ BATMAN_CHANNEL_5GHZ=36 > ESSID_AP=franken.freifunk.net > ESSID_MESH=batman.franken.freifunk.net > BSSID_MESH=02:CA:FF:EE:BA:BE > +MESH_ID=mesh.franken.freifunk.net > VPN_PROJECT=fff > NTPD_IP=fe80::ff:feee:1%br-mesh > UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current > diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > index 264a308..4c131e6 100755 > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood > @@ -119,6 +119,7 @@ if [ -s /tmp/keyxchangev2data ]; then > json_select hood > > json_get_var hood name > + json_get_var mesh_id mesh_id > json_get_var mesh_bssid mesh_bssid > json_get_var mesh_essid mesh_essid > json_get_var essid essid > @@ -126,10 +127,10 @@ if [ -s /tmp/keyxchangev2data ]; then > # i think the next things we don't active this in the first > version! we can do it later > #json_get_var channel2 channel2 > #json_get_var mode2 mode2 > - #json_get_var type2 type2 > + json_get_var type2 type2 > #json_get_var channel5 channel5 > #json_get_var mode5 mode5 > - #json_get_var type5 type5 > + json_get_var type5 type5 Wurde der Name jetzt doch nicht auf mesh_type geändert? > #json_get_var protocol protocol > > json_select ".." # back to root > @@ -155,9 +156,20 @@ if [ -s /tmp/keyxchangev2data ]; then > # here we set a bit for add hidden AP > touch /tmp/hiddenapflag > > - if ! wifiAddAdHocMesh "$radio" "$mesh_essid" > "$mesh_bssid"; then > - echo "Can't add AP interface on $radio." > - exit 1 > + # add 802.11s mesh if type == "802.11s" > + if [ -n "$radio5" ] && [ "$type5" == "802.11s" ] || [ > "$type2" == "802.11s" ]; then Ich finde solche Multiconditions immer ganz schlimm, weil man stundenlang überlegen muss. Magst du Klammern hinmachen? Das kostet nichts und macht viel Freude! > + if ! wifiAddMesh "$radio" "$mesh_id"; then > + echo "Can't add Mesh interface on > $radio." > + exit 1 > + fi > + fi > + > + # add IBSS mesh if type == "ibss" > + if [ -n "$radio5" ] && [ "$type5" == "ibss" ] || [ > "$type2" == "ibss" ]; then Klammern bitte, siehe oben. Grüße Adrian > + if ! wifiAddAdHocMesh "$radio" > "$mesh_essid" "$mesh_bssid"; then > + echo "Can't add AdHocMesh interface > on $radio." > + exit 1 > + fi > fi > done > > diff --git a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless > b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless > index 2c6dff8..238022a 100644 > --- a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless > +++ b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless > @@ -83,9 +83,9 @@ wifiAddAdHocMesh() { > local bssid=$3 > > local channel=$(uci get "wireless.${radio}.channel") > - local iface="w2mesh" > + local iface="w2ibss" > if [ "$channel" -gt "14" ]; then > - iface="w5mesh" > + iface="w5ibss" > fi > > uci batch <<-__EOF__ > @@ -177,4 +177,38 @@ wifiAddSta() { > return 0 > } > > +wifiAddMesh() { > + if [ $# -ne "2" ] > + then > + echo "Usage: wifiAddMesh <radio> <mesh-id>" > + fi > + > + local radio=$1 > + local mesh_id=$2 > + > + local channel=$(uci get "wireless.${radio}.channel") > + local iface="w2mesh" > + if [ "$channel" -gt "14" ]; then > + iface="w5mesh" > + fi > + uci batch <<-__EOF__ > + set wireless.${iface}='wifi-iface' > + set wireless.${iface}.device='${radio}' > + set wireless.${iface}.network='${iface}' > + set wireless.${iface}.ifname='${iface}' > + set wireless.${iface}.mode='mesh' > + set wireless.${iface}.mesh_id='${mesh_id}' > + set wireless.${iface}.encryption='none' > + set wireless.${iface}.mesh_fwding=0 > + commit wireless > + > + set network.${iface}='interface' > + set network.${iface}.mtu='1528' > + set network.${iface}.proto='batadv' > + set network.${iface}.mesh='bat0' > + commit network > + __EOF__ > + > + echo "${iface}" > +} > # vim: set noexpandtab:tabstop=4 > -- > 2.14.1 > > -- > franken-dev mailing list > franken-dev@freifunk.net > http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Hallo Adrian, > Wurde der Name jetzt doch nicht auf mesh_type geändert? Noch nicht. Ist aber schnell umbenannt. > Ich finde solche Multiconditions immer ganz schlimm, weil man stundenlang > überlegen muss. Magst du Klammern hinmachen? > Das kostet nichts und macht viel Freude! Ich auch, allerdings hab ich gestern Abend nicht rausbekommen, wie man in ash richtig klammert.. Kommt in v2, zusammen mit Variable umbenennen. Gruß Fabian
Signed-off-by: Fabian Bläse <fabian@blaese.de> --- community/franken.cfg | 1 + .../fff/fff-hoods/files/usr/sbin/configurehood | 22 ++++++++++--- .../fff-wireless/files/lib/functions/fff/wireless | 38 ++++++++++++++++++++-- 3 files changed, 54 insertions(+), 7 deletions(-)