dhcpd ACK's too much

2013-03-10 Thread Kenneth R Westerback
As reported by Andy via bugs@, our dhcpd is tad too accommodating
with its ACK'ing. According to RFC 2131 the server should only ACK
a REQUEST containing a server-identifier option if the server-identifier
identifies that server.

Andy confirms this works for him. Any other testers with challenging
dhcpd setups want to comment?

 Ken

Index: dhcp.c
===
RCS file: /cvs/src/usr.sbin/dhcpd/dhcp.c,v
retrieving revision 1.33
diff -u -p -r1.33 dhcp.c
--- dhcp.c  14 Feb 2013 22:06:13 -  1.33
+++ dhcp.c  10 Mar 2013 15:16:27 -
@@ -321,6 +321,15 @@ dhcprequest(struct packet *packet)
return;
}
 
+   /*
+* Do not ACK a REQUEST intended for another server.
+*/
+   if (packet-options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) {
+   if (memcmp(packet-options[DHO_DHCP_SERVER_IDENTIFIER].data,
+   packet-interface-primary_address, 4))
+   return;
+   }
+ 
/*
 * If we own the lease that the client is asking for,
 * and it's already been assigned to the client, ack it.



[PATCH] knf src/sys/net/if_pppoe.c

2013-03-10 Thread Michael W. Bombardieri
Hi tech,

I have a minor KNF patch for if_pppoe.c...
Submitting this in case anyone is interested.

- Michael


Index: if_pppoe.c
===
RCS file: /cvs/src/sys/net/if_pppoe.c,v
retrieving revision 1.35
diff -u -r1.35 if_pppoe.c
--- if_pppoe.c  11 Apr 2012 17:42:53 -  1.35
+++ if_pppoe.c  11 Mar 2013 02:18:04 -
@@ -389,7 +389,8 @@
 }
 
 /* Analyze and handle a single received packet while not in session state. */
-static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
+static void
+pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
 {
struct pppoe_softc *sc;
struct pppoehdr *ph;
@@ -1108,9 +1109,8 @@
PPPOE_ADD_16(p, l1);
memcpy(p, sc-sc_service_name, l1);
p += l1;
-   } else {
+   } else
PPPOE_ADD_16(p, 0);
-   }
if (sc-sc_concentrator_name != NULL) {
PPPOE_ADD_16(p, PPPOE_TAG_ACNAME);
PPPOE_ADD_16(p, l2);