X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fpackets.c;h=6244c3f5fac85049a7788a32fb83639802ebb8ae;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=89ee324f7fef059ca6c9125861f6dc24db64f45e;hpb=cf3b7538666cd1efa314ce4944e4efdf3dd81d99;p=sliver-openvswitch.git diff --git a/lib/packets.c b/lib/packets.c index 89ee324f7..6244c3f5f 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -288,7 +288,7 @@ set_mpls_lse(struct ofpbuf *packet, ovs_be32 mpls_lse) struct mpls_hdr *mh = ofpbuf_l2_5(packet); /* Update mpls label stack entry. */ - mh->mpls_lse = mpls_lse; + put_16aligned_be32(&mh->mpls_lse, mpls_lse); } } @@ -331,7 +331,7 @@ pop_mpls(struct ofpbuf *packet, ovs_be16 ethtype) size_t len = packet->l2_5_ofs; set_ethertype(packet, ethtype); - if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) { + if (get_16aligned_be32(&mh->mpls_lse) & htonl(MPLS_BOS_MASK)) { ofpbuf_set_l2_5(packet, NULL); } /* Shift the l2 header forward. */ @@ -858,15 +858,15 @@ packet_set_sctp_port(struct ofpbuf *packet, ovs_be16 src, ovs_be16 dst) ovs_be32 old_csum, old_correct_csum, new_csum; uint16_t tp_len = ofpbuf_l4_size(packet); - old_csum = sh->sctp_csum; - sh->sctp_csum = 0; + old_csum = get_16aligned_be32(&sh->sctp_csum); + put_16aligned_be32(&sh->sctp_csum, 0); old_correct_csum = crc32c((void *)sh, tp_len); sh->sctp_src = src; sh->sctp_dst = dst; new_csum = crc32c((void *)sh, tp_len); - sh->sctp_csum = old_csum ^ old_correct_csum ^ new_csum; + put_16aligned_be32(&sh->sctp_csum, old_csum ^ old_correct_csum ^ new_csum); } const char *