Skip to content

Instantly share code, notes, and snippets.

@TobleMiner
Last active July 24, 2018 00:12
Show Gist options
  • Save TobleMiner/6eab124a468d509219aba38bbb0c613a to your computer and use it in GitHub Desktop.
Save TobleMiner/6eab124a468d509219aba38bbb0c613a to your computer and use it in GitHub Desktop.
Get gateway address of gluon devices using an additional respondd service
gwid="`batctl gwl | grep '=>' | cut -d' ' -f2 | tr -d ':'`"
[ -z "$gwid" ] && exit 1
gluon-neighbour-info -p 1001 -d ff02::1 -i bat0 -r gateway | \
while read resp; do
node_id="`echo "$resp" | jsonfilter -e '$.node_id'`"
if [[ "$node_id" == "$gwid" ]]; then
echo "$resp" | jsonfilter -e '$.address.ipv4'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment