From 616368ed1ea8165beb2b1ba137b474ee794046d5 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 24 Aug 2016 01:39:08 -0400 Subject: [PATCH] zebra: Refactor rib_delete_ipv[4|6] These two functions are essentially the same. Refactor. Signed-off-by: Donald Sharp --- zebra/connected.c | 24 +++---- zebra/kernel_socket.c | 35 ++++----- zebra/redistribute.c | 13 ++-- zebra/rib.h | 12 ++-- zebra/rt_netlink.c | 26 ++++--- zebra/zebra_rib.c | 162 ++++-------------------------------------- zebra/zserv.c | 29 ++++---- 7 files changed, 81 insertions(+), 220 deletions(-) diff --git a/zebra/connected.c b/zebra/connected.c index 3077272221..e3cb12bcd0 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -303,7 +303,7 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, void connected_down_ipv4 (struct interface *ifp, struct connected *ifc) { - struct prefix_ipv4 p; + struct prefix p; if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) return; @@ -311,19 +311,19 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc) PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc)); /* Apply mask to the network. */ - apply_mask_ipv4 (&p); + apply_mask (&p); /* In case of connected address is 0.0.0.0/0 we treat it tunnel address. */ - if (prefix_ipv4_any (&p)) + if (prefix_ipv4_any ((struct prefix_ipv4 *)&p)) return; /* Same logic as for connected_up_ipv4(): push the changes into the head. */ - rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, ifp->ifindex, ifp->vrf_id, 0, - SAFI_UNICAST); + rib_delete (AFI_IP, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, + 0, 0, &p, NULL, ifp->ifindex, 0); - rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, ifp->ifindex, ifp->vrf_id, 0, - SAFI_MULTICAST); + rib_delete (AFI_IP, SAFI_MULTICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, + 0, 0, &p, NULL, ifp->ifindex, 0); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IF %s IPv4 address down, scheduling RIB processing", @@ -456,20 +456,20 @@ connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr, void connected_down_ipv6 (struct interface *ifp, struct connected *ifc) { - struct prefix_ipv6 p; + struct prefix p; if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) return; PREFIX_COPY_IPV6(&p, CONNECTED_PREFIX(ifc)); - apply_mask_ipv6 (&p); + apply_mask (&p); - if (IN6_IS_ADDR_UNSPECIFIED (&p.prefix)) + if (IN6_IS_ADDR_UNSPECIFIED (&p.u.prefix6)) return; - rib_delete_ipv6 (ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, ifp->ifindex, - ifp->vrf_id, 0, SAFI_UNICAST); + rib_delete (AFI_IP6, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, + 0, 0, &p, NULL, ifp->ifindex, 0); if (IS_ZEBRA_DEBUG_RIB_DETAILED) zlog_debug ("%u: IF %s IPv6 address down, scheduling RIB processing", diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index c5763dd46f..ccc54ce81f 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -884,10 +884,10 @@ rtm_read (struct rt_msghdr *rtm) if (dest.sa.sa_family == AF_INET) { - struct prefix_ipv4 p; + struct prefix p; p.family = AF_INET; - p.prefix = dest.sin.sin_addr; + p.u.prefix4 = dest.sin.sin_addr; if (flags & RTF_HOST) p.prefixlen = IPV4_MAX_PREFIXLEN; else @@ -967,20 +967,20 @@ rtm_read (struct rt_msghdr *rtm) * to specify the route really */ if (rtm->rtm_type == RTM_CHANGE) - rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, - NULL, 0, VRF_DEFAULT, 0, SAFI_UNICAST); + rib_delete (AFI_IP, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, + 0, zebra_flags, &p, NULL, 0, 0); + union g_addr ggate = { .ipv4 = gate.sin.sin_addr }; if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD || rtm->rtm_type == RTM_CHANGE) rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, - &p, &gate.sin.sin_addr, NULL, 0, VRF_DEFAULT, + (struct prefix_ipv4 *)&p, &gate.sin.sin_addr, NULL, 0, VRF_DEFAULT, 0, 0, 0, 0, SAFI_UNICAST); else - rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, - &p, &gate.sin.sin_addr, 0, VRF_DEFAULT, 0, SAFI_UNICAST); + rib_delete (AFI_IP, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, + 0, zebra_flags, &p, &&ggate, 0, 0); } -#ifdef HAVE_IPV6 if (dest.sa.sa_family == AF_INET6) { /* One day we might have a debug section here like one in the @@ -988,11 +988,11 @@ rtm_read (struct rt_msghdr *rtm) */ if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == pid) return; - struct prefix_ipv6 p; + struct prefix p; ifindex_t ifindex = 0; p.family = AF_INET6; - p.prefix = dest.sin6.sin6_addr; + p.u.prefix6 = dest.sin6.sin6_addr; if (flags & RTF_HOST) p.prefixlen = IPV6_MAX_PREFIXLEN; else @@ -1010,20 +1010,21 @@ rtm_read (struct rt_msghdr *rtm) * to specify the route really */ if (rtm->rtm_type == RTM_CHANGE) - rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, - NULL, 0, VRF_DEFAULT, 0, SAFI_UNICAST); - + rib_delete (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, + 0, zebra_flags, &p, NULL, 0, 0); + + union g_addr ggate = { .ipv6 = gate.sin6.sin6_addr }; if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD || rtm->rtm_type == RTM_CHANGE) rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, - &p, &gate.sin6.sin6_addr, ifindex, VRF_DEFAULT, + (struct prefix_ipv6 *)&p, &gate.sin6.sin6_addr, + ifindex, VRF_DEFAULT, 0, 0, 0, 0, SAFI_UNICAST); else - rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, - &p, &gate.sin6.sin6_addr, ifindex, VRF_DEFAULT, 0, SAFI_UNICAST); + rib_delete (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT, ZEBRA_ROUTE_KERNEL, + 0, zebra_flags, &p, &ggate, ifindex, 0); } -#endif /* HAVE_IPV6 */ } /* Interface function for the kernel routing table updates. Support diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 892bc2af2b..2eb4f257f5 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -614,16 +614,17 @@ zebra_add_import_table_entry (struct route_node *rn, struct rib *rib, const char int zebra_del_import_table_entry (struct route_node *rn, struct rib *rib) { - struct prefix_ipv4 p4; + struct prefix p; if (rn->p.family == AF_INET) { - p4.family = AF_INET; - p4.prefixlen = rn->p.prefixlen; - p4.prefix = rn->p.u.prefix4; + p.family = AF_INET; + p.prefixlen = rn->p.prefixlen; + p.u.prefix4 = rn->p.u.prefix4; - rib_delete_ipv4(ZEBRA_ROUTE_TABLE, rib->table, rib->flags, &p4, NULL, - 0, rib->vrf_id, zebrad.rtm_table_default, SAFI_UNICAST); + rib_delete (AFI_IP, SAFI_UNICAST, rib->vrf_id, ZEBRA_ROUTE_TABLE, + rib->table, rib->flags, &p, NULL, + 0, zebrad.rtm_table_default); } /* DD: Add IPv6 code */ diff --git a/zebra/rib.h b/zebra/rib.h index 7fd29dcd5a..8b70de7a03 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -345,9 +345,10 @@ extern int rib_add_ipv4 (int type, u_short instance, int flags, struct prefix_ip extern int rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *, safi_t); -extern int rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, - struct in_addr *gate, ifindex_t ifindex, - vrf_id_t, u_int32_t, safi_t safi); +extern int rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, + u_short instance, int flags, struct prefix *p, + union g_addr *gate, ifindex_t ifindex, + u_int32_t table_id); extern struct rib *rib_match (afi_t afi, safi_t safi, vrf_id_t, union g_addr *, struct route_node **rn_out); @@ -371,11 +372,6 @@ rib_add_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p, u_int32_t table_id, u_int32_t metric, u_int32_t mtu, u_char distance, safi_t safi); -extern int -rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p, - struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id, - u_int32_t table_id, safi_t safi); - extern struct rib *rib_lookup_ipv6 (struct in6_addr *, vrf_id_t); extern struct route_table *rib_table_ipv6; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 49dcd1e6de..dc3aa2f6bb 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1059,7 +1059,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, struct rtmsg *rtm; struct rtattr *tb[RTA_MAX + 1]; u_char zebra_flags = 0; - + struct prefix p; + char anyaddr[16] = { 0 }; int index; @@ -1177,9 +1178,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rtm->rtm_family == AF_INET) { - struct prefix_ipv4 p; p.family = AF_INET; - memcpy (&p.prefix, dest, 4); + memcpy (&p.u.prefix4, dest, 4); p.prefixlen = rtm->rtm_dst_len; if (IS_ZEBRA_DEBUG_KERNEL) @@ -1193,7 +1193,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (h->nlmsg_type == RTM_NEWROUTE) { if (!tb[RTA_MULTIPATH]) - rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, 0, &p, gate, src, index, vrf_id, + rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, 0, (struct prefix_ipv4 *)&p, gate, src, index, vrf_id, table, metric, mtu, 0, SAFI_UNICAST); else { @@ -1252,21 +1252,20 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, if (rib->nexthop_num == 0) XFREE (MTYPE_RIB, rib); else - rib_add_ipv4_multipath (&p, rib, SAFI_UNICAST); + rib_add_ipv4_multipath ((struct prefix_ipv4 *)&p, rib, SAFI_UNICAST); } } else - rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, gate, index, - vrf_id, table, SAFI_UNICAST); + rib_delete (AFI_IP, SAFI_UNICAST, vrf_id, ZEBRA_ROUTE_KERNEL, 0, zebra_flags, + &p, gate, index, table); } -#ifdef HAVE_IPV6 if (rtm->rtm_family == AF_INET6) { - struct prefix_ipv6 p; + struct prefix p; p.family = AF_INET6; - memcpy (&p.prefix, dest, 16); + memcpy (&p.u.prefix6, dest, 16); p.prefixlen = rtm->rtm_dst_len; if (IS_ZEBRA_DEBUG_KERNEL) @@ -1278,13 +1277,12 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h, } if (h->nlmsg_type == RTM_NEWROUTE) - rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, 0, &p, gate, index, vrf_id, + rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, 0, (struct prefix_ipv6 *)&p, gate, index, vrf_id, table, metric, mtu, 0, SAFI_UNICAST); else - rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, gate, index, - vrf_id, table, SAFI_UNICAST); + rib_delete (AFI_IP6, SAFI_UNICAST, vrf_id, ZEBRA_ROUTE_KERNEL, + 0, zebra_flags, &p, gate, index, table); } -#endif /* HAVE_IPV6 */ return 0; } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 3a160825d5..0dbbd47a45 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2713,11 +2713,10 @@ rib_add_ipv4_multipath (struct prefix_ipv4 *p, struct rib *rib, safi_t safi) return ret; } -/* XXX factor with rib_delete_ipv6 */ int -rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, - struct in_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id, - u_int32_t table_id, safi_t safi) +rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance, + int flags, struct prefix *p, union g_addr *gate, ifindex_t ifindex, + u_int32_t table_id) { struct route_table *table; struct route_node *rn; @@ -2730,15 +2729,15 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, char buf2[INET6_ADDRSTRLEN]; /* Lookup table. */ - table = zebra_vrf_table_with_table_id (AFI_IP, safi, vrf_id, table_id); + table = zebra_vrf_table_with_table_id (afi, safi, vrf_id, table_id); if (! table) return 0; /* Apply mask. */ - apply_mask_ipv4 (p); + apply_mask (p); /* Lookup route node. */ - rn = route_node_lookup (table, (struct prefix *) p); + rn = route_node_lookup (table, p); if (! rn) { if (IS_ZEBRA_DEBUG_RIB) @@ -2784,7 +2783,8 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, break; } for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) - if (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate)) + if (IPV4_ADDR_SAME (&nexthop->gate.ipv4, gate) || + IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate)) { same = rib; break; @@ -2802,10 +2802,10 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, { if (IS_ZEBRA_DEBUG_RIB) { - zlog_debug ("%u:%s/%d: rn %p, rib %p (type %d) was deleted " + zlog_debug ("%u:%s: rn %p, rib %p (type %d) was deleted " "from kernel, adding", - vrf_id, inet_ntop (p->family, &p->prefix, buf1, INET6_ADDRSTRLEN), - p->prefixlen, rn, fib, fib->type); + vrf_id, prefix2str(p, buf1, INET6_ADDRSTRLEN), + rn, fib, fib->type); } if (allow_delete) { @@ -2830,7 +2830,7 @@ rib_delete_ipv4 (int type, u_short instance, int flags, struct prefix_ipv4 *p, zlog_debug ("%u:%s: via %s ifindex %d type %d " "doesn't exist in rib", vrf_id, prefix2str (p, buf1, sizeof(buf1)), - inet_ntop (AF_INET, gate, buf2, INET_ADDRSTRLEN), + inet_ntop (family2afi(afi), gate, buf2, INET_ADDRSTRLEN), ifindex, type); else @@ -3077,144 +3077,6 @@ rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi, return ret; } -/* XXX factor with rib_delete_ipv6 */ - -int -rib_delete_ipv6 (int type, u_short instance, int flags, struct prefix_ipv6 *p, - struct in6_addr *gate, ifindex_t ifindex, vrf_id_t vrf_id, - u_int32_t table_id, safi_t safi) -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct rib *fib = NULL; - struct rib *same = NULL; - struct nexthop *nexthop, *tnexthop; - int recursing; - char buf1[PREFIX_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; - - /* Apply mask. */ - apply_mask_ipv6 (p); - - /* Lookup table. */ - table = zebra_vrf_table_with_table_id (AFI_IP6, safi, vrf_id, table_id); - if (! table) - return 0; - - /* Lookup route node. */ - rn = route_node_lookup (table, (struct prefix *) p); - if (! rn) - { - if (IS_ZEBRA_DEBUG_RIB) - zlog_debug ("%u:%s: doesn't exist in rib", - vrf_id, prefix2str (p, buf1, sizeof(buf1))); - return ZEBRA_ERR_RTNOEXIST; - } - - /* Lookup same type route. */ - RNODE_FOREACH_RIB (rn, rib) - { - if (CHECK_FLAG(rib->status, RIB_ENTRY_REMOVED)) - continue; - - if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) - fib = rib; - - if (rib->type != type) - continue; - if (rib->instance != instance) - continue; - if (rib->type == ZEBRA_ROUTE_CONNECT && (nexthop = rib->nexthop) && - nexthop->type == NEXTHOP_TYPE_IFINDEX) - { - if (nexthop->ifindex != ifindex) - continue; - if (rib->refcnt) - { - rib->refcnt--; - route_unlock_node (rn); - route_unlock_node (rn); - return 0; - } - same = rib; - break; - } - /* Make sure that the route found has the same gateway. */ - else - { - if (gate == NULL) - { - same = rib; - break; - } - for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) - if (IPV6_ADDR_SAME (&nexthop->gate.ipv6, gate)) - { - same = rib; - break; - } - if (same) - break; - } - } - - /* If same type of route can't be found and this message is from - kernel. */ - if (! same) - { - if (fib && type == ZEBRA_ROUTE_KERNEL && - CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE)) - { - if (IS_ZEBRA_DEBUG_RIB) - zlog_debug ("%u:%s/%d: rn %p, rib %p (type %d) was deleted " - "from kernel, adding", - vrf_id, inet_ntop (p->family, &p->prefix, buf1, INET6_ADDRSTRLEN), - p->prefixlen, rn, fib, fib->type); - if (allow_delete) - { - /* Unset flags. */ - for (nexthop = fib->nexthop; nexthop; nexthop = nexthop->next) - UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); - - UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED); - } - else - { - /* This means someone else, other than Zebra, has deleted a Zebra - * route from the kernel. We will add it back */ - rib_install_kernel(rn, fib, 0); - } - } - else - { - if (IS_ZEBRA_DEBUG_KERNEL) - { - if (gate) - zlog_debug ("%s: vrf %u via %s ifindex %d type %d " - "doesn't exist in rib", - prefix2str (p, buf1, sizeof(buf1)), vrf_id, - inet_ntop (AF_INET6, gate, buf2, INET6_ADDRSTRLEN), - ifindex, - type); - else - zlog_debug ("%s: vrf %u ifindex %d type %d doesn't exist in rib", - prefix2str (p, buf1, sizeof(buf1)), vrf_id, - ifindex, - type); - } - route_unlock_node (rn); - return ZEBRA_ERR_RTNOEXIST; - } - } - - if (same) - rib_delnode (rn, same); - - route_unlock_node (rn); - return 0; -} - /* Schedule routes of a particular table (address-family) based on event. */ static void rib_update_table (struct route_table *table, rib_update_event_t event) diff --git a/zebra/zserv.c b/zebra/zserv.c index 73e84faca2..09992870a7 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1293,9 +1293,10 @@ zread_ipv4_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) int i; struct stream *s; struct zapi_ipv4 api; - struct in_addr nexthop, *nexthop_p; + struct in_addr nexthop; + union g_addr *nexthop_p; unsigned long ifindex; - struct prefix_ipv4 p; + struct prefix p; u_char nexthop_num; u_char nexthop_type; u_int32_t table_id; @@ -1316,7 +1317,7 @@ zread_ipv4_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) memset (&p, 0, sizeof (struct prefix_ipv4)); p.family = AF_INET; p.prefixlen = stream_getc (s); - stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + stream_get (&p.u.prefix4, s, PSIZE (p.prefixlen)); /* Nexthop, ifindex, distance, metric. */ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) @@ -1334,11 +1335,11 @@ zread_ipv4_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) break; case ZEBRA_NEXTHOP_IPV4: nexthop.s_addr = stream_get_ipv4 (s); - nexthop_p = &nexthop; + nexthop_p = (union g_addr *)&nexthop; break; case ZEBRA_NEXTHOP_IPV4_IFINDEX: nexthop.s_addr = stream_get_ipv4 (s); - nexthop_p = &nexthop; + nexthop_p = (union g_addr *)&nexthop; ifindex = stream_getl (s); break; case ZEBRA_NEXTHOP_IPV6: @@ -1368,8 +1369,8 @@ zread_ipv4_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) table_id = zvrf->table_id; - rib_delete_ipv4 (api.type, api.instance, api.flags, &p, nexthop_p, ifindex, - zvrf->vrf_id, table_id, api.safi); + rib_delete (AFI_IP, api.safi, zvrf->vrf_id, api.type, api.instance, + api.flags, &p, nexthop_p, ifindex, table_id); client->v4_route_del_cnt++; return 0; } @@ -1677,8 +1678,9 @@ zread_ipv6_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) struct stream *s; struct zapi_ipv6 api; struct in6_addr nexthop; + union g_addr *pnexthop; unsigned long ifindex; - struct prefix_ipv6 p; + struct prefix p; s = client->ibuf; ifindex = 0; @@ -1695,7 +1697,7 @@ zread_ipv6_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) memset (&p, 0, sizeof (struct prefix_ipv6)); p.family = AF_INET6; p.prefixlen = stream_getc (s); - stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + stream_get (&p.u.prefix6, s, PSIZE (p.prefixlen)); /* Nexthop, ifindex, distance, metric. */ if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP)) @@ -1711,6 +1713,7 @@ zread_ipv6_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) { case ZEBRA_NEXTHOP_IPV6: stream_get (&nexthop, s, 16); + pnexthop = (union g_addr *)&nexthop; break; case ZEBRA_NEXTHOP_IFINDEX: ifindex = stream_getl (s); @@ -1738,11 +1741,11 @@ zread_ipv6_delete (struct zserv *client, u_short length, struct zebra_vrf *zvrf) api.tag = 0; if (IN6_IS_ADDR_UNSPECIFIED (&nexthop)) - rib_delete_ipv6 (api.type, api.instance, api.flags, &p, NULL, ifindex, - zvrf->vrf_id, client->rtm_table, api.safi); + rib_delete (AFI_IP6, api.safi, zvrf->vrf_id, api.type, api.instance, + api.flags, &p, NULL, ifindex, client->rtm_table); else - rib_delete_ipv6 (api.type, api.instance, api.flags, &p, &nexthop, ifindex, - zvrf->vrf_id, client->rtm_table, api.safi); + rib_delete (AFI_IP6, api.safi, zvrf->vrf_id, api.type, api.instance, + api.flags, &p, pnexthop, ifindex, client->rtm_table); client->v6_route_del_cnt++; return 0; -- 2.39.5