From fa40f65874ca21bb9cca59ab5ddc8dbaf046f3c8 Mon Sep 17 00:00:00 2001 From: ajs Date: Thu, 16 Dec 2004 16:18:13 +0000 Subject: 2004-12-16 Andrew J. Schorr * ripng_nexthop.c: Replace NEXTHOP_OUT macro with NEXTHOP_OUT_PTR, since it's not really OK to take the address of a ternary expression. (_ripng_rte_cmp,ripng_rte_send) Use new NEXTHOP_OUT_PTR macro instead of NEXTHOP_OUT. --- ripngd/ripng_nexthop.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ripngd/ripng_nexthop.c') diff --git a/ripngd/ripng_nexthop.c b/ripngd/ripng_nexthop.c index e946dc91..1c1829d4 100644 --- a/ripngd/ripng_nexthop.c +++ b/ripngd/ripng_nexthop.c @@ -54,11 +54,11 @@ void _ripng_rte_del(struct ripng_rte_data *A); int _ripng_rte_cmp(struct ripng_rte_data *A, struct ripng_rte_data *B); #define METRIC_OUT(a) \ - (a->rinfo ? a->rinfo->metric_out : a->aggregate->metric_out) -#define NEXTHOP_OUT(a) \ - (a->rinfo ? a->rinfo->nexthop_out : a->aggregate->nexthop_out) + ((a)->rinfo ? (a)->rinfo->metric_out : (a)->aggregate->metric_out) +#define NEXTHOP_OUT_PTR(a) \ + ((a)->rinfo ? &((a)->rinfo->nexthop_out) : &((a)->aggregate->nexthop_out)) #define TAG_OUT(a) \ - (a->rinfo ? a->rinfo->tag_out : a->aggregate->tag_out) + ((a)->rinfo ? (a)->rinfo->tag_out : (a)->aggregate->tag_out) struct list * ripng_rte_new(void) { @@ -89,7 +89,7 @@ _ripng_rte_del(struct ripng_rte_data *A) { */ int _ripng_rte_cmp(struct ripng_rte_data *A, struct ripng_rte_data *B) { - return addr6_cmp(&NEXTHOP_OUT(A), &NEXTHOP_OUT(B)); + return addr6_cmp(NEXTHOP_OUT_PTR(A), NEXTHOP_OUT_PTR(B)); } /* Add routing table entry */ @@ -157,7 +157,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, LIST_LOOP(ripng_rte_list, data, nn) { /* (2.1) Next hop support */ - if (!IPV6_ADDR_SAME(&last_nexthop, &NEXTHOP_OUT(data))) { + if (!IPV6_ADDR_SAME(&last_nexthop, NEXTHOP_OUT_PTR(data))) { /* A nexthop entry should be at least followed by 1 RTE */ if (num == (rtemax-1)) { @@ -176,10 +176,10 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, /* If the received next hop address is not a link-local address, * it should be treated as 0:0:0:0:0:0:0:0. */ - if (!IN6_IS_ADDR_LINKLOCAL(&NEXTHOP_OUT(data))) + if (!IN6_IS_ADDR_LINKLOCAL(NEXTHOP_OUT_PTR(data))) last_nexthop = myself_nexthop; else - last_nexthop = NEXTHOP_OUT(data); + last_nexthop = *NEXTHOP_OUT_PTR(data); num = ripng_write_rte(num, s, NULL, &last_nexthop, 0, RIPNG_METRIC_NEXTHOP); } else { -- cgit v1.2.1