Bug 744309

Summary: netconsole init script crashes if arping receives multiple responses
Product: [Fedora] Fedora Reporter: Doug Knight <doug.knight>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: iarlyy, jonathan, notting, plautrba, rvokal, smithj
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: initscripts-9.30.1-1.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-17 00:45:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Formatted patch from initscripts.git none

Description Doug Knight 2011-10-07 19:53:30 UTC
Description of problem:

netconsole is failing to start on our network with the following error messages:

[root@kern ~]# service netconsole start
/etc/init.d/netconsole: line 86: 00:10:DB:FF:26:E2: command not found
netconsole: can't resolve MAC address of 192.168.13.157
syslog server address resolution                           [FAILED]


This happens when arping receives multiple responses, such as:

[root@kern ~]# LANG=C arping -c 1 -I bond0 192.168.13.1
ARPING 192.168.13.1 from 192.168.13.12 bond0
Unicast reply from 192.168.13.1 [00:10:DB:FF:26:E2]  1.654ms
Unicast reply from 192.168.13.1 [00:10:DB:FF:26:E2]  229.466ms
Sent 1 probes (1 broadcast(s))
Received 2 response(s)


The function print_address_info in /etc/rc.d/init.d/netconsole is generating an assignment statement containing a non-quoted newline, which when evaluated, results in the shell attempting to interpret a MAC address as a shall command.  This can be seen in the trace of 'eval $(print_address_info $SYSLOGADDR)':

++ print_address_info 192.168.13.157
++ local host=192.168.13.157
++ local route via target
+++ LANG=C
+++ ip -o route get to 192.168.13.157/32
++ route='192.168.13.157 via 192.168.13.1 dev bond0  src 192.168.13.12 \    cache  mtu 1500 advmss 1460 hoplimit 64'
++ '[' -z '' ']'
+++ echo 192.168.13.157 via 192.168.13.1 dev bond0 src 192.168.13.12 '\' cache mtu 1500 advmss 1460 hoplimit 64
+++ sed 's|.* dev \([^ ]*\).*|\1|'
++ DEV=bond0
++ echo DEV=bond0
+++ echo 192.168.13.157 via 192.168.13.1 dev bond0 src 192.168.13.12 '\' cache mtu 1500 advmss 1460 hoplimit 64
+++ sed 's|.* src \([^ ]*\).*|\1|'
++ echo LOCALADDR=192.168.13.12
++ echo 192.168.13.157 via 192.168.13.1 dev bond0 src 192.168.13.12 '\' cache mtu 1500 advmss 1460 hoplimit 64
++ grep -q ' via '
+++ echo 192.168.13.157 via 192.168.13.1 dev bond0 src 192.168.13.12 '\' cache mtu 1500 advmss 1460 hoplimit 64
+++ sed 's|.* via \([^ ]*\).*|\1|'
++ via=192.168.13.1
++ target=192.168.13.1
++ '[' -z '' ']'
+++ LANG=C
+++ arping -c 1 -I bond0 192.168.13.1
+++ awk '/ reply from .*[.*]/ { print gensub(".* reply from .* \\[(.*)\\].*","\\1","G") }'
++ arp='00:10:DB:FF:26:E2
00:10:DB:FF:26:E2'
++ '[' -n '00:10:DB:FF:26:E2
00:10:DB:FF:26:E2' ']'
++ echo 'SYSLOGMACADDR=00:10:DB:FF:26:E2
00:10:DB:FF:26:E2'
+ eval DEV=bond0 LOCALADDR=192.168.13.12 SYSLOGMACADDR=00:10:DB:FF:26:E2 00:10:DB:FF:26:E2
++ DEV=bond0
++ LOCALADDR=192.168.13.12
++ SYSLOGMACADDR=00:10:DB:FF:26:E2
++ 00:10:DB:FF:26:E2
/etc/init.d/netconsole: line 86: 00:10:DB:FF:26:E2: command not found



Version-Release number of selected component (if applicable):
This is the same on everything from 8.45.38-2 through 73d7cf7234 in git://git.fedorahosted.org/git/initscripts.git

How reproducible:
I don't have a good way to reproduce this on other networks.  

Steps to Reproduce:
1.  It might be possible to replay ARP responses via iptables to simulate these events.
  
Actual results:
[root@kern ~]# service netconsole start
/etc/init.d/netconsole: line 86: 00:10:DB:FF:26:E2: command not found
netconsole: can't resolve MAC address of 192.168.13.157
syslog server address resolution                           [FAILED]

Expected results:
[root@kern ~]# service netconsole start
Initializing netconsole                                    [  OK  ]

Additional info:
I'll propose a patch, shortly.

Comment 1 Doug Knight 2011-10-07 20:07:58 UTC
Created attachment 526954 [details]
Formatted patch from initscripts.git

Simplest solution: Stop processing arping's output after printing the first MAC address, ignoring any other responses that arping might report.

Comment 2 Bill Nottingham 2011-10-07 20:31:14 UTC
Thanks, added in git for F16 and on the F15 branch.

Comment 3 Fedora Update System 2011-10-12 20:54:16 UTC
initscripts-9.30.1-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/initscripts-9.30.1-1.fc15

Comment 4 Fedora Update System 2011-10-12 21:12:31 UTC
initscripts-9.33-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/initscripts-9.33-1.fc16

Comment 5 Fedora Update System 2011-10-13 18:12:24 UTC
Package initscripts-9.33-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing initscripts-9.33-1.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-14259
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2011-10-17 00:45:54 UTC
initscripts-9.33-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2011-10-30 00:31:58 UTC
initscripts-9.30.1-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.