diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2015-03-03 10:30:27 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-04-21 10:18:55 +0200 |
commit | 0de0138a9146074f268245193e45c9376d998722 (patch) | |
tree | fbf4305e4c7ebdb7ee05b69a71c443b0f5865e4f /ospf6d/ospf6_route.h | |
parent | 33b9663a89b5ec319986de0673764d2a18ec8725 (diff) | |
download | quagga-0de0138a9146074f268245193e45c9376d998722.tar.bz2 quagga-0de0138a9146074f268245193e45c9376d998722.tar.xz |
ospf6d: use existing union, avoid strict-aliasing
There are preexisting fields u.lp.id and u.lp.adv_router in struct
prefix that do the same thing as these type-punning pointer derefs.
Use these and shut up the strict-aliasing warnings.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_route.h')
-rw-r--r-- | ospf6d/ospf6_route.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index c0dcf9f1..42eb69ea 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -239,16 +239,15 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; sizeof (struct ospf6_nexthop) * OSPF6_MULTI_PATH_LIMIT) == 0) #define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST)) -/* XXX: This gives GCC heartburn aboutbreaking aliasing rules. */ #define ospf6_linkstate_prefix_adv_router(x) \ - (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0])) + ((x)->u.lp.id.s_addr) #define ospf6_linkstate_prefix_id(x) \ - (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4])) + ((x)->u.lp.adv_router.s_addr) #define ADV_ROUTER_IN_PREFIX(x) \ - (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0])) + ((x)->u.lp.id.s_addr) #define ID_IN_PREFIX(x) \ - (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4])) + ((x)->u.lp.adv_router.s_addr) /* Function prototype */ extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id, |