Looks good to me, Acked-by: Jarno Rajahalme <[email protected]>
> On Apr 4, 2014, at 8:22 PM, Ben Pfaff <[email protected]> wrote: > > The other 32-bit data fields in protocol headers were already using > ovs_16aligned_be32, but MPLS and SCTP had been overlooked. This fixes > the failure of test 681 seen here: > https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624 > > Signed-off-by: Ben Pfaff <[email protected]> > --- > lib/flow.c | 5 +++-- > lib/ofp-print.c | 3 ++- > lib/packets.c | 12 ++++++------ > lib/packets.h | 6 +++--- > 4 files changed, 14 insertions(+), 12 deletions(-) > > diff --git a/lib/flow.c b/lib/flow.c > index e1ea75e..f97d7a9 100644 > --- a/lib/flow.c > +++ b/lib/flow.c > @@ -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; > } > } > diff --git a/lib/ofp-print.c b/lib/ofp-print.c > index e0e565c..02f3db0 100644 > --- a/lib/ofp-print.c > +++ b/lib/ofp-print.c > @@ -78,7 +78,8 @@ ofp_packet_to_string(const void *data, size_t len) > 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'); > diff --git a/lib/packets.c b/lib/packets.c > index 89ee324..6244c3f 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 * > diff --git a/lib/packets.h b/lib/packets.h > index 22817af..eca24d5 100644 > --- a/lib/packets.h > +++ b/lib/packets.h > @@ -363,7 +363,7 @@ BUILD_ASSERT_DECL(VLAN_ETH_HEADER_LEN == sizeof(struct > vlan_eth_header)); > #define MPLS_HLEN 4 > > struct mpls_hdr { > - ovs_be32 mpls_lse; > + ovs_16aligned_be32 mpls_lse; > }; > BUILD_ASSERT_DECL(MPLS_HLEN == sizeof(struct mpls_hdr)); > > @@ -510,8 +510,8 @@ BUILD_ASSERT_DECL(ICMP_HEADER_LEN == sizeof(struct > icmp_header)); > struct sctp_header { > ovs_be16 sctp_src; > ovs_be16 sctp_dst; > - ovs_be32 sctp_vtag; > - ovs_be32 sctp_csum; > + ovs_16aligned_be32 sctp_vtag; > + ovs_16aligned_be32 sctp_csum; > }; > BUILD_ASSERT_DECL(SCTP_HEADER_LEN == sizeof(struct sctp_header)); > > -- > 1.8.5.3 > > _______________________________________________ > dev mailing list > [email protected] > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
