dpif-netdev: preserve packet metadata fields across recirculation
[sliver-openvswitch.git] / lib / flow.c
index 60b667c..6c6978d 100644 (file)
@@ -88,10 +88,11 @@ parse_mpls(struct ofpbuf *b, struct flow *flow)
     int idx = 0;
 
     while ((mh = ofpbuf_try_pull(b, sizeof *mh))) {
+        ovs_be32 mpls_lse = get_16aligned_be32(&mh->mpls_lse);
         if (idx < FLOW_MAX_MPLS_LABELS) {
-            flow->mpls_lse[idx++] = mh->mpls_lse;
+            flow->mpls_lse[idx++] = mpls_lse;
         }
-        if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) {
+        if (mpls_lse & htonl(MPLS_BOS_MASK)) {
             break;
         }
     }
@@ -369,12 +370,11 @@ flow_extract(struct ofpbuf *packet, const struct pkt_metadata *md,
         flow->in_port = md->in_port;
         flow->skb_priority = md->skb_priority;
         flow->pkt_mark = md->pkt_mark;
+        flow->recirc_id = md->recirc_id;
+        flow->dp_hash = md->dp_hash;
     }
 
-    packet->l2   = ofpbuf_data(&b);
-    ofpbuf_set_l2_5(packet, NULL);
-    ofpbuf_set_l3(packet, NULL);
-    ofpbuf_set_l4(packet, NULL);
+    ofpbuf_set_frame(packet, ofpbuf_data(packet));
 
     if (ofpbuf_size(&b) < sizeof *eth) {
         return;
@@ -1330,7 +1330,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow)
     /* eth_compose() sets l3 pointer and makes sure it is 32-bit aligned. */
     eth_compose(b, flow->dl_dst, flow->dl_src, ntohs(flow->dl_type), 0);
     if (flow->dl_type == htons(FLOW_DL_TYPE_NONE)) {
-        struct eth_header *eth = b->l2;
+        struct eth_header *eth = ofpbuf_l2(b);
         eth->eth_type = htons(ofpbuf_size(b));
         return;
     }