dhcpcd

Jeremy D. Impson (jdimpson@syr.edu)
Sun, 11 Oct 1998 18:33:22 -0400 (EDT)


I am running Linux kernel 2.0.35, RH 5.1, and have been using dhcpcd-0.70
and rrdhcpcd-1.02 (and have tried to use dhcpcd-1.3.9, but apparantly
2.0.X kernels don't support AF_PACKET (net-pf-17)).

(rrdhcpcd is a hacked version of 0.70 "fixed" for Time Warner's RoadRunner
Cable Modem service--apparantly, the RR dhcpcd servers don't support the
REBOOTING state)

I get transient errors that cause dhcpcd to fail[1]. When this happens, I
cannot restart dhcpcd--it says 'bind (openSendSocket): Address already in
use'. dhcpcd tries to bind to local port 68 to communicate with the dhcpd
server. (If I use another local port, dhcpcd reports "no DHCPOFFER
messages".) It takes 2 hours for the kernel to release this port so that
I can restart dhcpcd.

When I use netcat (nc -v -v -l -p 68) to bind to a local udp port, then
kill it, then do it again, I get no such problem. But even when I kill
dhcpcd normally (using dhcpcd -k) and then use netcat to bind to port 68,
I get the 'address already in use' error.

Can someone sum up the issues here for me? What is going on that makes
this local port not available after dhcpcd uses it? Why do I get a
problem with dhcpcd and not with netcat? Are there socket options that
cause this?

I looked through the kernel source and saw a part of the socket structure
called 'reuse', but it only works on SOCK_RAW and SOCK_PACKET sockets. I
don't think SOCK_PACKET is supported on 2.0.X (correct me if I am wrong)
and using SOCK_RAW seems stupid. (And maybe 'reuse' doesn't do what I
think it does, but the code in net/ipv4/udp.c (and tcp.c) seem to indicate
that it allows immediate reuse of a port.)

I assume that dhcpcd-1.3.9 takes advantage of this option. Does this mean
that my problem is intractible on 2.0.X kernels?

I know there were some "issues" with dhcpcd. I recall some discussion
that dhcpcd has some problems, etc, a few months back but I didn't pay
much attention, and I can't find any mention of them in the kernel mailing
list archive I checked.

Thanks,
--Jeremy

******* END OF LINUX KERNEL-RELATED MESSAGE, START OF DHCPCD MESSAGE, FOR
ANYONE INTERESTED *****

[1] for any dhcp/RoadRunner experts:

I've traced a bit of the problem. When it works fine, after startup it
gets BOUND. An hour later it takes this progression:

BOUND -> RENEWING -> BOUND

and it sleeps for an hour, then happily repeats. But when I have a
problem, it starts up, gets in BOUND state. An hour later, it does this:

BOUND -> RENEWING -> REBINDING

where it says "Lease time expired, Fall back to INIT"

So it goes to INIT state (init() in client.c) where since the previous
state was REBINDING, it resets the interface (ifReset()) and runs
dhcpMsgInit(), which is where it tries to rebind to local port 68, fails,
and dies.

In the failed case (case 2) it goes from RENEWING to REBINDING because
rcvAndCheckDhcpMsg() (as called in function renewing()) returns false,
renewing() eventually times out and says the next states is REBINDING.

I have not yet figured out why rcvAndCheckDhcpMsg() returns false. The
fact that I have to wait an hour before it fails, then reboot to restart
dhcpcd, slows me down.

---------------------------------------------------------------------------
Jeremy Impson Linux, Perl, and Network geek
jdimpson@source.syr.edu http://source.syr.edu/~jdimpson

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/