]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 17:28:34 +0000 (13:28 -0400)
commit4e7a6e4df7c9e8abf06ad926d73542c8dc423c77
tree99de723ffe2f3a3222dad7f850ce0c3aaea8a0ce
parent6a8c205b040db52207067f7155b11008cdad6017
ipv4: ip_do_fragment: Preserve skb_iif during fragmentation

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>
net/ipv4/ip_output.c