fixing bug in IPv6 LOOPBACK, pulling that from DNS as well, ASN is still generated for now

This commit is contained in:
toby 2018-09-09 23:11:54 +02:00
parent 52e4f93928
commit 028e2d455d
1 changed files with 6 additions and 6 deletions

View File

@ -26,16 +26,17 @@ case "$1" in
#source /etc/wit-net.conf
export DOMAINNAME=${HOSTNAME#*.}
export LOOPBACKv4=$(dig +short ${HOSTNAME%%.*}.loopback.${HOSTNAME#*.})
export LOOPBACKv4=$(dig a +short ${HOSTNAME%%.*}.loopback.${HOSTNAME#*.})
export LOOPBACKv6=$(dig aaaa +short ${HOSTNAME%%.*}.loopback.${HOSTNAME#*.})
export TIER_ID=$(echo $LOOPBACKv4 | cut -d . -f 3)
export NODE_ID=$(echo $LOOPBACKv4 | cut -d . -f 4)
if [ -z $LOOPBACKv4 ]; then
echo "unable to find my LOOPBACK IP"
if [ -z $LOOPBACKv4 ] || [ -z $LOOPaBACKv6 ]; then
echo "unable to find my LOOPBACK IP: $LOOPBACKv4/$LOOPaBACKv6"
exit 2
fi
if [ -z "$TIER_ID" ]; then
echo "Unable to autodetect TIER_ID, looks like we deal with a special node, please set in environment"
if [ -z "$TIER_ID" ] || [ -z "$NODE_ID" ]; then
echo "Unable to autodetect TIER/NODE_ID: $TIER_ID/$NODE_ID"
exit 2
fi
if [ -z "$DOMAINNAME" ]; then
@ -45,7 +46,6 @@ case "$1" in
export NODE_ASN="4200$(printf "%03d" $TIER_ID)$(printf "%03d" $NODE_ID)"
export LOOPBACKv6="2604:bbc0::$TIER_ID:$NODE_ID"
MGMT_MAC=$(ip -br link show dev $(ip -4 -br addr | grep 10.0. | awk '{ print $1 }') | awk '{ print $3 }')