/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 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.
bool top = true;
while ((mh = ofpbuf_try_pull(b, sizeof *mh))) {
+ ovs_be32 mpls_lse = get_16aligned_be32(&mh->mpls_lse);
if (top) {
top = false;
- flow->mpls_lse = mh->mpls_lse;
+ flow->mpls_lse = mpls_lse;
}
- if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) {
+ if (mpls_lse & htonl(MPLS_BOS_MASK)) {
break;
}
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 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.
} else if (flow.nw_proto == IPPROTO_SCTP) {
struct sctp_header *sh = buf.l4;
ds_put_format(&ds, " sctp_csum:%"PRIx32,
- ntohl(sh->sctp_csum));
+ ntohl(get_16aligned_be32(&sh->sctp_csum)));
}
}
/*
- * 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.
/* Packet type should be MPLS to set label stack entry. */
if (is_mpls(packet)) {
/* Update mpls label stack entry. */
- mh->mpls_lse = mpls_lse;
+ put_16aligned_be32(&mh->mpls_lse, mpls_lse);
}
}
}
/* Push new MPLS shim header onto packet. */
- mh.mpls_lse = lse;
+ put_16aligned_be32(&mh.mpls_lse, lse);
push_mpls_lse(packet, &mh);
}
mh = packet->l2_5;
len = (char*)packet->l2_5 - (char*)packet->l2;
set_ethertype(packet, ethtype);
- if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) {
+ if (get_16aligned_be32(&mh->mpls_lse) & htonl(MPLS_BOS_MASK)) {
packet->l2_5 = NULL;
} else {
packet->l2_5 = (char*)packet->l2_5 + MPLS_HLEN;
ovs_be32 old_csum, old_correct_csum, new_csum;
uint16_t tp_len = packet->size - ((uint8_t*)sh - (uint8_t*)packet->data);
- 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(packet->l4, tp_len);
sh->sctp_src = src;
sh->sctp_dst = dst;
new_csum = crc32c(packet->l4, 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);
}
/* If 'packet' is a TCP packet, returns the TCP flags. Otherwise, returns 0.