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;
}
}
ds_put_format(&ds, " udp_csum:%"PRIx16, ntohs(uh->udp_csum));
} else if (flow.nw_proto == IPPROTO_SCTP && l4_size >= SCTP_HEADER_LEN) {
struct sctp_header *sh = ofpbuf_l4(&buf);
- ds_put_format(&ds, " sctp_csum:%"PRIx32, ntohl(sh->sctp_csum));
+ ds_put_format(&ds, " sctp_csum:%"PRIx32,
+ ntohl(get_16aligned_be32(&sh->sctp_csum)));
}
ds_put_char(&ds, '\n');
/*
- * 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.
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);
}
}
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. */
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 *