I sent a V2, which further simplified the code.
On 5/22/18, 9:23 AM, "[email protected] on behalf of Darrell
Ball" <[email protected] on behalf of [email protected]> wrote:
Flagged by clang.
CC: Greg Rose <[email protected]>
Fixes: 068794b43f0e ("erspan: Add flow-based erspan options")
Signed-off-by: Darrell Ball <[email protected]>
---
lib/netdev-native-tnl.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index c97491e..bb1b04f 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -653,7 +653,8 @@ netdev_erspan_build_header(const struct netdev *netdev,
}
if (erspan_ver == 1) {
- ovs_be32 *index;
+ ovs_be32 erspan_idx;
+ void *erspan_hdr_idx;
greh->protocol = htons(ETH_TYPE_ERSPAN1);
greh->flags = htons(GRE_SEQ);
@@ -663,14 +664,16 @@ netdev_erspan_build_header(const struct netdev
*netdev,
put_16aligned_be32(ALIGNED_CAST(ovs_16aligned_be32 *, ersh + 1),
htonl(tnl_cfg->erspan_idx));
- index = (ovs_be32 *)(ersh + 1);
+ erspan_hdr_idx = ersh + 1;
if (tnl_cfg->erspan_idx_flow) {
- *index = htonl(params->flow->tunnel.erspan_idx);
+ erspan_idx = htonl(params->flow->tunnel.erspan_idx);
} else {
- *index = htonl(tnl_cfg->erspan_idx);
+ erspan_idx = htonl(tnl_cfg->erspan_idx);
}
+ memcpy(erspan_hdr_idx, &erspan_idx, sizeof erspan_idx);
+
hlen = ERSPAN_GREHDR_LEN + sizeof *ersh + ERSPAN_V1_MDSIZE;
} else if (erspan_ver == 2) {
struct erspan_md2 *md2 = ALIGNED_CAST(struct erspan_md2 *, ersh +
1);
--
1.9.1
_______________________________________________
dev mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=SV4uX8Gz0f0CW0iQv_vvoXVO0nXmZgNQWAHXibiKXxU&s=I7kTOulKLeWsG-sKKKW0hRmMhhh9Fcg42Lwlx7NWA6w&e=
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev