net: dev_forward_skb(): Scrub packet's per-netns info only when crossing netns
Subsystems (2)
Quoted 47 lines · ----- [email protected] wrote:
Quoted 10 lines · Shmulik Ladkani
Regarding the premise of this commit, this "reduces" the ipvs/orphan/mark scrubbing in the following *non* xnet situations:
1. mac2vlan port xmit to other macvlan ports in Bridge Mode
2. similarly for ipvlan
3. veth xmit
4.l2tp_eth_dev_recv
5. bpf redirect/clone_redirect ingress actionsRegarding l2tp recv, this commit seems to align the srubbing
behavior
Quoted 1 line
with ip tunnels (full scrub only if crossing netns, see
ip_tunnel_rcv).Quoted 2 lines
Regarding veth xmit, it does makes sense to preserve the fields if
not
Quoted 3 lines
crossing netns. This is also the case when one uses tc mirred.
Regarding bpf redirect, well, it depends on the expectations of each
bpf
Quoted 2 lines
program.
I'd argue that preserving the fields (at least the mark field) inthe
Quoted 1 line
*non* xnet makes sense and provides more information and therefore
more
Quoted 1 line
capabilities; Alas this might change behavior already being relied
on.
Quoted 2 lines
Maybe Daniel can comment on the matter.
Overall I think it might be nice to not need scrubbing skb in such cases,
although my concern would be that this has potential to break existing
setups when they would expect mark being zero on other veth peer in any
case since it's the behavior for a long time already. The safer option
would be to have some sort of explicit opt-in e.g. on link creation to let
theskb->markpass through unscrubbed. This would definitely be a useful
option e.g. when mark is set in the netns facing veth via clsact/egress
on xmit and when the container is unprivileged anyway.
Quoted 2 lines
Thanks,
Daniel
I see your point in regards to backwards comparability.
However, not scrubbing skb when it cross netns via some kernel functions compared to others is basically a bug which could easily break with a little bit of more refactoring. Therefore, it seems a bit weird to me to from now on, we will force
every user on link creation to consider that once there was a bug leading to this weird behavior on specific netdevs.
Thus, I suggest to maybe control this via a global /proc/sys/net file instead.
-Liran
Liran Alon <[email protected]> writes:
[...]
Quoted 19 lines
Quoted 16 lines
Overall I think it might be nice to not need scrubbing skb in such cases,
although my concern would be that this has potential to break existing
setups when they would expect mark being zero on other veth peer in any
case since it's the behavior for a long time already. The safer option
would be to have some sort of explicit opt-in e.g. on link creation to let
theskb->markpass through unscrubbed. This would definitely be a useful
option e.g. when mark is set in the netns facing veth via clsact/egress
on xmit and when the container is unprivileged anyway.Quoted 2 lines
Thanks,
Daniel
Quoted 7 lines
I see your point in regards to backwards comparability.
However, not scrubbing skb when it cross netns via some kernel functions compared to others is basically a bug which could easily break with a little bit of more refactoring. Therefore, it seems a bit weird to me to from now on, we will force
every user on link creation to consider that once there was a bug leading to this weird behavior on specific netdevs.
Thus, I suggest to maybe control this via a global/proc/sys/netfile instead.
One valid use case could be preserving a source namespace nsid in skb->mark when a packet crosses netns.
Quoted 27 lines · Roman Mashak
Liran Alon <[email protected]> writes:
[...]Quoted 25 lines
Quoted 16 lines
Overall I think it might be nice to not need scrubbing skb in such cases,
although my concern would be that this has potential to break existing
setups when they would expect mark being zero on other veth peer in any
case since it's the behavior for a long time already. The safer option
would be to have some sort of explicit opt-in e.g. on link creation to let
theskb->markpass through unscrubbed. This would definitely be a useful
option e.g. when mark is set in the netns facing veth via clsact/egress
on xmit and when the container is unprivileged anyway.Quoted 2 lines
Thanks,
DanielI see your point in regards to backwards comparability.
However, not scrubbing skb when it cross netns via some kernel functions compared to others is basically a bug which could easily break with a little bit of more refactoring. Therefore, it seems a bit weird to me to from now on, we will force
every user on link creation to consider that once there was a bug leading to this weird behavior on specific netdevs.
Why bug specifically? It could well be that for some unpriv containers it would be fine to do e.g. in cases where orchestrator sets up clsact/ egress on veth/ipvlan/etc in the container to set the mark and where app cannot mess with this while for others you need to act out of host facing veth; thus, explicit opt-in per dev could provide such more fine grained control.
Quoted 2 lines
One valid use case could be preserving a source namespace nsid in
skb->markwhen a packet crosses netns.
Right, was thinking about something similar.