X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=ripngd%2Fripng_nexthop.c;h=0af636efcb2c4e46e3259e703aa45a692bf89db7;hb=da571b7a6c5326447399ff78439c87639fa51e19;hp=2c5d45cde0daf2b6e78459234643396939d6f6e6;hpb=a94434b69197e074569d7579126074e9cb7212a5;p=mirror_frr.git diff --git a/ripngd/ripng_nexthop.c b/ripngd/ripng_nexthop.c index 2c5d45cde..0af636efc 100644 --- a/ripngd/ripng_nexthop.c +++ b/ripngd/ripng_nexthop.c @@ -13,10 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* This file is required in order to support properly the RIPng nexthop @@ -54,11 +53,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 +88,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 */ @@ -117,7 +116,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, struct sockaddr_in6 *to) { struct ripng_rte_data *data; - struct listnode * nn; + struct listnode *node, *nnode; struct in6_addr last_nexthop; struct in6_addr myself_nexthop; @@ -144,7 +143,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, stream_reset (s); num = 0; - mtu = ifp->mtu; + mtu = ifp->mtu6; if (mtu < 0) mtu = IFMINMTU; @@ -154,14 +153,13 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, sizeof (struct ripng_packet) + sizeof (struct rte)) / sizeof (struct rte); - LIST_LOOP(ripng_rte_list, data, nn) { - + for (ALL_LIST_ELEMENTS (ripng_rte_list, node, nnode, data)) { /* (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)) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) @@ -176,10 +174,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 { @@ -191,7 +189,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, TAG_OUT(data), METRIC_OUT(data)); if (num == rtemax) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) @@ -204,13 +202,12 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, /* If unwritten RTE exist, flush it. */ if (num != 0) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) ripng_packet_dump ((struct ripng_packet *)STREAM_DATA (s), stream_get_endp (s), "SEND"); - num = 0; stream_reset (s); } }