[PATCH v2 2/2] Allow initial configuration from Ethernet
Fabian Bläse
fabian at blaese.de
Mo Jun 11 19:34:54 CEST 2018
Ach sch.. Vergesst den Patch, da is ziemlich viel durcheinander
gegangen.. Gnarf.
Sorry, v3 kommt gleich.
Gruß
Fabian
On Mon, 2018-06-11 at 19:32 +0200, Adrian Schmutzler wrote:
> Und hier sind ein paar Sachen drin, die nicht rein gehören ...
>
> Sieht aus, als wäre was durcheinander ...
>
> > -----Original Message-----
> > From: Fabian Bläse [mailto:fabian at blaese.de]
> > Sent: Montag, 11. Juni 2018 19:28
> > To: franken-dev at freifunk.net
> > Cc: Adrian Schmutzler <freifunk at adrianschmutzler.de>; Robert
> > Langhgammer <rlanghammer at web.de>; Christian Dresel <fff at chrisi01.de
> > >;
> > Fabian Bläse <fabian at blaese.de>
> > Subject: [PATCH v2 2/2] Allow initial configuration from Ethernet
> >
> > Signed-off-by: Fabian Bläse <fabian at blaese.de>
> > ---
> > Apply after MacKnocker patchset!
> >
> > Changes in v2:
> > - Fix indentation
> > - Improve usage message
> > - Return if no ethmesh_dev exists
> > - Replace . with : in ping6 sed
> > ---
> > .../fff-hoods/files/usr/lib/functions/fff/hoodfile | 39
> > ++++++++++++++++++----
> > .../fff/fff-hoods/files/usr/sbin/configurehood | 2 +-
> > 2 files changed, 33 insertions(+), 8 deletions(-)
> >
> > 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 b88a3d4..bc52883 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
> > @@ -2,8 +2,7 @@
> > . /lib/functions/fff/wireless
> >
> > getWirelessHoodfile() {
> > - if [ $# != 1 ]
> > - then
> > + if [ $# != 1 ]; then
> > echo "Usage: getWirelessHoodfile <target-file>"
> > return 1
> > fi
> > @@ -54,9 +53,32 @@ 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 |
> > cut -d
> > +" " -f4 | sed s/:$//g | sort | uniq)
> > +
> > + 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
> > + if [ $# != 1 ]; then
> > echo "Usage: getGatewayHoodfile <target-file>"
> > return 1
> > fi
> > @@ -72,8 +94,7 @@ getGatewayHoodfile() { }
> >
> > getKeyserverHoodfile() {
> > - if [ $# != 1 ]
> > - then
> > + if [ $# != 1 ]; then
> > echo "Usage: getKeyserverHoodfile <target-file>"
> > return 1
> > fi
> > @@ -81,5 +102,9 @@ getKeyserverHoodfile() {
> >
> > echo "Getting hoodfile from Keyserver"
> >
> > - wget -T15 -t5 -O "$file" "http://keyserver.freifunk-
> > franken.de/v2/?lat=$lat&long=$long"
> > + if wget -T15 -t5 -O "$file" "http://keyserver.freifunk-
> > franken.de/v2/?lat=$lat&long=$long"; then
> > + return 0
> > + else
> > + return 1
> > + fi
> > }
> > diff --git a/src/packages/fff/fff-
> > hoods/files/usr/sbin/configurehood
> > b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > index aee20e5..282e21b 100755
> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > @@ -101,7 +101,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
> > --
> > 2.11.0
>
>
Mehr Informationen über die Mailingliste franken-dev