]> git.proxmox.com Git - ovs.git/commitdiff
datapath: Make OVS_ACTION_ATTR_USERSPACE action to send packet key
authorAndy Zhou <azhou@nicira.com>
Tue, 25 Jun 2013 16:21:16 +0000 (09:21 -0700)
committerJesse Gross <jesse@nicira.com>
Tue, 25 Jun 2013 18:18:27 +0000 (11:18 -0700)
OVS_ACTION_ATTR_USERSPACE action was sending the key from the matching
flow. This works for exact match flows because flow keys are the
same as packet keys. However, it does not work with wildcarded flows as
the packet keys may be different than the flow keys. This patch uses
the packet keys carried in OVS_CB(skb) when calling output_userspace().

Bug #18163

Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/actions.c
datapath/datapath.c
datapath/datapath.h

index 09d0c3f1bd6f73c5089c3337e4dc715027ba0114..0a2def67763cddff2af121d9fee88f3e325ba876 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2012 Nicira, Inc.
+ * Copyright (c) 2007-2013 Nicira, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU General Public
@@ -384,8 +384,10 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
        const struct nlattr *a;
        int rem;
 
+       BUG_ON(!OVS_CB(skb)->pkt_key);
+
        upcall.cmd = OVS_PACKET_CMD_ACTION;
-       upcall.key = &OVS_CB(skb)->flow->key;
+       upcall.key = OVS_CB(skb)->pkt_key;
        upcall.userdata = NULL;
        upcall.portid = 0;
 
index a514e7483610e3b6ffad6cea21c446de987c946c..3680391ce925971b92f2489b3e5e66fc789605d5 100644 (file)
@@ -260,6 +260,7 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
        }
 
        OVS_CB(skb)->flow = flow;
+       OVS_CB(skb)->pkt_key = &key;
 
        stats_counter = &stats->n_hit;
        ovs_flow_used(OVS_CB(skb)->flow, skb);
@@ -923,6 +924,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
                goto err_flow_free;
 
        OVS_CB(packet)->flow = flow;
+       OVS_CB(packet)->pkt_key = &flow->key;
        packet->priority = flow->key.phy.priority;
        skb_set_mark(packet, flow->key.phy.skb_mark);
 
index ad59a3a7b9dd8d6122d152f29174c8e89349ddb4..559df69543c6d9b17f4e1d87dc55f73aa233506c 100644 (file)
@@ -92,6 +92,7 @@ struct datapath {
 /**
  * struct ovs_skb_cb - OVS data in skb CB
  * @flow: The flow associated with this packet.  May be %NULL if no flow.
+ * @pkt_key: The flow information extracted from the packet.  Must be nonnull.
  * @tun_key: Key for the tunnel that encapsulated this packet. NULL if the
  * packet is not being tunneled.
  * @ip_summed: Consistently stores L4 checksumming status across different
@@ -104,6 +105,7 @@ struct datapath {
  */
 struct ovs_skb_cb {
        struct sw_flow          *flow;
+       struct sw_flow_key      *pkt_key;
        struct ovs_key_ipv4_tunnel  *tun_key;
 #ifdef NEED_CSUM_NORMALIZE
        enum csum_type          ip_summed;