diff options
author | William Tu <u9012063@gmail.com> | 2018-05-02 14:45:39 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-05-21 20:33:30 -0700 |
commit | c6bbe82019b5b2dea75093ef1f822d3836a0fed4 (patch) | |
tree | a97533c88d0b2da3ab7df9161aa403c38bca7f61 | |
parent | 98514eea21f405b2cdafc0f3370623a8cec5ad50 (diff) | |
download | openvswitch-c6bbe82019b5b2dea75093ef1f822d3836a0fed4.tar.gz |
openvswitch: fix vport packet length check.
Upstream commit:
commit 46e371f0e78a82186a83cbcb4f4b8850417c7dd5
Author: William Tu <u9012063@gmail.com>
Date: Wed Mar 7 15:38:48 2018 -0800
openvswitch: fix vport packet length check.
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>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
-rw-r--r-- | datapath/vport.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/datapath/vport.c b/datapath/vport.c index f4131be2c..184c8593e 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -520,10 +520,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)) @@ -534,7 +534,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) |