cc as DHCP relay agent

Thomas Liske liske at ibh.de
Fri Mar 13 09:18:38 UTC 2009


Hi,

I think there is an issue with DHCP relay in coova-chilli. Cc always 
listens on port 68 for replies from the DHCP server when acting as a 
DHCP relay (line 592):

$ cat -n src/dhcp.c | grep -C 5 'htons(68)'
    587
    588      if (fd > 0) {
    589        memset(&addr, 0, sizeof(addr));
    590        addr.sin_family = AF_INET;
    591        addr.sin_addr.s_addr = dhcp->uamlisten.s_addr;
    592        addr.sin_port = htons(68);
    593
    594        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, 
sizeof(on)) < 0) {
    595          log_err(errno, "Can't set reuse option");
    596        }
    597

This does not work with the (recent) ISC DHCP Daemon v3. The dhcpd 
always replies to port 67 ignoring the port number seen in the request 
packet from the DHCP relay agent.

There is a working draft stating about the port usage with relay agents:

====[http://tools.ietf.org/id/draft-ietf-dhc-implementation-02.txt]====
4.7.2 Relay Agent Port Usage
   Relay agents should use port 67 as the source port number.  Relay
   agents always listen on port 67, but port 68 has sometimes been used
   as the source port number probably because it was copied from the
   source port of the incoming packet.

   Cable modem vendors would like to install filters blocking outgoing
   packets with source port 67.

   RECOMMENDATIONS:
     O  Relay agents MUST use 67 as their source port number.
     O  Relay agents MUST NOT forward packets with non-zero giaddr
        unless the source port number on the packet is 67.
====[http://tools.ietf.org/id/draft-ietf-dhc-implementation-02.txt]====

IMHO cc should listen on port 67/udp when acting as DHCP relay agent.


	Thomas




More information about the Chilli mailing list