diff options
author | rzalamena <rzalamena@openbsd.org> | 2016-12-13 09:29:05 +0000 |
---|---|---|
committer | rzalamena <rzalamena@openbsd.org> | 2016-12-13 09:29:05 +0000 |
commit | 12c372e5c3c9454b0ff7d225bcae94090680c5cd (patch) | |
tree | aa0803b4eb764d291d8f4b39f36c2ac31a39b126 /usr.sbin/dhcrelay/dhcrelay.c | |
parent | Propagate the routing table id in ip_mrouter_set() so the MRT_ADD_VIF (diff) | |
download | wireguard-openbsd-12c372e5c3c9454b0ff7d225bcae94090680c5cd.tar.xz wireguard-openbsd-12c372e5c3c9454b0ff7d225bcae94090680c5cd.zip |
Filter DHCP reply messages that were not meant for us by looking at the
gateway set. This happens mostly because we are watching a BPF socket.
Suggested by and ok jca@
Diffstat (limited to 'usr.sbin/dhcrelay/dhcrelay.c')
-rw-r--r-- | usr.sbin/dhcrelay/dhcrelay.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/dhcrelay/dhcrelay.c b/usr.sbin/dhcrelay/dhcrelay.c index c5a7816aac5..f84c5b82da3 100644 --- a/usr.sbin/dhcrelay/dhcrelay.c +++ b/usr.sbin/dhcrelay/dhcrelay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcrelay.c,v 1.51 2016/12/13 06:55:32 jmc Exp $ */ +/* $OpenBSD: dhcrelay.c,v 1.52 2016/12/13 09:29:05 rzalamena Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org> @@ -341,6 +341,11 @@ relay(struct interface_info *ip, struct dhcp_packet *packet, int length, /* 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; |