Skip to content

drivers/ipvlan: add ipvlan_flag option, support l3s ipvlan_mode#42542

Merged
cpuguy83 merged 1 commit into
moby:masterfrom
zhangyoufu:libnetwork-ipvlan-enhance
Jun 30, 2022
Merged

drivers/ipvlan: add ipvlan_flag option, support l3s ipvlan_mode#42542
cpuguy83 merged 1 commit into
moby:masterfrom
zhangyoufu:libnetwork-ipvlan-enhance

Conversation

@zhangyoufu
Copy link
Copy Markdown
Contributor

  • ipvlan flags are similar to macvlan modes (bridge/private/vepa), available since Linux v4.15
  • ipvlan l3s mode was introduced in torvalds/linux@8ddda65, available since Linux v4.9

    This is very similar to the L3 mode except that iptables (conn-tracking) works in this mode and hence it is L3-symmetric (L3s). This will have slightly less performance but that shouldn’t matter since you are choosing this mode over plain-L3 mode to make conn-tracking work.

recreated from moby/libnetwork#2619

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question.
Mostly seems fine though I'm not a network expert.

ParentIndex: parentLink.Attrs().Index,
},
Mode: mode,
Flag: flag,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we are always setting this now.
Is there a behavior change here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No behavior change here. Bridge (0) is the traditional mode where slaves can cross-talk among
themselves apart from talking through the master device.

@zhangyoufu zhangyoufu requested a review from cpuguy83 June 29, 2022 02:22
@thaJeztah thaJeztah added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/networking Networking impact/changelog labels Jun 29, 2022
@thaJeztah
Copy link
Copy Markdown
Member

@evol262 ptal

parentOpt = "parent" // parent interface -o parent
driverModeOpt = ipvlanType + "_mode" // mode -o ipvlan_mode
driverFlagOpt = ipvlanType + "_flag" // flag -o ipvlan_flag

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will get optimized out by the compiler anyway, but it seems like these could simly be driverModeOpt = "ipvlan_mode", since the variable never appears be reassigned anywhere. Honestly, it could probably be a const, but that's nitpicky. Still, the concatenation should just be a string literal, otherwise a reader may spend time looking through the codebase to see if it ever changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many references of ipvlanType all around this driver, all of them are redundant. Considering the similarity between macvlan and ipvlan, maybe the original author of the code intentionally leave an extra level of indirection to make code refactoring (identifier renaming) easier and more confident. I tried to keep the original style when introducing my changes.

@evol262
Copy link
Copy Markdown

evol262 commented Jun 30, 2022

LGTM in general. A small nitpick, but not worth blocking on.

@thaJeztah
Copy link
Copy Markdown
Member

The commit in torvalds/linux didn't match for some reason; I think this was the one referred to; torvalds/linux@4fbae7d

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

@evol262 I opened #43760 with some cleaning up

@zhangyoufu zhangyoufu deleted the libnetwork-ipvlan-enhance branch August 24, 2022 06:58
thaJeztah pushed a commit to thaJeztah/docker that referenced this pull request Aug 24, 2022
Fixes moby#42542

Signed-off-by: Youfu Zhang <[email protected]>
(cherry picked from commit 549d24b)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/networking Networking docs/revisit impact/changelog impact/documentation kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants