Bug 863936 - dhcrelay segfaults when packet is received over interface without any IPv4 address assigned
dhcrelay segfaults when packet is received over interface without any IPv4 ad...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: dhcp (Show other bugs)
6.3
x86_64 Linux
medium Severity high
: rc
: ---
Assigned To: Jiri Popelka
Ladislav Jozsa
: Patch
: 920559 (view as bug list)
Depends On:
Blocks: 947775
  Show dependency treegraph
 
Reported: 2012-10-08 02:34 EDT by Stefan Assmann
Modified: 2013-11-21 02:43 EST (History)
6 users (show)

See Also:
Fixed In Version: dhcp-4.1.1-35.P1.el6
Doc Type: Bug Fix
Doc Text:
Cause: DHCPv4 relay agent (dhcrelay) received a packet over interface without any IPv4 address assigned. Consequence: Relay agent crashed. Fix: Relay agent now checks whether the interface has address assigned prior to further processing of received packet. Result: Relay agent no longer crashes.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 02:43:16 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch (608 bytes, patch)
2012-10-08 04:54 EDT, Jiri Popelka
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 500453 None None None Never

  None (edit)
Description Stefan Assmann 2012-10-08 02:34:48 EDT
Description of problem:
dhcrelay segfaults when sending a DHCPDISCOVER from a directly connected host.

System setup
dell-per610-01 (em2) <---> ibm-dx360m4-01 (eth1) <---> 10.16.64.14
    client                      dhcrelay                 DHCP

root@ibm-dx360m4-01.rhts.eng.bos.redhat.com:~> gdb dhcrelay -ex 'set args -d -i eth0 -i eth1 10.16.64.14'
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/dhcrelay...Reading symbols from /usr/lib/debug/usr/sbin/dhcrelay.debug...done.
done.
(gdb) r
Starting program: /usr/sbin/dhcrelay -d -i eth0 -i eth1 10.16.64.14
Internet Systems Consortium DHCP Relay Agent 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth1/34:40:b5:b9:5f:9c
Sending on   LPF/eth1/34:40:b5:b9:5f:9c
Listening on LPF/eth0/34:40:b5:b9:5f:9b
Sending on   LPF/eth0/34:40:b5:b9:5f:9b
Sending on   Socket/fallback
Forwarded BOOTREQUEST for 00:14:5e:f4:78:38 to 10.16.64.14
Forwarded BOOTREPLY for 00:14:5e:f4:78:38 to 10.16.68.21
Forwarded BOOTREQUEST for 00:14:5e:f4:78:34 to 10.16.64.14
Forwarded BOOTREPLY for 00:14:5e:f4:78:34 to 255.255.255.255
Forwarded BOOTREQUEST for 00:14:5e:f4:78:34 to 10.16.64.14
Forwarded BOOTREPLY for 00:14:5e:f4:78:34 to 255.255.255.255

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f9f467 in do_relay4 (ip=<value optimized out>, packet=0x7fffffffccc0, length=<value optimized out>,
    from_port=<value optimized out>, from=..., hfrom=<value optimized out>) at dhcrelay.c:660
660                     packet->giaddr = ip->addresses[0];
(gdb) bt
#0  0x00007ffff7f9f467 in do_relay4 (ip=<value optimized out>, packet=0x7fffffffccc0, length=<value optimized out>,
    from_port=<value optimized out>, from=..., hfrom=<value optimized out>) at dhcrelay.c:660
#1  0x00007ffff7fa6e1f in got_one (h=0x7ffff820da70) at discover.c:1400
#2  0x00007ffff7fd3353 in omapi_one_dispatch (wo=<value optimized out>, t=0x0) at dispatch.c:520
#3  0x00007ffff7fa8e5a in dispatch () at dispatch.c:92
#4  0x00007ffff7f9dbc1 in main (argc=<value optimized out>, argv=<value optimized out>) at dhcrelay.c:549
(gdb) 

Version-Release number of selected component (if applicable):
dhcp-4.1.1-31.P1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. on ibm-dx360m4-01 run: dhcrelay -i eth0 -i eth1 10.16.64.14
2. on dell-per610-01.lab.bos.redhat.com run: dhclient -v em2
3.
  
Actual results:
dhcrelay segfault

This also happens when using /etc/sysconfig/dhcrelay
cat /etc/sysconfig/dhcrelay 
# Command line options here
DHCRELAYARGS=""
# DHCPv4 only
INTERFACES="eth0 eth1"
# DHCPv4 only
DHCPSERVERS="10.16.64.14"
Comment 2 Stefan Assmann 2012-10-08 02:53:04 EDT
I've compiled dhcp-4.2.4-P2 and tried again. Here's the output
Starting program: /usr/sbin/dhcrelay -d -i eth0 -i eth1 10.16.64.14
Internet Systems Consortium DHCP Relay Agent 4.2.4-P2
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth1/34:40:b5:b9:5f:9c
Sending on   LPF/eth1/34:40:b5:b9:5f:9c
Listening on LPF/eth0/34:40:b5:b9:5f:9b
Sending on   LPF/eth0/34:40:b5:b9:5f:9b
Sending on   Socket/fallback
Forwarded BOOTREQUEST for 00:17:ef:dd:21:00 to 10.16.64.14
Forwarded BOOTREPLY for 00:17:ef:dd:21:00 to 10.16.65.209
Discarding packet received on eth1 interface that has no IPv4 address assigned.
Discarding packet received on eth1 interface that has no IPv4 address assigned.
Discarding packet received on eth1 interface that has no IPv4 address assigned.

So the segfault probably results in em2 not having an IPv4 address assigned. But actually that's what I'm trying to do. Would be nice if you could contact me on irc as I'm working on reproducing bug #845515 and could use a little help with that.
TIA Jiri!
Comment 3 Stefan Assmann 2012-10-08 03:26:53 EDT
I think I see my error now.
I had
ibm-dx360m4-01.rhts.eng.bos.redhat.com
eth0 has in IP from DHCP
eth1 (direct connection to dell-per610-01) just had link up, but no IP assigned. This causes the segfault and still should be fixed.

Now that I've manually assigned an IP to eth1 dhcrelay works.
Comment 4 Jiri Popelka 2012-10-08 04:54:42 EDT
Created attachment 623346 [details]
patch

This has been fixed upstream in ISC dhcp-4.2.2b1 with the following note in changelog:

- Relay no longer crashes, when DHCP packet is received over interface without
  any IPv4 address assigned. [ISC-Bugs #22409]
Comment 7 Jiri Popelka 2013-03-12 10:26:14 EDT
*** Bug 920559 has been marked as a duplicate of this bug. ***
Comment 8 Michal Bruncko 2013-03-30 16:02:47 EDT
Hi Jiri, 
please do you know when this patch will included?
thanks
Comment 9 Jiri Popelka 2013-04-02 05:46:17 EDT
Michal, you can check the Flags yourself:

rhel‑6.5.0?  means that it's been proposed for 6.5
pm_ack?  means that we are waiting for product management (pm)

once rhel-6.x.0 is + instead of ? it means it'll be fixed in rhel-6.x.0
Comment 10 Jiri Popelka 2013-04-03 10:35:24 EDT
(In reply to comment #9)
> Michal, you can check the Flags yourself:

I've just realized that you probably can't see them, sorry.
So ... yes, it's been proposed for 6.5, but it all depends on product management.
Comment 11 Michal Bruncko 2013-04-03 10:49:19 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > Michal, you can check the Flags yourself:
> 
> I've just realized that you probably can't see them, sorry.
> So ... yes, it's been proposed for 6.5, but it all depends on product
> management.

Hi Jiri, yes, you're right. Flags field is empty for me even I've logged here. Thanks for info.
Comment 21 Ladislav Jozsa 2013-10-11 11:11:47 EDT
Verified with dhclient-4.1.1-38.P1.el6.x86_64. dhcrelay no longer segfaults when IP address is not present on network interfaces.
Comment 22 errata-xmlrpc 2013-11-21 02:43:16 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1572.html

Note You need to log in before you can comment on or make changes to this bug.