mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: klibc ipconfig misbehavior in a network with DHCP snooping
@ 2007-12-10 14:46 maximilian attems
  0 siblings, 0 replies; 2+ messages in thread
From: maximilian attems @ 2007-12-10 14:46 UTC (permalink / raw)
  To: Ken Simon; +Cc: klibc, H. Peter Anvin, linux-kernel

[ added klibc ml to cc ]

> I found a problem with klibc's "ipconfig" program, or at least, behavior
> that breaks DHCP on my thin clients (LTSP 5.0). It has to do with setting
> the giaddr field on dhcp_send in dhcp_proto.c, line 164.

thank you for digging into it.

>  Otherwise, the relay agent SHALL forward any received DHCP packet
>  with a valid non-zero giaddr WITHOUT adding any relay agent options.
>  Per RFC 2131 <
>  ;http://www.faqs.org/rfcs /rfc2131.html>, it shall also NOT modify the
>  giaddr value.

got also a single klibc Debian bug report on it:
-> http://bugs.debian.org/432977

i'm adding the patch to my branch and will submit it to hpa asap.


-- 
maks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* klibc ipconfig misbehavior in a network with DHCP snooping
@ 2007-12-06 19:50 Ken Simon
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Simon @ 2007-12-06 19:50 UTC (permalink / raw)
  To: linux-kernel

(H. Peter Anvin was CC'd in the original message, but the lkml mailer
rejected it because of an html subpart... sorry)

Bear with me, because I'm no DHCP expert, nor any sort of kernel/networking
expert in any sense. (This is actually my first post to the lkml or to any
kernel developer.)

I found a problem with klibc's "ipconfig" program, or at least, behavior
that breaks DHCP on my thin clients (LTSP 5.0). It has to do with setting
the giaddr field on dhcp_send in dhcp_proto.c, line 164.

[snip]
static int dhcp_send(struct netdev *dev, struct iovec *vec)
{
 struct bootp_hdr bootp;

 memset(&bootp, 0, sizeof(struct bootp_hdr));

 bootp.op = BOOTP_REQUEST;
 bootp.htype = dev->hwtype;
 bootp.hlen = dev->hwlen;
 bootp.xid = dev->bootp.xid;
 bootp.ciaddr = dev->ip_addr;
 bootp.giaddr = dev-> bootp.gateway; //<-- HERE
 bootp.secs = htons(time(NULL) - dev->open_time);
 memcpy(bootp.chaddr, dev->hwaddr, 16);
...
[/snip]

I'm not sure why the giaddr field should be set on a DHCP request, but it
causes a Cisco relay agent with DHCP snooping turned on to drop the
request. I know ipconfig has options to both manually set a gateway and
configure the interface via dhcp, but IMO it shouldn't be sending it as part
of the DHCPREQUEST packet.

When I went to Cisco about the issue, this is exactly what they explained:

[QUOTE]
This looks like the thin client is not following the standards for DHCP
relay information specified in RFC3046. This RFC states the following:

A DHCP relay agent may receive a client DHCP packet forwarded from a
 BOOTP/DHCP relay agent closer to the client. Such a packet will have
 giaddr as non-zero, and may or may not already have a DHCP Relay
 Agent option in it.

 ***Relay agents configured to add a Relay Agent option which receive a
 client DHCP packet with a nonzero giaddr SHALL discard the packet if
 the giaddr spoofs a giaddr address implemented by the local agent
 itself.***

 Otherwise, the relay agent SHALL forward any received DHCP packet
 with a valid non-zero giaddr WITHOUT adding any relay agent options.
 Per RFC 2131 <
;http://www.faqs.org/rfcs /rfc2131.html>, it shall also NOT modify the
giaddr value.

The part that I highlighted specifies that a relay agent should discard
the packet if the giaddr address is spoofs a giaddr address implemented
by the relay agent. This appears to be the case due to the fact that
the DHCP request packet has a giaddr address of the relay agent
specified in the DHCP offer.
[/QUOTE]

Now, when I changed the noted line above to:

bootp.giaddr = INADDR_ANY;

then recompile, and rebuild my initrd, the relay agent forwards the DHCP
request just fine.

Can anyone comment on why giaddr needs to be set on a DHCP request? Is this
a simple bug, or is there something deeper going on here?

-- 
Ken

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-10 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-10 14:46 klibc ipconfig misbehavior in a network with DHCP snooping maximilian attems
  -- strict thread matches above, loose matches on Subject: below --
2007-12-06 19:50 Ken Simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®