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>
1 file changed