Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 379181 - sys-apps/openrc-0.8.3-r1: /lib/rc/net/arping.sh parses arp-broadcast-request wrong: "... MAC 00:00:00:00:00:00 does not match"
Summary: sys-apps/openrc-0.8.3-r1: /lib/rc/net/arping.sh parses arp-broadcast-request ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL: http://git.overlays.gentoo.org/gitweb...
Whiteboard: openrc:oldnet
Keywords: InVCS
Depends on:
Blocks: 382299
  Show dependency tree
 
Reported: 2011-08-14 16:32 UTC by cl
Modified: 2013-04-25 23:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge_info.txt,4.31 KB, text/plain)
2011-09-16 12:34 UTC, cl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cl 2011-08-14 16:32:24 UTC
In lines 42-43 in /lib/rc/net/arping.sh:

foundmac="$(arping -w "${w}" ${opts} -f -I "${IFACE}" "${ip}" 2>/dev/null | \
                sed -n -e 'y/abcdef/ABCDEF/' -e 's/.*\[\([^]]*\)\].*/\1/p')"

the sed-regexp extracts the MAC in the *LAST* [...] pairs. That's a problem, if the output of arping is e.g.
"Broadcast request from 131.159.71.254 [02:E0:52:EB:55:01] for 131.159.71.254 [00:00:00:00:00:00] 803.297ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s) (1 request(s), 1 broadcast(s))"
(here arping has received a gratuitous arp request from 131.159.71.254 with the target MAC set to 00:00:... )
The the regexp above extracts the contents of the last [...] pair and the zero-MAC is saved in $foundmac. That's wrong.
If the pinged host sends an UNICAST reply the problem doesn't occur, because the output of arping looks like this:
"Unicast reply from 192.168.178.1 [00:04:0E:6F:A6:3D] for 192.168.178.1 [00:04:0E:6F:A6:3D] 1.079ms"  



Reproducible: Always

Steps to Reproduce:
To reproduce you need a host (router) that regularly sends gratuitous arp requests/replies. 

1. Use /etc/conf.d/net with arping-feature
config_eth0=( "arping" )
gateways_eth0=( "131.159.71.254,02:E0:52:EB:55:01" )
etc.
2. Bring up network (or restart): /etc/init.d/net.eth0  -v start
3. Read warning-message "Found 131.159.71.254 but MAC 00:00:00:00:00:00 does not match"

Actual Results:  
In the case of broadcast arp-requests the target MAC ($foundmac) isn't detected correctly.

Expected Results:  
Expected: Correct detection of target MAC in $foundmac. I suggest using the *first* [...] pairs in the output of arping.

used version of arping
net-analyzer/arping-2.06
Comment 1 Christian Ruppert (idl0r) gentoo-dev 2011-09-14 21:21:28 UTC
Hrm.. Either we add support for both versions (iputils/arping) or we support and esp. use only one, in this case iputils as the pattern works well and seems to be written for iputils arping.
Comment 2 Christian Ruppert (idl0r) gentoo-dev 2011-09-14 21:27:48 UTC
Ok, it seems both versions are supported and the regex pattern is fine for both so far.. We'll have to take a closer look at it.
Comment 3 Christian Ruppert (idl0r) gentoo-dev 2011-09-15 21:12:36 UTC
arping2 uses the -r option so it outputs the MAC only (see man 8 arping2).
arping2 will be preferred over arping (iputils).
Please attach the full output of /etc/init.d/net.eth0 -v restart
Also emerge --info please as well as the iputils version.
Comment 4 cl 2011-09-16 12:34:36 UTC
Created attachment 286673 [details]
emerge --info
Comment 5 cl 2011-09-16 12:37:31 UTC
Testing the case:
*  net-analyzer/arping
      Latest version available: 2.06
      Latest version installed: [ Not Installed ]

*  net-misc/iputils
      Latest version available: 20100418-r1
      Latest version installed: 20100418-r1

/etc/init.d/net.eth0 -v restart 
reports:


 * Bringing up interface eth0
 *   Loaded modules: apipa arping bonding tuntap bridge ccwgroup macchanger macnet wpa_supplicant ssidnet ifconfig system dhcpcd ip6to4
 *   Configuring eth0 for MAC address 00:25:b3:c0:e8:25 ... [ ok ]
 *   arping ...
 *     Pinging gateways on eth0 for configuration
 *       131.159.71.254 (MAC 02:E0:52:EB:55:01) ...
 *       Found 131.159.71.254 but MAC 00:00:00:00:00:00 does not match
 [ !! ]
 *       131.159.68.2 (MAC 00:03:BA:65:2C:63) ... [ !! ]
 *       131.159.68.4 (MAC 00:03:BA:D8:BD:B3) ... [ !! ]
 *       192.168.178.1 (MAC 00:04:0E:6F:A6:3D) ... [ !! ]
 [ !! ]
 *   Trying fallback configuration dhcp
 *   dhcp ...
 *     Running dhcpcd ...dhcpcd[1896]: version 5.2.12 starting
dhcpcd[1896]: eth0: broadcasting for a lease
dhcpcd[1896]: timed out
 [ !! ]
 [ !! ]
 * ERROR: net.eth0 failed to start
Comment 6 Christian Ruppert (idl0r) gentoo-dev 2011-09-16 22:25:33 UTC
Ok, so as expected you *don't* use net-analyzer/arping at all.

This should be fixed through commit 645bbf2 - http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=645bbf2e0f6be1f9f4cc116dfc39939456b771e3

Please try openrc-9999 or patch your current openrc:
# wget 'http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=patch;h=645bbf2e0f6be1f9f4cc116dfc39939456b771e3;hp=539c4e58723fbd3b8ca9f30a09e99ddaf72c30b1' -O /tmp/arping.patch
# cd /lib/rc/net; patch -p2 < /tmp/arping.patch
Comment 7 cl 2011-09-19 14:38:14 UTC
  "Ok, so as expected you *don't* use net-analyzer/arping at all."
Sorry, yes. Only using iputils.

The patch
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=patch;h=645bbf2e0f6be1f9f4cc116dfc39939456b771e3;hp=539c4e58723fbd3b8ca9f30a09e99ddaf72c30b1
worked for me.

Thanks