dhcrelay: Don't relay on all interfaces We explicitly set the interfaces we want to use as downstream, and never want to forward packets from interfaces that don't match this set. Otherwise, broadcast loops on upstream interfaces will cause us to forward DHCP relay request packets unnecessarily and break request flows. We used to see errors like below, when running with 2 upstream interfaces like `dhcrelay -d --no-pid -l gbmcdhcp -u ff02::1:2%ncsi -u ff02::1:2%l2br` ``` Relaying Request from fe80::600:6eff:fefc:efb0 port 546 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. Hop count exceeded, ``` Now we see normal behavior like ``` Relaying Solicit from fe80::600:6eff:fefc:efb0 port 546 going up. Relaying Advertise to fe80::600:6eff:fefc:efb0 port 546 down. Relaying Request from fe80::600:6eff:fefc:efb0 port 546 going up. Relaying Reply to fe80::600:6eff:fefc:efb0 port 546 down. ``` Tested: Ran with and without the patch while sending on 2 upstreams, to verify that receiving our own packets no longer resends them in a loop. Fusion-Link: https://fusion2.corp.google.com/40de6bee-25d5-3adb-9a72-d7ac0446de8e (platform11) Fusion-Link: https://fusion2.corp.google.com/f1ccf069-b950-34d3-8c01-cf3ef8c4e402 (platform11-emr) Fusion-Link: https://fusion2.corp.google.com/68f3a731-c9f1-3174-90dd-4e78901547eb (platform15) Fusion-Link: https://fusion2.corp.google.com/8ff5ec1c-1bf3-3f5f-8362-beced55f9415 (platform5) Google-Bug-Id: 473024765 Change-Id: I22b18902f7ed3ba7c6be0206131fe0b583d8a617 Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/recipes-connectivity/dhcp/dhcp-relay/0001-dhcrelay-Remove-forwarding-on-uknown-interfaces.patch b/recipes-connectivity/dhcp/dhcp-relay/0001-dhcrelay-Remove-forwarding-on-uknown-interfaces.patch new file mode 100644 index 0000000..a6b0df7 --- /dev/null +++ b/recipes-connectivity/dhcp/dhcp-relay/0001-dhcrelay-Remove-forwarding-on-uknown-interfaces.patch
@@ -0,0 +1,56 @@ +From acd8f2cf534fb2b876f34de99bbee6b4eecc365d Mon Sep 17 00:00:00 2001 +From: "William A. Kennington III" <wak@google.com> +Date: Mon, 5 Jan 2026 16:35:55 -0800 +Subject: [PATCH] dhcrelay: Remove forwarding on uknown interfaces + +We explicitly set the interfaces we want to use as downstream, and never +want to forward packets from interfaces that don't match this set. +Otherwise, broadcast loops on upstream interfaces will cause us to +forward DHCP relay request packets unnecessarily and break request +flows. + +We used to see errors like below, when running with 2 upstream +interfaces like `dhcrelay -d --no-pid -l gbmcdhcp -u ff02::1:2%ncsi -u ff02::1:2%l2br` +``` +Relaying Request from fe80::600:6eff:fefc:efb0 port 546 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Relaying Relay-forward from fe80::600:6eff:fefc:efb0 port 547 going up. +Hop count exceeded, +``` + +Now we see normal behavior like +``` +Relaying Solicit from fe80::600:6eff:fefc:efb0 port 546 going up. +Relaying Advertise to fe80::600:6eff:fefc:efb0 port 546 down. +Relaying Request from fe80::600:6eff:fefc:efb0 port 546 going up. +Relaying Reply to fe80::600:6eff:fefc:efb0 port 546 down. +``` + +--- + relay/dhcrelay.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 946ef1b0..d9b5719c 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -2063,6 +2063,7 @@ dhcpv6(struct packet *packet) { + process_up6(packet, dp); + return; + } ++ return; + /* Relay-forward could work from an unknown interface. */ + if (packet->dhcpv6_msg_type == DHCPV6_RELAY_FORW) { + process_up6(packet, NULL); +-- +2.52.0.351.gbe84eed79e-goog +
diff --git a/recipes-connectivity/dhcp/dhcp-relay_%.bbappend b/recipes-connectivity/dhcp/dhcp-relay_%.bbappend new file mode 100644 index 0000000..e577b45 --- /dev/null +++ b/recipes-connectivity/dhcp/dhcp-relay_%.bbappend
@@ -0,0 +1,2 @@ +FILESEXTRAPATHS:prepend:gbmc := "${THISDIR}/${PN}:" +SRC_URI:append:gbmc = " file://0001-dhcrelay-Remove-forwarding-on-uknown-interfaces.patch"