From ecaca570fd7f2520295589c77a3df4f7126a62bc Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Wed, 1 Aug 2018 23:31:18 -0300 Subject: [PATCH] Now using mac address as an identifier in vanity section --- bin/libbfa.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/libbfa.sh b/bin/libbfa.sh index 6cfbe1c..c6ed763 100644 --- a/bin/libbfa.sh +++ b/bin/libbfa.sh @@ -183,15 +183,19 @@ function nodedir # test -r "${BFANODEDIR}/netport" || echo $(( $RANDOM / 2 + 12345 )) > ${BFANODEDIR}/netport - netport=$( cat ${BFANODEDIR}/netport ) + netport=$( cat ${BFANODEDIR}/netport ) test $? = 0 test -r "${BFANODEDIR}/rpcport" || echo $(( $RANDOM / 2 + 12345 )) > ${BFANODEDIR}/rpcport rpcport=$( cat ${BFANODEDIR}/rpcport ) # something uniqueish - local iphash=$( ip addr show scope global | awk '/^ *inet /{print $2}' | sed 's,/.*,,' | sha256sum ) - BFAEXTRADATA="${USER}@${HOSTNAME} ${iphash}" - BFAEXTRADATA="${BFAEXTRADATA:0:32}" + ## find default interface + local def_if=$( ( ip -4 route show ; ip -6 route show ) | expand | sed -ne '/^default /{s/ */ /g;s/^.* dev //;s/ .*//;p;q}' ) + local mymac=$( ip link show ${def_if} | sed -ne '/link\|ether/{s/^.*link.ether //;s/ .*//;s/://g;p;q}' ) + + BFAEXTRADATA="${USER}@${HOSTNAME}" + BFAEXTRADATA="${BFAEXTRADATA} " + BFAEXTRADATA="${BFAEXTRADATA:0:19} ${mymac}" } function account -- GitLab