Re: [ovs-dev] [PATCH branch-2.7] compat: Fixup ipv6 fragmentation on 4.9.135+ kernels

2019-09-23 Thread Ben Pfaff
On Thu, Sep 19, 2019 at 02:25:55PM -0700, Greg Rose wrote:
> Upstream commit 648700f76b03 ("inet: frags: use rhashtables...") changed
> how ipv6 fragmentation is implemented.  This patch was backported to
> the upstream stable 4.9.x kernel starting at 4.9.135.
> 
> This patch creates the compatibility layer changes required to both
> compile and also operate correctly with ipv6 fragmentation on these
> kernels. Check if the inet_frags 'rnd' field is present to key on
> whether the upstream patch is present.  Also update Travis to the
> latest 4.9 kernel release so that this patch is compile tested.

Applied, thanks!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH branch-2.7] compat: Fixup ipv6 fragmentation on 4.9.135+ kernels

2019-09-19 Thread 0-day Robot
Bleep bloop.  Greetings Gregory Rose, I am a robot and I have tried out your 
patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors 
or committers: Ben Pfaff 
Lines checked: 194, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH branch-2.7] compat: Fixup ipv6 fragmentation on 4.9.135+ kernels

2019-09-19 Thread Greg Rose
Upstream commit 648700f76b03 ("inet: frags: use rhashtables...") changed
how ipv6 fragmentation is implemented.  This patch was backported to
the upstream stable 4.9.x kernel starting at 4.9.135.

This patch creates the compatibility layer changes required to both
compile and also operate correctly with ipv6 fragmentation on these
kernels. Check if the inet_frags 'rnd' field is present to key on
whether the upstream patch is present.  Also update Travis to the
latest 4.9 kernel release so that this patch is compile tested.

Passes Travis with one unrelated error:
https://travis-ci.org/gvrose8192/ovs-experimental/builds/587124155

Cc: William Tu 
Cc: Yi-Hung Wei 
Cc: Yifeng Sun 
Acked-by: Yi-Hung Wei 
Signed-off-by: Greg Rose 
Signed-off-by: Ben Pfaff 
---
 .travis.yml|  2 +-
 acinclude.m4   |  4 ++-
 datapath/linux/compat/nf_conntrack_reasm.c | 52 --
 3 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a30e913..a4da7af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,7 +28,7 @@ env:
   - BUILD_ENV="-m32" OPTS="--disable-ssl"
   - KERNEL=3.16.39 DPDK=1
   - KERNEL=3.16.39 DPDK=1 OPTS="--enable-shared"
-  - KERNEL=4.9
+  - KERNEL=4.9.149
   - KERNEL=4.8.14
   - KERNEL=4.4.38
   - KERNEL=4.1.36
diff --git a/acinclude.m4 b/acinclude.m4
index cb67d51..18009d5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -701,7 +701,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
 [OVS_DEFINE([HAVE_UDP_ADD_OFFLOAD_TAKES_NET])])
   OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [family_list],
 [OVS_DEFINE([HAVE_GENL_FAMILY_LIST])])
-
+  OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags],
+[rnd],
+[OVS_DEFINE([HAVE_INET_FRAGS_RND])])
 
   if cmp -s datapath/linux/kcompat.h.new \
 datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/nf_conntrack_reasm.c 
b/datapath/linux/compat/nf_conntrack_reasm.c
index fb0a746..dffab9a 100644
--- a/datapath/linux/compat/nf_conntrack_reasm.c
+++ b/datapath/linux/compat/nf_conntrack_reasm.c
@@ -73,6 +73,7 @@ static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
return 1 << (ipv6_get_dsfield(ipv6h) & INET_ECN_MASK);
 }
 
+#ifdef HAVE_INET_FRAGS_RND
 static unsigned int nf_hash_frag(__be32 id, const struct in6_addr *saddr,
 const struct in6_addr *daddr)
 {
@@ -99,6 +100,7 @@ static unsigned int nf_hashfn(struct inet_frag_queue *q)
return nf_hash_frag(nq->id, >saddr, >daddr);
 }
 
+#endif /* HAVE_INET_FRAGS_RND */
 static void nf_ct_frag6_expire(unsigned long data)
 {
struct frag_queue *fq;
@@ -107,9 +109,14 @@ static void nf_ct_frag6_expire(unsigned long data)
fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
net = container_of(fq->q.net, struct net, nf_frag.frags);
 
+#ifdef HAVE_INET_FRAGS_RND
ip6_expire_frag_queue(net, fq, _frags);
+#else
+   ip6_expire_frag_queue(net, fq);
+#endif
 }
 
+#ifdef HAVE_INET_FRAGS_RND
 /* Creation primitives. */
 static inline struct frag_queue *fq_find(struct net *net, __be32 id,
 u32 user, struct in6_addr *src,
@@ -140,7 +147,27 @@ static inline struct frag_queue *fq_find(struct net *net, 
__be32 id,
}
return container_of(q, struct frag_queue, q);
 }
+#else
+static struct frag_queue *fq_find(struct net *net, __be32 id, u32 user,
+ const struct ipv6hdr *hdr, int iif)
+{
+   struct frag_v6_compare_key key = {
+   .id = id,
+   .saddr = hdr->saddr,
+   .daddr = hdr->daddr,
+   .user = user,
+   .iif = iif,
+   };
+   struct inet_frag_queue *q;
 
+   q = inet_frag_find(>nf_frag.frags, );
+   if (!q)
+   return NULL;
+
+   return container_of(q, struct frag_queue, q);
+}
+
+#endif  /* HAVE_INET_FRAGS_RND */
 
 static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
 const struct frag_hdr *fhdr, int nhoff)
@@ -289,7 +316,11 @@ found:
return 0;
 
 discard_fq:
+#ifdef HAVE_INET_FRAGS_RND
inet_frag_kill(>q, _frags);
+#else
+   inet_frag_kill(>q);
+#endif
 err:
return -1;
 }
@@ -311,7 +342,11 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff 
*prev,  struct net_devic
intpayload_len;
u8 ecn;
 
+#ifdef HAVE_INET_FRAGS_RND
inet_frag_kill(>q, _frags);
+#else
+   inet_frag_kill(>q);
+#endif
 
WARN_ON(head == NULL);
WARN_ON(NFCT_FRAG6_CB(head)->offset != 0);
@@ -530,8 +565,13 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff 
*skb, u32 user)
local_bh_enable();
 #endif
 
+#ifdef HAVE_INET_FRAGS_RND
fq = fq_find(net, fhdr->identification, user, >saddr, >daddr,