vport: Record and free packets on unattached ports.
authorJesse Gross <jesse@nicira.com>
Mon, 10 May 2010 23:16:33 +0000 (16:16 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 11 May 2010 18:01:34 +0000 (11:01 -0700)
We throw away packets that are received on vports not attached to
a datapath but we are actually leaking them.  This records that an
error took place and frees the skb.

datapath/vport.c

index 5e164a914d67e5cb855c41c5adda34eeb1fddb4b..716a4588384ea859a911d8c9ff28991e6375210a 100644 (file)
@@ -1047,8 +1047,12 @@ vport_receive(struct vport *vport, struct sk_buff *skb)
 {
        struct dp_port *dp_port = vport_get_dp_port(vport);
 
-       if (!dp_port)
+       if (!dp_port) {
+               vport_record_error(vport, VPORT_E_RX_DROPPED);
+               kfree_skb(skb);
+
                return;
+       }
 
        if (vport->ops->flags & VPORT_F_GEN_STATS) {
                struct vport_percpu_stats *stats;