[ovs-dev] [PATCH] openvswitch: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash

wei zhang asuka.com at 163.com
Sun Mar 30 12:12:53 UTC 2014


At 2014-03-29 06:02:25,"Jesse Gross" <jesse at nicira.com> wrote:

>I'm not sure that rejecting all ICMP packets is the correct thing do
>here since it means that we could pass them onto a later caller even
>though they are intended for us. We should probably use the same logic
>as for receiving packets and just discard them here.

Thank you very much for your advice, did you mean this logic?  

diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
index a3d6951..c183a56 100644
--- a/net/openvswitch/vport-gre.c
+++ b/net/openvswitch/vport-gre.c
@@ -110,6 +110,21 @@ static int gre_rcv(struct sk_buff *skb,
        return PACKET_RCVD;
 }
 
+/* Called with rcu_read_lock and BH disabled. */
+static int gre_err(struct sk_buff *skb, u32 info,
+                  const struct tnl_ptk_info *tpi)
+{
+       struct ovs_net *ovs_net;
+       struct vport *vport;
+
+       ovs_net = net_generic(dev_net(skb->dev), ovs_net_id);
+       vport = rcu_dereference(ovs_net->vport_net.gre_vport);
+       if (unlikely(!vport))
+               return PACKET_REJECT;
+       else
+               return PACKET_RCVD;
+}

Maybe I misunderstand something? I think if we discard all packet pass to us
when we use gre vport, new gre_cisco_protocol which has lower priority could
not see the packet intended to it.

I checked the implementation of the ipgre_err(), which has be called before
the err_handler of gre vport. It use the the (local address, remote address, key)
to distinguish the packet which is realy intended to it, although it could not 
always get the key from the icmp packet. Should we do as the same as it?
I'm not sure this is feasible, any advice is appreciate.

Regards,
Wei Zhang


More information about the dev mailing list