]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ipv4: ip_do_fragment: Preserve skb_iif during fragmentation
authorShmulik Ladkani <shmulik@metanetworks.com>
Mon, 29 Apr 2019 13:39:30 +0000 (16:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:20:43 +0000 (07:20 +0200)
commitb8ed0714321f0797e4e8a55740719df34dee9b7d
tree81e44beac96883affa11c4c2a5086b64cdc4c56b
parentc3d06de015a2349c16a3f3b87f78925a36c34464
ipv4: ip_do_fragment: Preserve skb_iif during fragmentation

[ Upstream commit d2f0c961148f65bc73eda72b9fa3a4e80973cb49 ]

Previously, during fragmentation after forwarding, skb->skb_iif isn't
preserved, i.e. 'ip_copy_metadata' does not copy skb_iif from given
'from' skb.

As a result, ip_do_fragment's creates fragments with zero skb_iif,
leading to inconsistent behavior.

Assume for example an eBPF program attached at tc egress (post
forwarding) that examines __sk_buff->ingress_ifindex:
 - the correct iif is observed if forwarding path does not involve
   fragmentation/refragmentation
 - a bogus iif is observed if forwarding path involves
   fragmentation/refragmentatiom

Fix, by preserving skb_iif during 'ip_copy_metadata'.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/ip_output.c