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>
(cherry picked from commit 0de0138a9146074f268245193e45c9376d998722)
This commit is contained in:
David Lamparter 2015-03-03 10:30:27 +01:00 committed by Donald Sharp
parent f03db93b27
commit 81382410ed

View File

@ -251,14 +251,13 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
#define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST)) #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) \ #define ospf6_linkstate_prefix_adv_router(x) \
((x)->u.prefix4.s_addr) ((x)->u.lp.id.s_addr)
#define ospf6_linkstate_prefix_id(x) \ #define ospf6_linkstate_prefix_id(x) \
((x)->u.prefix6.s6_addr32[1]) ((x)->u.lp.adv_router.s_addr)
#define ADV_ROUTER_IN_PREFIX(x) \ #define ADV_ROUTER_IN_PREFIX(x) \
((x)->u.prefix4.s_addr) ((x)->u.lp.id.s_addr)
/* Function prototype */ /* Function prototype */
extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id, extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id,