[ovs-dev] [sparc 3/5] in-band: Avoid "cast increases required alignment of target type" warning.

Ben Pfaff blp at nicira.com
Tue May 24 18:21:06 UTC 2011


Casting a struct ofp_action_output object's address to type union
ofp_action * provokes a warning on sparc.  It's easier to just declare
the object as having type union ofp_action, even though I don't think that
there is a real problem here.
---
 ofproto/in-band.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index e04ae60..ecf33fc 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -404,19 +404,18 @@ add_rule(struct in_band *ib, const struct cls_rule *rule)
 {
     struct {
         struct nx_action_set_queue nxsq;
-        struct ofp_action_output oao;
+        union ofp_action output;
     } actions;
 
     memset(&actions, 0, sizeof actions);
 
-    actions.oao.type = htons(OFPAT_OUTPUT);
-    actions.oao.len = htons(sizeof actions.oao);
-    actions.oao.port = htons(OFPP_NORMAL);
-    actions.oao.max_len = htons(0);
+    actions.output.output.type = htons(OFPAT_OUTPUT);
+    actions.output.output.len = htons(sizeof actions.output);
+    actions.output.output.port = htons(OFPP_NORMAL);
+    actions.output.output.max_len = htons(0);
 
     if (ib->queue_id < 0) {
-        ofproto_add_flow(ib->ofproto, rule,
-                         (union ofp_action *) &actions.oao, 1);
+        ofproto_add_flow(ib->ofproto, rule, &actions.output, 1);
     } else {
         actions.nxsq.type = htons(OFPAT_VENDOR);
         actions.nxsq.len = htons(sizeof actions.nxsq);
-- 
1.6.5




More information about the dev mailing list