Repository: moby/moby (language: go)

Issue:
drivers/ipvlan: add ipvlan_flag option, support l3s ipvlan_mode
* 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


Discussion / hints:
@evol262 ptal
LGTM in general. A small nitpick, but not worth blocking on.
The commit in torvalds/linux didn't match for some reason; I think this was the one referred to; https://github.com/torvalds/linux/commit/4fbae7d83c98c30efcf0a2a2ac55fbb75ef5a1a5
@evol262 I opened https://github.com/moby/moby/pull/43760 with some cleaning up

Fix patch:
diff --git a/libnetwork/drivers/ipvlan/ipvlan_store.go b/libnetwork/drivers/ipvlan/ipvlan_store.go
index ec6dd5cecdc9a..c5ace3f4da52b 100644
--- a/libnetwork/drivers/ipvlan/ipvlan_store.go
+++ b/libnetwork/drivers/ipvlan/ipvlan_store.go
@@ -159,6 +159,7 @@ func (config *configuration) MarshalJSON() ([]byte, error) {
 	nMap["Mtu"] = config.Mtu
 	nMap["Parent"] = config.Parent
 	nMap["IpvlanMode"] = config.IpvlanMode
+	nMap["IpvlanFlag"] = config.IpvlanFlag
 	nMap["Internal"] = config.Internal
 	nMap["CreatedSubIface"] = config.CreatedSlaveLink
 	if len(config.Ipv4Subnets) > 0 {
@@ -192,6 +193,7 @@ func (config *configuration) UnmarshalJSON(b []byte) error {
 	config.Mtu = int(nMap["Mtu"].(float64))
 	config.Parent = nMap["Parent"].(string)
 	config.IpvlanMode = nMap["IpvlanMode"].(string)
+	config.IpvlanFlag = nMap["IpvlanFlag"].(string)
 	config.Internal = nMap["Internal"].(bool)
 	config.CreatedSlaveLink = nMap["CreatedSubIface"].(bool)
 	if v, ok := nMap["Ipv4Subnets"]; ok {


Test patch: