Parse broadcast arp responses via arping (iputils) properly
ARP replies may/do contain two MAC addresses when using iputils's arping so we have to use the first one because it's always the "From" address - which is what we want. Thanks to Stefan Knoblich <s.knoblich@axsentis.de> for the fixed pattern. Reported-by: cl@exomail.to X-Gentoo-Bug: 379181 X-Gentoo-Bug-URL: https://bugs.gentoo.org/379181
This commit is contained in:
parent
539c4e5872
commit
645bbf2e0f
@ -40,7 +40,7 @@ arping_address()
|
|||||||
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
[ -z "$(_get_inet_address)" ] && opts="${opts} -D"
|
||||||
|
|
||||||
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
|
||||||
sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"
|
sed -n -e 'y/abcdef/ABCDEF/' -e 's/[^[]*\[\([^]]*\)\].*/\1/p')"
|
||||||
fi
|
fi
|
||||||
[ -z "${foundmac}" ] && return 1
|
[ -z "${foundmac}" ] && return 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user