From 0 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 7 Dec 2018 21:11:06 +0300 Subject: [PATCH 37] dhcrelay: fix relaying of return packets diff --git a/dhcp/common/discover.c b/dhcp/common/discover.c index defaced..defaced 100644 --- a/dhcp/common/discover.c +++ b/dhcp/common/discover.c @@ -768,9 +768,9 @@ discover_interfaces(int state) { INTERFACE_REQUESTED); #ifdef DHCPv6 - if (!(tmp->flags & INTERFACE_REQUESTED)) { + if (!(tmp->flags & INTERFACE_REQUESTED) && state != DISCOVER_RELAY) { #else - if (!tmp -> ifp || !(tmp -> flags & INTERFACE_REQUESTED)) { + if (!tmp -> ifp || (!(tmp -> flags & INTERFACE_REQUESTED) && state != DISCOVER_RELAY)) { #endif /* DHCPv6 */ if ((tmp -> flags & INTERFACE_REQUESTED) != ir) log_fatal ("%s: not found", tmp -> name); diff --git a/dhcp/relay/dhcrelay.c b/dhcp/relay/dhcrelay.c index defaced..defaced 100644 --- a/dhcp/relay/dhcrelay.c +++ b/dhcp/relay/dhcrelay.c @@ -993,6 +993,11 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, return; } + /* If this is not a BOOTREPLY, and it is not on a requested interface, + * drop it. */ + if (!(ip->flags & INTERFACE_REQUESTED)) + return; + /* Add relay agent options if indicated. If something goes wrong, * drop the packet. Note this may set packet->giaddr if RFC3527 * is enabled. */