openvswitch: Use tun_key only for egress tunnel path.
[firefly-linux-kernel-4.4.55.git] / net / openvswitch / vport.c
index acf31aa89e01401767fe1a111f4b89d1d9c29ad3..5df8377fcfb1d59a721fbecbed70f2313cafe8cf 100644 (file)
@@ -435,6 +435,8 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
                       struct ovs_key_ipv4_tunnel *tun_key)
 {
        struct pcpu_sw_netstats *stats;
+       struct sw_flow_key key;
+       int error;
 
        stats = this_cpu_ptr(vport->percpu_stats);
        u64_stats_update_begin(&stats->syncp);
@@ -442,9 +444,15 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
        stats->rx_bytes += skb->len;
        u64_stats_update_end(&stats->syncp);
 
-       OVS_CB(skb)->tun_key = tun_key;
        OVS_CB(skb)->input_vport = vport;
-       ovs_dp_process_received_packet(skb);
+       OVS_CB(skb)->egress_tun_key = NULL;
+       /* Extract flow from 'skb' into 'key'. */
+       error = ovs_flow_key_extract(tun_key, skb, &key);
+       if (unlikely(error)) {
+               kfree_skb(skb);
+               return;
+       }
+       ovs_dp_process_packet(skb, &key);
 }
 
 /**