route: fix an error with strict-aliasing
authorFelix Fietkau <nbd@openwrt.org>
Sun, 5 Oct 2014 11:01:12 +0000 (13:01 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 5 Oct 2014 11:01:17 +0000 (13:01 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
route.c

diff --git a/route.c b/route.c
index 03046abf7b0984e0aa51080b8d3d06372d9c4cda..5935b82c02e98e63a33165c0de902b2ccb1df1dc 100644 (file)
--- a/route.c
+++ b/route.c
@@ -94,10 +94,11 @@ rtnl_rule_request(struct relayd_interface *rif, int flags)
                strcpy(req.dev.ifname, ifname);
                req.dev.rta.rta_len = sizeof(req.dev.rta) + strlen(ifname) + 1;
        } else {
+               uint32_t val = 1;
                req.dev.rta.rta_type = FRA_PRIORITY;
                req.dev.rta.rta_len = sizeof(req.dev.rta) + sizeof(uint32_t);
                padding -= sizeof(uint32_t);
-               *((uint32_t *) &req.dev.ifname) = 1;
+               memcpy(&req.dev.ifname, &val, sizeof(val));
        }
        req.table.table = get_route_table(rif);
        req.nl.nlmsg_len = sizeof(req) - padding;