Bug 631305

Summary: dhcrelay segfaults at first request
Product: [openSUSE] openSUSE 11.3 Reporter: Andi N Kleen <andi-nbz>
Component: NetworkAssignee: Marius Tomaschewski <mt>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: ast
Version: Final   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Patch fixing the segfault and discarding packeds on interfaces without IP

Description Andi N Kleen 2010-08-15 09:47:22 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8


Simply configuring it to listen to a tap interface and forwarding
to an external dhcp server:

Aug 15 11:39:10 zeitgeber dhcrelay: Internet Systems Consortium DHCP Relay Agent 4.1.1-P1
Aug 15 11:39:10 zeitgeber dhcrelay: Copyright 2004-2010 Internet Systems Consortium.
Aug 15 11:39:10 zeitgeber dhcrelay: All rights reserved.
Aug 15 11:39:10 zeitgeber dhcrelay: For info, please visit https://www.isc.org/software/dhcp/
Aug 15 11:39:10 zeitgeber dhcrelay: Listening on LPF/tap0/ae:b8:8b:53:fe:7c
Aug 15 11:39:10 zeitgeber dhcrelay: Sending on   LPF/tap0/ae:b8:8b:53:fe:7c
Aug 15 11:39:10 zeitgeber dhcrelay: Sending on   Socket/fallback


Request comming in:

Aug 15 11:39:12 zeitgeber kernel: [41110.534756] dhcrelay[6641]: segfault at 0 ip 00007f3e759de20f sp 00007fff0822b680 error 4 in dhcrelay[7f3e759d1000+6d000]

Running it under gdb gives


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f9f20f in do_relay4 (ip=<value optimized out>, packet=0x7fffffffcd40, 
    length=<value optimized out>, from_port=<value optimized out>, from=..., 
    hfrom=<value optimized out>) at dhcrelay.c:660
660     dhcrelay.c: No such file or directory.
        in dhcrelay.c
(gdb) bt
#0  0x00007ffff7f9f20f in do_relay4 (ip=<value optimized out>, packet=0x7fffffffcd40, 
    length=<value optimized out>, from_port=<value optimized out>, from=..., 
    hfrom=<value optimized out>) at dhcrelay.c:660
#1  0x00007ffff7fa7e80 in got_one (h=0x7ffff820d960) at discover.c:1393
#2  0x00007ffff7fd372b in omapi_one_dispatch (wo=<value optimized out>, t=0x0)
    at dispatch.c:520
#3  0x00007ffff7fa9e5a in dispatch () at dispatch.c:92
#4  0x00007ffff7f9f7ec in main (argc=<value optimized out>, argv=<value optimized out>)
    at dhcrelay.c:549


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Comment 1 Marius Tomaschewski 2010-08-17 10:22:30 UTC
Going to take a look ...
Comment 2 Marius Tomaschewski 2010-08-17 13:54:49 UTC
Both versions work fine for me:
  dhcp-relay-4.1.1.P1-3.2.x86_64    from openSUSE-11.3-Oss
  dhcp-relay-4.1.1.P1-4.1.1.x86_64  from openSUSE-11.3-Update

Could you provide more details about your setup please?

Which parameters are used (ps auxwww | grep dhcrelay)?

Please install also debuginfo/debugsource packages from
  http://download.opensuse.org/debug/update/11.3/rpm/x86_64/dhcp-debugsource-4.1.1.P1-4.1.1.x86_64.rpm
  http://download.opensuse.org/debug/update/11.3/rpm/x86_64/dhcp-relay-debuginfo-4.1.1.P1-4.1.1.x86_64.rpm
and try to recreate the backtrace when possible.

I do not see anything special in dhcrelay.c:660.

You're using a tap interface. Did you remove and recreated
the tap interface without to restart the relay?
Comment 3 Andi N Kleen 2010-09-10 09:31:14 UTC
The set up is dhcp relay was supposed to forward requests from qemu 
guests to the main network.


qemu-ifup is just exit 0 so the tap interfaces already exist before
created with tunctl
Comment 4 Marius Tomaschewski 2010-10-26 20:22:38 UTC
Created attachment 397166 [details]
Patch fixing the segfault and discarding packeds on interfaces without IP

I've retested it and found out how you run into this problem:

The tap0 interface you were using did not have any IP address configured.

I'll fix it and forward the patch upstream, but this is a misconfiguration:
Both, the interface to the server and the interface to the client need IPs.

For example:
  eth0: 192.168.0.1/24  -- interface to the dhcp-server (192.168.0.254)
  tap0: 192.168.1.1/24  -- interface to the dhcp-client(s)

The /etc/sysconfig/dhcrelay configuration for this scenario is:

DHCRELAY_INTERFACES="tap0 eth0"
DHCRELAY_SERVERS="192.168.0.254"

on the command line it is:

   /usr/sbin/dhcrelay -i tap0 -i eth0 192.168.0.254
Comment 7 Marius Tomaschewski 2010-10-27 14:29:50 UTC
I've reported it upstream with the attached patch: ISC-Bugs #22409.
Comment 10 Bernhard Wiedemann 2016-04-15 12:58:37 UTC
This is an autogenerated message for OBS integration:
This bug (631305) was mentioned in
https://build.opensuse.org/request/show/54219 Factory / dhcp