[201811][isc-dhcp-relay] Patch to allow DHCP relay agent to discover interfaces even if they are down #3852
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
Patch isc-dhcp-relay in order to allow the relay agent to discover configured interfaces even if they are down.
Without this patch, the relay agent will not discover configured interfaces if they are down when the relay agent starts up. If the interface(s) then get brought up after the relay started, the relay will discard packets received on these interfaces and log the message,
Discarding packet received on <iface_name> interface that has no IPv4 address assigned.
This led to race conditions when starting SONiC (or loading configuration). To resolve this, the relay agent would need to be restarted with all configured interfaces up.With this patch, the relay agent will discover all configured interfaces, whether or not they are up at the time the relay agent starts. Thus, the state of the configured interfaces can be down when the relay agent starts and brought up during the lifetime of the relay agent process, and the relay agent will relay packets as expected; it will not discard them.
This PR backports #3851 to the 201811 branch.
- How to verify it
systemctl stop dhcp_relay.service
)systemctl start dhcp_relay.service
). Wait for the container to spawn the dhcrelay process(es).tcpdump -ne -i <iface_name> port 67 or 68
or similar command)b. Craft and send DHCP Discover or Request packet to the switch on the downlink (the DHCP relay test in the sonic-mgmt repo can be helpful here)
c. Check packet capture to confirm the packet was relayed to all configured destination IP addresses on each configured uplink interface
d. Craft and send DHCP Offer or Ack packet in on each uplink (again, the DHCP relay test in the sonic-mgmt repo can be helpful here)
e. Check packet capture to confirm the packet was relayed to all configured destination IP addresses on each configured uplink interface
f. Check /var/log/syslog to ensure that no
Discarding packet received on <iface_name> interface that has no IPv4 address assigned.
messages were loggedsystemctl stop dhcp_relay.service
)systemctl start dhcp_relay.service
). Wait for the container to spawn the dhcrelay process(es).systemctl stop dhcp_relay.service
)systemctl start dhcp_relay.service
). Wait for the container to spawn the dhcrelay process(es).a. Bring down the interface on the switch, wait for a few seconds, then bring the interface back up
b. Repeat step 4
a. Bring down the connected interface on the neighboring switch, wait for a few seconds, then bring the interface on the neighboring switch back up
b. Repeat step 4