From 01f35e09e07c9413596ce8055a891106bd3e2c6e Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Mon, 2 May 2016 11:19:12 -0700 Subject: [PATCH] compat: ipv6: Pass struct net into nf_ct_frag6_gather. Upstream commit: ipv6: Pass struct net into nf_ct_frag6_gather The function nf_ct_frag6_gather is called on both the input and the output paths of the networking stack. In particular ipv6_defrag which calls nf_ct_frag6_gather is called from both the the PRE_ROUTING chain on input and the LOCAL_OUT chain on output. The addition of a net parameter makes it explicit which network namespace the packets are being reassembled in, and removes the need for nf_ct_frag6_gather to guess. Signed-off-by: "Eric W. Biederman" Acked-by: Pablo Neira Ayuso Signed-off-by: David S. Miller Upstream: b72775977c39 ("ipv6: Pass struct net into nf_ct_frag6_gather") Signed-off-by: Joe Stringer Acked-by: Jesse Gross --- datapath/conntrack.c | 2 +- .../linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h | 3 ++- datapath/linux/compat/nf_conntrack_reasm.c | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 548a05fc2..6cf97942c 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -333,7 +333,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, struct sk_buff *reasm; memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm)); - reasm = nf_ct_frag6_gather(skb, user); + reasm = nf_ct_frag6_gather(net, skb, user); if (!reasm) return -EINPROGRESS; diff --git a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h index 416cafff0..fe99ced37 100644 --- a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h +++ b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h @@ -14,7 +14,8 @@ #if defined(HAVE_NF_CT_FRAG6_CONSUME_ORIG) || \ defined(HAVE_NF_CT_FRAG6_OUTPUT) #define OVS_NF_DEFRAG6_BACKPORT 1 -struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user); +struct sk_buff *rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, + u32 user); int __init rpl_nf_ct_frag6_init(void); void rpl_nf_ct_frag6_cleanup(void); void rpl_nf_ct_frag6_consume_orig(struct sk_buff *skb); diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index ef29115b6..701bd15d8 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -487,12 +487,11 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff) return 0; } -struct sk_buff *rpl_nf_ct_frag6_gather(struct sk_buff *skb, u32 user) +struct sk_buff *rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, + u32 user) { struct sk_buff *clone; struct net_device *dev = skb->dev; - struct net *net = skb_dst(skb) ? dev_net(skb_dst(skb)->dev) - : dev_net(skb->dev); struct frag_hdr *fhdr; struct frag_queue *fq; struct ipv6hdr *hdr; -- 2.20.1