dhcp: allow suppressing default gateway from lease result - #1276
Open
locker95 wants to merge 2 commits into
Open
dhcp: allow suppressing default gateway from lease result#1276locker95 wants to merge 2 commits into
locker95 wants to merge 2 commits into
Conversation
Some DHCP servers send a router option even when the client did not
request it (skipDefault only affects the parameter request list). With
Multus secondary attachments that installs a second default route and
breaks pod networking.
Add an ipam.suppress list; when it includes "gateway", clear
IPConfig.Gateway and drop default routes (0.0.0.0/0, ::/0) from the
result while keeping non-default routes such as option 121 classless
static routes.
Example:
"ipam": { "type": "dhcp", "suppress": ["gateway"] }
Fixes containernetworking#1208
Signed-off-by: Dean Chen <862469039@qq.com>
nonamedreturns fails CI on the suppress helper. Signed-off-by: Dean Chen <862469039@qq.com>
This file contains hidden or 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
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.
Summary
When Multus (or similar) attaches a secondary interface with the dhcp IPAM plugin, a DHCP-provided default gateway is written into the CNI result. That becomes a second default route in the pod and often breaks connectivity. Multus documents this failure mode, and
skipDefaultonly changes the DHCP parameter request list — many servers still send option 3 (routers) unsolicited.This adds an
ipam.suppresslist. With"suppress": ["gateway"]:IPConfig.Gatewayis left empty0.0.0.0/0,::/0) are dropped fromRoutesThis is intentionally narrower than the abandoned
discardDhcpRoutesapproach in #701, which dropped all DHCP routes (maintainers called that out).Example
{ "type": "macvlan", "master": "eth1", "mode": "bridge", "ipam": { "type": "dhcp", "suppress": ["gateway"] } }request/skipDefaultremain unchanged for clients that want to avoid requesting the router option;suppresscovers servers that send it anyway.Test plan
parseSuppress,isDefaultRoute,filterDefaultRoutesgo test ./plugins/ipam/dhcp/(package needs netns/root; pure helpers compile withGOOS=linux)Fixes #1208