From 028e2d455d7787fc26330abdb15f380e1c4572a4 Mon Sep 17 00:00:00 2001 From: toby Date: Sun, 9 Sep 2018 23:11:54 +0200 Subject: [PATCH] fixing bug in IPv6 LOOPBACK, pulling that from DNS as well, ASN is still generated for now --- debian/wit-network-config.postinst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/debian/wit-network-config.postinst b/debian/wit-network-config.postinst index b68eeda..3383496 100755 --- a/debian/wit-network-config.postinst +++ b/debian/wit-network-config.postinst @@ -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 }')