packet: Correctly set ethertype in pop_mpls()
authorSimon Horman <horms@verge.net.au>
Wed, 6 Feb 2013 13:53:52 +0000 (22:53 +0900)
committerBen Pfaff <blp@nicira.com>
Wed, 6 Feb 2013 17:18:24 +0000 (09:18 -0800)
The ethertype should be set before resetting l2_5 in order
for the packet to be updated correctly.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/packets.c

index 4f57d16..424f7ac 100644 (file)
@@ -375,8 +375,8 @@ pop_mpls(struct ofpbuf *packet, ovs_be16 ethtype)
         len = (char*)packet->l2_5 - (char*)packet->l2;
         /* If bottom of the stack set ethertype. */
         if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) {
-            packet->l2_5 = NULL;
             set_ethertype(packet, ethtype);
+            packet->l2_5 = NULL;
         } else {
             packet->l2_5 = (char*)packet->l2_5 + MPLS_HLEN;
         }