Re: [PATCH net-next 01/12] ipvlan: Support MACNAT mode
From: Dmitry Skorodumov
Date: Thu Nov 27 2025 - 03:13:21 EST
On 25.11.2025 15:58, Paolo Abeni wrote:
> On 11/20/25 6:49 PM, Dmitry Skorodumov wrote:
>> +static inline void ipvlan_mark_skb(struct sk_buff *skb, struct net_device *dev)
>> +{
>> + IPVL_SKB_CB(skb)->mark = dev;
> + if (ipvlan_is_skb_marked(skb, port->dev))
> ... and this is the receiver path. Nothing guaratees the CB is preserved
> in between and that random data in there will not confuse the above
> check. Also I'm not sure what you are trying to filter out here.
I need to recheck.. unfortunately I didn't wrote enough comments here and now unsure about some details..
>> @@ -597,6 +690,9 @@ int ipvlan_link_new(struct net_device *dev, struct rtnl_newlink_params *params,
>> port = ipvlan_port_get_rtnl(phy_dev);
>> ipvlan->port = port;
>>
>> + if (data && data[IFLA_IPVLAN_FLAGS])
>> + port->flags = nla_get_u16(data[IFLA_IPVLAN_FLAGS]);
> This looks like a change of behavior that could potentially break the
> user-space.
>
>> +
>> /* If the port-id base is at the MAX value, then wrap it around and
>> * begin from 0x1 again. This may be due to a busy system where lots
>> * of slaves are getting created and deleted.
>> @@ -625,19 +721,13 @@ int ipvlan_link_new(struct net_device *dev, struct rtnl_newlink_params *params,
>> if (err)
>> goto remove_ida;
>>
>> - /* Flags are per port and latest update overrides. User has
>> - * to be consistent in setting it just like the mode attribute.
>> - */
>> - if (data && data[IFLA_IPVLAN_FLAGS])
>> - port->flags = nla_get_u16(data[IFLA_IPVLAN_FLAGS]);
>> -
>> - if (data && data[IFLA_IPVLAN_MODE])
>> - mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
>> -
>> err = ipvlan_set_port_mode(port, mode, extack);
>> if (err)
>> goto unlink_netdev;
>>
>>
Hm... What am I missing? The intention was to know "mode" a bit earlier and generate MAC as random for macnat-mode.. it's supposed to be just a simple line move a bit upper in the code
PS: I agree with other issues and will work on it
Dmitry