-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[201803][dhcp_relay] Add support for DHCP client(s) on one VLAN and DHCP server(s) on another #2857
Merged
lguohan
merged 8 commits into
sonic-net:201803
from
jleveque:uplink_downlink_patch_isc-dhcp-relay_201803
May 17, 2019
Merged
[201803][dhcp_relay] Add support for DHCP client(s) on one VLAN and DHCP server(s) on another #2857
lguohan
merged 8 commits into
sonic-net:201803
from
jleveque:uplink_downlink_patch_isc-dhcp-relay_201803
May 17, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…on all upstream interfaces
… interfaace if it is a directed broadcast
qiluo-msft
reviewed
May 9, 2019
src/isc-dhcp/patch/0007-Uncomment-USE_SOCKETS-to-force-dhcrelay-to-create-an.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Outdated
Show resolved
Hide resolved
lguohan
reviewed
May 12, 2019
src/isc-dhcp/patch/0009-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch
Show resolved
Hide resolved
lguohan
requested changes
May 12, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case the vlan interface has multiple IP addresses, the logic has a problem.
lguohan
approved these changes
May 15, 2019
qiluo-msft
reviewed
May 17, 2019
src/isc-dhcp/patch/0007-Add-enable-use-sockets-to-configure-flags-in-debian-.patch
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, the DHCP relay agent in SONiC would not relay DHCP requests to other VLANs. Therefore, if a DHCP client and the DHCP server it needed to communicate with resided on different VLANs under the same ToR device, the DHCP server would never receive the requests. The reason for this was because there was no way to specify whether the agent should only listen for requests or responses on each interface, so each DHCP relay agent could only listen on one VLAN to avoid sending DHCP requests and replies to incorrect DHCP servers.
How I did it
-id
and-iu
arguments, which allow us to specify 'downstream' and 'upstream' interfaces, respectively (the relay agent will only listen for requests on downstream interfaces, and will only listen for replies on upstream interfaces.-id
), and all other interfaces (including all other VLAN interfaces) as upstream interfaces (-iu
).ERR dhcrelay[172]: send_packet: Permission denied
. I discovered that this was due to the relay agent being built by default to open one shared socket on a "fallback" interface, without theSO_BROADCAST
flag set. I then added a patch to force the relay agent to open one socket per interface, each with theSO_BROADCAST
flag set. I then noticed, however, that when built with this configuration, the relay agent would only relay packets on one upstream interface, so I created another patch such that if it is built to use multiple sockets, it should relay requests to all server IPs on all upstream interfaces. This solution is not optimal, as we will send multiple unnecessary copies of the same packets.I intend to amend this in the near future such that if we know the DHCP packet is a directed broadcast destined for an IP on our device, we will forward it to that interface, otherwise we will forward the packet to the fallback interface and let the kernel route it.USE_SOCKETS
was defined. With this fix, I was able to open sockets on all specified interfaces, as well as a fallback interface. Then I was able to create a patch to relay request packets as follows: