From 99f4a6f223e937cad4e66c12d8355e5e10da1ca3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 7 May 2010 11:43:18 -0700 Subject: [PATCH] flow: Fix misaligned access. The testsuite for the flow extractor triggered this. With this commit, "make check" passes on SPARC. --- lib/flow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index ba48c4216..9437d3f1e 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -27,6 +27,8 @@ #include "openflow/openflow.h" #include "openvswitch/xflow.h" #include "packets.h" +#include "unaligned.h" +#include "xtoxll.h" #include "vlog.h" #define THIS_MODULE VLM_flow @@ -149,8 +151,8 @@ flow_extract(struct ofpbuf *packet, uint16_t in_port, flow_t *flow) if (flow->dl_type == htons(ETH_TYPE_IP)) { const struct ip_header *nh = pull_ip(&b); if (nh) { - flow->nw_src = nh->ip_src; - flow->nw_dst = nh->ip_dst; + flow->nw_src = get_unaligned_u32(&nh->ip_src); + flow->nw_dst = get_unaligned_u32(&nh->ip_dst); flow->nw_tos = nh->ip_tos & IP_DSCP_MASK; flow->nw_proto = nh->ip_proto; packet->l4 = b.data; -- 2.47.0