From: Jesse Gross Date: Fri, 1 Feb 2013 23:34:10 +0000 (-0800) Subject: tunneling: Don't send ICMP messages if no tunnel port is found. X-Git-Tag: v1.9.0~5 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=dc7b1abfdb88f099050cc4335f3dd3436a856b5d tunneling: Don't send ICMP messages if no tunnel port is found. Some tunnel code in OVS (for example, CAPWAP) uses the skb->cb to store information while processing packets. However, if we don't find an appropriate tunnel port on receive, then we send an ICMP port unreachable message, which calls back into the IP stack. The stack assumes that skb->cb will still contain valid information about from the IP layer, including any IP options. As a result, icmp_echo_options() can read the garbage values from OVS and overwrite data on the stack, panicing the machine. This simply stops sending ICMP messages when ports are not found. Many people find them confusing and flow based tunneling will never send them (since it always finds a port) so it solves both problems at once. Bug #14880 Reported-by: Deepesh Govindan Signed-off-by: Jesse Gross Acked-by: Kyle Mestery Conflicts: datapath/vport-vxlan.c --- diff --git a/datapath/vport-capwap.c b/datapath/vport-capwap.c index cea6bfd31..7a6f2739b 100644 --- a/datapath/vport-capwap.c +++ b/datapath/vport-capwap.c @@ -332,10 +332,8 @@ static int capwap_rcv(struct sock *sk, struct sk_buff *skb) iph = ip_hdr(skb); vport = ovs_tnl_find_port(sock_net(sk), iph->daddr, iph->saddr, key, TNL_T_PROTO_CAPWAP, &mutable); - if (unlikely(!vport)) { - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); + if (unlikely(!vport)) goto error; - } if (key_present && mutable->key.daddr && !(mutable->flags & TNL_F_IN_KEY_MATCH)) { diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 3c1349930..eb942e6d1 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -399,10 +399,8 @@ static int gre_rcv(struct sk_buff *skb) iph = ip_hdr(skb); vport = ovs_tnl_find_port(dev_net(skb->dev), iph->daddr, iph->saddr, key, tunnel_type, &mutable); - if (unlikely(!vport)) { - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); + if (unlikely(!vport)) goto error; - } tnl_flags = gre_flags_to_tunnel_flags(mutable, gre_flags, &key); tnl_tun_key_init(&tun_key, iph, key, tnl_flags);