Bug 212612

Summary: dhcp won't compile with RHEL4 gcc
Product: [Fedora] Fedora Reporter: Jeff Johnson <n3npq>
Component: dhcpAssignee: David Cantrell <dcantrell>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-10-30 16:07:18 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Jeff Johnson 2006-10-27 14:42:23 EDT
dcantrell: Thank you *very* much for cleaning up the mess in dhcp.

Here's a simple patch that works around an arcane compilation problem
with gcc shipped in RHEL4. All the patch does is rearrange a generated
include to define an enum before using in a typedef and prototypes.

The better fix would be to generate the file correctly, as there's another identical
patch I'm about to post against dhcpv6, exactly the same issue.

If you're *really* energetic, the gcc problem should be fixed as well ;-)
Comment 1 David Cantrell 2006-10-27 14:51:39 EDT
No problem.  I had to make the source RPM more manageable.  The previous
maintainer was a bit sloppy with patches and history and didn't care about
making use of CVS and tags.

Anyways, where is the patch?

I'll go ahead and fix up dhcp and dhcpv6 as well since I own both of those.
Comment 2 Jeff Johnson 2006-10-27 15:04:02 EDT
I've sent the patch privately, otherwise fish the patch out of
    http://wraptastic.org/pub/jbj/dhcp-3.0.4-23.src.rpm
which I just built. The spec file application is a bit wonky
since the patch has to be applied after the file is generated.
Comment 3 David Cantrell 2006-10-27 15:13:58 EDT
Sent it privately to what address?
Comment 4 Jeff Johnson 2006-10-27 15:26:11 EDT
Hehe, yours: <dcantrell@redhat.com>

Patch also copied to
    http://wraptastic.org/pub/jbj/dhcp-3.0.4-tklc.patch
and eixstence at that URI verified.
Comment 5 Jeff Johnson 2006-10-27 15:42:04 EDT
Same patch to libdhcp as well.

I've copied patches and *.src.rpm's for all of the above to http://wraptastic.org/pub/jbj,
but its all exatly the same rearrangement.

Note that libdhcpv6 "compiles", but installs the boogered file, so libdhcp build fails later.
Comment 6 David Cantrell 2006-10-30 16:07:18 EST
I've built new dhcp and libdhcp packages that fix these issues.  They are in
rawhide now:

dhcp-3.0.4-24.fc7
libdhcp-1.17-1.fc7
Comment 7 Jeff Johnson 2006-10-30 18:20:39 EST
Yes, thanks.

The dhcpv6 package needs the same patch as dhcp. The failure
comes when linking libdhcp from including
     /usr/include/dhcp6client/libdhcp_control.h

libdhcp has other issues, needs a modern <sys/queue.h> as
well as modern <linux/netlink.h> and <linux/rtnetlink.h>

There are copies of the changes I'm making to compile with
RHEL4/CentOS4 at http://wraptastic.org/pub/jbj

There's also mkinitrd fiddles there to compile. I'll know in
the next day or two whether "functional" and then will
attempt better than slamming a private copy of queue.h et al
into libdhcp/mkinitrd.

Meanwhile, the same dhcp patch is also needed in dhcpv6.
Comment 8 David Cantrell 2006-10-31 17:04:49 EST
libdhcp uses <sys/queue.h>.  dhcpv6 has a static copy of an old BSD queue.h, but
I've removed that and have it using the glibc queue.h.

Both libdhcp and dhcpv6 include the netlink headers in /usr/include.  There are
no static copies.
Comment 9 Jeff Johnson 2006-11-01 08:14:08 EST
Using <sys/queue.h> creates instant legacy, as the queue.h from RHLE4 glibc
is not updated. Including private "new" queue.h is one solution, rewriting the
code to not depend on silly BSD macros is another.

I'll send you a patch to internalize the macros from <sys/queue.h> so
that the "old" vs "new" issue disappears if you want. Otherwise, slamming
a later queue.h into libdhcp and mkinitrd is an efficient solution, just pugly.

netlink.h and rtnetlink.h are trickier. In my case I'm building for 2.6.18 and
cannot change the development environment. So I include netlink.h from
rtnetlink.h from 2.6.18. Perfectly understood why that is a crazy thing to do.

Thanks for dhcpv6 fixing.
Comment 10 David Cantrell 2006-11-01 12:18:42 EST
I'm not a fan of carrying forward archaic BSD code.  Using the glibc-provided
queue.h seemed fine to me, but I'm not opposed to rewriting the code to not use
the BSD stuff.

I would much prefer a rewrite than to drop a later queue.h in the code.  Send
patches on over for other ways to fix this problem.

Regarding the netlink.h and rtnetlink.h...I'm going to say that's a side effect
of your development environment requirements.  I don't want to drop specific
versions of those in to the source since they are provided on the target build
system anyway.  But I think you understand that.

Thanks for the help.
Comment 11 Jeff Johnson 2006-11-01 12:27:59 EST
Perfectly understood. I ain't happy carrying around private copies of include files either.

I'll drop you a patch to rewrite dhcp* without including <sys/queue.h>
down the road a bit. I gotta figger mkinitrd functionality first.

Thanks for fixing, less code I have to maintain.

Wotta bloody mess dhcp code is, sigh. Its amazing that so much depends
on this ugly rotten code base.