* [PATCHv2 net-next] openvswitch: fix vport packet length check.
@ 2018-03-07 23:38 William Tu
2018-03-08 1:01 ` Pravin Shelar
2018-03-08 17:50 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: William Tu @ 2018-03-07 23:38 UTC (permalink / raw)
To: netdev; +Cc: pshelar, jbenc
When sending a packet to a tunnel device, the dev's hard_header_len
could be larger than the skb->len in function packet_length().
In the case of ip6gretap/erspan, hard_header_len = LL_MAX_HEADER + t_hlen,
which is around 180, and an ARP packet sent to this tunnel has
skb->len = 42. This causes the 'unsign int length' to become super
large because it is negative value, causing the later ovs_vport_send
to drop it due to over-mtu size. The patch fixes it by setting it to 0.
Signed-off-by: William Tu <u9012063@gmail.com>
---
v1->v2:
replace the return type from unsigned int to int
---
net/openvswitch/vport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index b6c8524032a0..f81c1d0ddff4 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -464,10 +464,10 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
return 0;
}
-static unsigned int packet_length(const struct sk_buff *skb,
- struct net_device *dev)
+static int packet_length(const struct sk_buff *skb,
+ struct net_device *dev)
{
- unsigned int length = skb->len - dev->hard_header_len;
+ int length = skb->len - dev->hard_header_len;
if (!skb_vlan_tag_present(skb) &&
eth_type_vlan(skb->protocol))
@@ -478,7 +478,7 @@ static unsigned int packet_length(const struct sk_buff *skb,
* account for 802.1ad. e.g. is_skb_forwardable().
*/
- return length;
+ return length > 0 ? length : 0;
}
void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv2 net-next] openvswitch: fix vport packet length check.
2018-03-07 23:38 [PATCHv2 net-next] openvswitch: fix vport packet length check William Tu
@ 2018-03-08 1:01 ` Pravin Shelar
2018-03-08 17:50 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Pravin Shelar @ 2018-03-08 1:01 UTC (permalink / raw)
To: William Tu; +Cc: Linux Kernel Network Developers, Jiri Benc
On Wed, Mar 7, 2018 at 3:38 PM, William Tu <u9012063@gmail.com> wrote:
> When sending a packet to a tunnel device, the dev's hard_header_len
> could be larger than the skb->len in function packet_length().
> In the case of ip6gretap/erspan, hard_header_len = LL_MAX_HEADER + t_hlen,
> which is around 180, and an ARP packet sent to this tunnel has
> skb->len = 42. This causes the 'unsign int length' to become super
> large because it is negative value, causing the later ovs_vport_send
> to drop it due to over-mtu size. The patch fixes it by setting it to 0.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
> v1->v2:
> replace the return type from unsigned int to int
> ---
Acked-by: Pravin B Shelar <pshelar@ovn.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2 net-next] openvswitch: fix vport packet length check.
2018-03-07 23:38 [PATCHv2 net-next] openvswitch: fix vport packet length check William Tu
2018-03-08 1:01 ` Pravin Shelar
@ 2018-03-08 17:50 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-08 17:50 UTC (permalink / raw)
To: u9012063; +Cc: netdev, pshelar, jbenc
From: William Tu <u9012063@gmail.com>
Date: Wed, 7 Mar 2018 15:38:48 -0800
> When sending a packet to a tunnel device, the dev's hard_header_len
> could be larger than the skb->len in function packet_length().
> In the case of ip6gretap/erspan, hard_header_len = LL_MAX_HEADER + t_hlen,
> which is around 180, and an ARP packet sent to this tunnel has
> skb->len = 42. This causes the 'unsign int length' to become super
> large because it is negative value, causing the later ovs_vport_send
> to drop it due to over-mtu size. The patch fixes it by setting it to 0.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
> v1->v2:
> replace the return type from unsigned int to int
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-08 17:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 23:38 [PATCHv2 net-next] openvswitch: fix vport packet length check William Tu
2018-03-08 1:01 ` Pravin Shelar
2018-03-08 17:50 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.