summaryrefslogtreecommitdiff
authorShmulik Ladkani <shmulik@metanetworks.com>2019-04-29 13:39:30 (GMT)
committer Greg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-08 05:19:04 (GMT)
commitbcb37e6d310c458447b6ae2eccf045a1ceaa3698 (patch)
tree0d6f3abb42597def982c55124eff9ab1e7f26bef
parentb9daeb29a4c8c579de8dddf9036e14aed1663a99 (diff)
downloadcommon-bcb37e6d310c458447b6ae2eccf045a1ceaa3698.zip
common-bcb37e6d310c458447b6ae2eccf045a1ceaa3698.tar.gz
common-bcb37e6d310c458447b6ae2eccf045a1ceaa3698.tar.bz2
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>
Diffstat
-rw-r--r--net/ipv4/ip_output.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 100c86f..7f1a85c 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -492,6 +492,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
to->pkt_type = from->pkt_type;
to->priority = from->priority;
to->protocol = from->protocol;
+ to->skb_iif = from->skb_iif;
skb_dst_drop(to);
skb_dst_copy(to, from);
to->dev = from->dev;