adding more resiliancy to the ifup-public script. we want it to maybe fail if it doesn't know what to do with the variable. not just silently continue
This commit is contained in:
parent
13be20d519
commit
fb96f1daa8
|
@ -11,7 +11,7 @@ maxprefixv4=25
|
|||
|
||||
if [ -z $IP ]; then
|
||||
echo "got nothing back from the API"
|
||||
exit 10
|
||||
exit 10
|
||||
fi
|
||||
|
||||
eui64() {
|
||||
|
@ -45,7 +45,7 @@ for IP in "${IPS[@]}"; do
|
|||
fi
|
||||
|
||||
echo "we got IPv4 with prefix ${BASH_REMATCH[0]}"
|
||||
ip route add ${IP} dev ${IFACE}
|
||||
ip route add ${IP} dev ${IFACE}
|
||||
|
||||
elif [[ $IP =~ ^2604:bbc0:[0-9,a-f,:]{1,444}/([0-9]{2,3})$ ]]; then ### we got a PIv6 prefix < masprefixv6
|
||||
|
||||
|
@ -60,9 +60,13 @@ for IP in "${IPS[@]}"; do
|
|||
fi
|
||||
|
||||
echo "we got IPv6 with prefix ${BASH_REMATCH[0]}"
|
||||
ip route add ${IP} dev ${IFACE} via $(eui64 $PUBLICMAC)
|
||||
ip route add ${IP} dev ${IFACE} via $(eui64 $PUBLICMAC)
|
||||
|
||||
else ### don't know what we have but something we can't work with
|
||||
elif [[ $IP =~ ^\ *$ ]]; then
|
||||
echo "we just got an empty string. so not gonna do anything. probably due to splitting the comma"
|
||||
|
||||
else
|
||||
echo "Unable to detect with what prefix I'm working with"
|
||||
exit 10
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue