This diff makes dhcrelay(8) drop packets that were not meant for us.
This is a safety check suggested by jca@ to avoid relaying packets with
the address of other relays.
ok?
Index: dhcrelay.c
===================================================================
RCS file: /cvs/src/usr.sbin/dhcrelay/dhcrelay.c,v
retrieving revision 1.49
diff -u -p -r1.49 dhcrelay.c
--- dhcrelay.c 8 Dec 2016 19:18:15 -0000 1.49
+++ dhcrelay.c 8 Dec 2016 19:52:51 -0000
@@ -276,6 +276,11 @@ relay(struct interface_info *ip, struct
/* If it's a bootreply, forward it to the client. */
if (packet->op == BOOTREPLY) {
+ /* Filter packet that were not meant for us. */
+ if (packet->giaddr.s_addr !=
+ interfaces->primary_address.s_addr)
+ return;
+
bzero(&to, sizeof(to));
if (!(packet->flags & htons(BOOTP_BROADCAST))) {
to.sin_addr = packet->yiaddr;