net

a simple network manager
git clone git://ssnf.xyz/net
Log | Files | Refs

commit 81d085e005bb3cbb3f528c789851c560c4aea66e
parent a9e8b54c13f7c56fcaf15e4d18aa3ae630b63aba
Author: ssnf <ssnf@ssnf.xyz>
Date:   Fri,  2 Jul 2021 13:32:40 +0000

fix gateway and master device issue

Diffstat:
Mnet | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net b/net @@ -4,6 +4,7 @@ dev_scan() { [ -n "$2" ] && cd $1 + DEV=$1 IP=$(cat ip 2>/dev/null) MAC=$(cat mac 2>/dev/null) GW=$(cat gw 2>/dev/null) @@ -19,15 +20,16 @@ dev_scan() { ip l a $MASTER type bridge ip l s $MASTER up fi - ip l s $1 master $MASTER + ip l s $DEV master $MASTER + DEV=$MASTER fi if [ -z "$IP" ] then - ! [ -d "$1" ] && dhcpcd -4n $1 && return + ! [ -d "$1" ] && dhcpcd -4n $DEV && return IP=$(cat "$1"/ip) - GW=$(cat "$1"/ip) + GW=$(cat "$1"/gw) fi - ip a a $IP/24 dev $1 2>/dev/null + ip a a $IP/24 dev $DEV 2>/dev/null ip r a default via $GW 2>/dev/null }