Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[isc-dhcp-relay] Patch to allow DHCP relay agent to discover interfaces even if they are down #3851

Merged
merged 1 commit into from
Dec 7, 2019

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Dec 6, 2019

- 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.

- How to verify it

  1. Stop DHCP relay service (systemctl stop dhcp_relay.service)
  2. Ensure all configured relay interfaces are up
  3. Start DHCP relay service (systemctl start dhcp_relay.service). Wait for the container to spawn the dhcrelay process(es).
  4. a. Begin DHCP packet capture on each configured interface (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 logged
  5. Stop DHCP relay service (systemctl stop dhcp_relay.service)
  6. Bring all configured relay interfaces down
  7. Start DHCP relay service (systemctl start dhcp_relay.service). Wait for the container to spawn the dhcrelay process(es).
  8. Bring all configured relay interfaces up
  9. Repeat step 4
  10. Stop DHCP relay service (systemctl stop dhcp_relay.service)
  11. Ensure all configured relay interfaces are up
  12. Start DHCP relay service (systemctl start dhcp_relay.service). Wait for the container to spawn the dhcrelay process(es).
  13. For each uplink interface:
    a. Bring down the interface on the switch, wait for a few seconds, then bring the interface back up
    b. Repeat step 4
  14. For each uplink interface:
    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

@jleveque jleveque requested a review from lguohan December 6, 2019 07:45
@jleveque jleveque self-assigned this Dec 6, 2019
@jleveque jleveque changed the title [isc-dhcp-relay] Patch to allow relay agent to discover interfaces even if they are down [isc-dhcp-relay] Patch to allow DHCP relay agent to discover interfaces even if they are down Dec 6, 2019
@lguohan
Copy link
Collaborator

lguohan commented Dec 6, 2019

please describe the test you have done

@jleveque
Copy link
Contributor Author

jleveque commented Dec 6, 2019

Testing instructions added to PR description.

@jleveque
Copy link
Contributor Author

jleveque commented Dec 7, 2019

Retest vsimage please

@lguohan lguohan merged commit 8ab75e0 into sonic-net:master Dec 7, 2019
@jleveque jleveque deleted the fix_dhcp_relay branch December 7, 2019 19:27
abdosi pushed a commit that referenced this pull request Jan 3, 2020
…3851)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants