Re: [PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Eric Dumazet
On Fri, 2015-06-12 at 18:50 -0700, Alexei Starovoitov wrote:

 
 sure, that's better.
 If you're going to submit it officialy, please add my Tested-by.
 My server is happy now :)

Sure , will do.

I tried adding __must_check to __skb_header_pointer() but apparently had
to use W=1 to get a warning :

make W=1 net/core/
  CC  net/core/flow_dissector.o
net/core/flow_dissector.c: In function ‘__skb_flow_dissect’:
net/core/flow_dissector.c:390:19: warning: variable ‘opthdr’ set but not
used [-Wunused-but-set-variable]
   u8 _opthdr[2], *opthdr;


diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 
cc612fc0a8943ec853b92e6b3516b0e5582299e2..45252c4f49e4020eec523273f23f65ee87cc0bd5
 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2743,8 +2743,9 @@ __wsum __skb_checksum(const struct sk_buff *skb, int 
offset, int len,
 __wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
__wsum csum);
 
-static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset,
-int len, void *data, int hlen, void 
*buffer)
+static inline void * __must_check
+__skb_header_pointer(const struct sk_buff *skb, int offset,
+int len, void *data, int hlen, void *buffer)
 {
if (hlen - offset = len)
return data + offset;


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Alexei Starovoitov
On Fri, Jun 12, 2015 at 06:37:34PM -0700, Eric Dumazet wrote:
 On Fri, 2015-06-12 at 18:27 -0700, Alexei Starovoitov wrote:
  On Fri, Jun 12, 2015 at 09:01:06AM -0700, Tom Herbert wrote:
   If dst, hop-by-hop or routing extension headers are present determine
   length of the options and skip over them in flow dissection.
   
   Signed-off-by: Tom Herbert t...@herbertland.com
   ---
net/core/flow_dissector.c | 17 +
1 file changed, 17 insertions(+)
   
   diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
   index 1818cdc..22e4dff 100644
   --- a/net/core/flow_dissector.c
   +++ b/net/core/flow_dissector.c
   @@ -327,6 +327,7 @@ mpls:
 return false;
 }

   +ip_proto_again:
 switch (ip_proto) {
 case IPPROTO_GRE: {
 struct gre_hdr {
   @@ -383,6 +384,22 @@ mpls:
 }
 goto again;
 }
   + case NEXTHDR_HOP:
   + case NEXTHDR_ROUTING:
   + case NEXTHDR_DEST: {
   + u8 _opthdr[2], *opthdr;
   +
   + if (proto != htons(ETH_P_IPV6))
   + break;
   +
   + opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
   +   data, hlen, _opthdr);
   +
   + ip_proto = _opthdr[0];
   + nhoff += (_opthdr[1] + 1)  3;
   +
   + goto ip_proto_again;
   + }
  
  Dave,
  
  please revert it. My server locks up during boot with:
 
 Seems easy to fix instead ?
 
 diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
 index 
 22e4dffa0c8b3b9a20a7324eae1627313e14ce30..476e5dda59e19822dba98a931369ff2666c59c0d
  100644
 --- a/net/core/flow_dissector.c
 +++ b/net/core/flow_dissector.c
 @@ -394,9 +394,11 @@ ip_proto_again:
  
   opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
 data, hlen, _opthdr);
 + if (!opthdr)
 + return false;
  
 - ip_proto = _opthdr[0];
 - nhoff += (_opthdr[1] + 1)  3;
 + ip_proto = opthdr[0];
 + nhoff += (opthdr[1] + 1)  3;
  
   goto ip_proto_again;
   }
 

sure, that's better.
If you're going to submit it officialy, please add my Tested-by.
My server is happy now :)

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Eric Dumazet
On Fri, 2015-06-12 at 18:27 -0700, Alexei Starovoitov wrote:
 On Fri, Jun 12, 2015 at 09:01:06AM -0700, Tom Herbert wrote:
  If dst, hop-by-hop or routing extension headers are present determine
  length of the options and skip over them in flow dissection.
  
  Signed-off-by: Tom Herbert t...@herbertland.com
  ---
   net/core/flow_dissector.c | 17 +
   1 file changed, 17 insertions(+)
  
  diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
  index 1818cdc..22e4dff 100644
  --- a/net/core/flow_dissector.c
  +++ b/net/core/flow_dissector.c
  @@ -327,6 +327,7 @@ mpls:
  return false;
  }
   
  +ip_proto_again:
  switch (ip_proto) {
  case IPPROTO_GRE: {
  struct gre_hdr {
  @@ -383,6 +384,22 @@ mpls:
  }
  goto again;
  }
  +   case NEXTHDR_HOP:
  +   case NEXTHDR_ROUTING:
  +   case NEXTHDR_DEST: {
  +   u8 _opthdr[2], *opthdr;
  +
  +   if (proto != htons(ETH_P_IPV6))
  +   break;
  +
  +   opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
  + data, hlen, _opthdr);
  +
  +   ip_proto = _opthdr[0];
  +   nhoff += (_opthdr[1] + 1)  3;
  +
  +   goto ip_proto_again;
  +   }
 
 Dave,
 
 please revert it. My server locks up during boot with:

Seems easy to fix instead ?

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 
22e4dffa0c8b3b9a20a7324eae1627313e14ce30..476e5dda59e19822dba98a931369ff2666c59c0d
 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -394,9 +394,11 @@ ip_proto_again:
 
opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
  data, hlen, _opthdr);
+   if (!opthdr)
+   return false;
 
-   ip_proto = _opthdr[0];
-   nhoff += (_opthdr[1] + 1)  3;
+   ip_proto = opthdr[0];
+   nhoff += (opthdr[1] + 1)  3;
 
goto ip_proto_again;
}


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Alexei Starovoitov
On Fri, Jun 12, 2015 at 07:11:16PM -0700, Eric Dumazet wrote:
 On Fri, 2015-06-12 at 18:50 -0700, Alexei Starovoitov wrote:
 
  
  sure, that's better.
  If you're going to submit it officialy, please add my Tested-by.
  My server is happy now :)
 
 Sure , will do.
 
 I tried adding __must_check to __skb_header_pointer() but apparently had
 to use W=1 to get a warning :

that is great idea still. At least buildbot can pick it up.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Alexei Starovoitov
On Fri, Jun 12, 2015 at 09:01:06AM -0700, Tom Herbert wrote:
 If dst, hop-by-hop or routing extension headers are present determine
 length of the options and skip over them in flow dissection.
 
 Signed-off-by: Tom Herbert t...@herbertland.com
 ---
  net/core/flow_dissector.c | 17 +
  1 file changed, 17 insertions(+)
 
 diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
 index 1818cdc..22e4dff 100644
 --- a/net/core/flow_dissector.c
 +++ b/net/core/flow_dissector.c
 @@ -327,6 +327,7 @@ mpls:
   return false;
   }
  
 +ip_proto_again:
   switch (ip_proto) {
   case IPPROTO_GRE: {
   struct gre_hdr {
 @@ -383,6 +384,22 @@ mpls:
   }
   goto again;
   }
 + case NEXTHDR_HOP:
 + case NEXTHDR_ROUTING:
 + case NEXTHDR_DEST: {
 + u8 _opthdr[2], *opthdr;
 +
 + if (proto != htons(ETH_P_IPV6))
 + break;
 +
 + opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
 +   data, hlen, _opthdr);
 +
 + ip_proto = _opthdr[0];
 + nhoff += (_opthdr[1] + 1)  3;
 +
 + goto ip_proto_again;
 + }

Dave,

please revert it. My server locks up during boot with:

[   32.391955] NMI watchdog: BUG: soft lockup - CPU#2 stuck for 23s! 
[modprobe:1550]
[   32.392043] RIP: 0010:[815cd8e2]  [815cd8e2] 
skb_copy_bits+0x12/0x260
[   32.392060] Call Trace:
[   32.392061]  IRQ
[   32.392063]  [815d9f38] __skb_flow_dissect+0x358/0x820
[   32.392064]  [815da48e] __skb_get_hash+0x8e/0x2e0
[   32.392066]  [815def7b] __skb_tx_hash+0x5b/0xb0
[   32.392067]  [815df54a] __netdev_pick_tx+0x18a/0x1a0
[   32.392068]  [815df40a] ? __netdev_pick_tx+0x4a/0x1a0
[   32.392069]  [815e4db0] ? __dev_queue_xmit+0x50/0x620
[   32.392071]  [815e4d0b] netdev_pick_tx+0xcb/0x120
[   32.392072]  [815e4e08] __dev_queue_xmit+0xa8/0x620
[   32.392073]  [815e4db0] ? __dev_queue_xmit+0x50/0x620
[   32.392076]  [81698225] ? ip6_finish_output+0xa5/0x1e0
[   32.392077]  [815e53a3] dev_queue_xmit_sk+0x13/0x20
[   32.392078]  [81696144] ip6_finish_output2+0x464/0x5f0
[   32.392079]  [81698225] ? ip6_finish_output+0xa5/0x1e0
[   32.392081]  [816a5bf2] ? ip6_mtu+0xb2/0xd0
[   32.392082]  [816a5b80] ? ip6_mtu+0x40/0xd0
[   32.392083]  [81698225] ip6_finish_output+0xa5/0x1e0
[   32.392084]  [816983be] ip6_output+0x5e/0x1b0

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/2] flow_dissector: add support for dst, hop-by-hop and routing ext hdrs

2015-06-12 Thread Tom Herbert
If dst, hop-by-hop or routing extension headers are present determine
length of the options and skip over them in flow dissection.

Signed-off-by: Tom Herbert t...@herbertland.com
---
 net/core/flow_dissector.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 1818cdc..22e4dff 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -327,6 +327,7 @@ mpls:
return false;
}
 
+ip_proto_again:
switch (ip_proto) {
case IPPROTO_GRE: {
struct gre_hdr {
@@ -383,6 +384,22 @@ mpls:
}
goto again;
}
+   case NEXTHDR_HOP:
+   case NEXTHDR_ROUTING:
+   case NEXTHDR_DEST: {
+   u8 _opthdr[2], *opthdr;
+
+   if (proto != htons(ETH_P_IPV6))
+   break;
+
+   opthdr = __skb_header_pointer(skb, nhoff, sizeof(_opthdr),
+ data, hlen, _opthdr);
+
+   ip_proto = _opthdr[0];
+   nhoff += (_opthdr[1] + 1)  3;
+
+   goto ip_proto_again;
+   }
case IPPROTO_IPIP:
proto = htons(ETH_P_IP);
goto ip;
-- 
1.8.1

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html