From f0f77c9a590bf538033602a0b2da6084c9ea22e2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 1 Jun 2017 07:26:25 -0400 Subject: zebra: Refactor 'struct rib' to be 'struct route_entry' The 'struct rib' data structure is missnamed. It really is a 'struct route_entry' as part of the 'struct route_node'. We have 1 'struct route_entry' per route src. As such 1 route node can have multiple route entries if multiple protocols attempt to install the same route. Signed-off-by: Donald Sharp --- zebra/rt_socket.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'zebra/rt_socket.c') diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 3e4833016a..ee706a1e8c 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -71,7 +71,7 @@ sin_masklen (struct in_addr mask) /* Interface between zebra message and rtm message. */ static int -kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib) +kernel_rtm_ipv4 (int cmd, struct prefix *p, struct route_entry *re) { struct sockaddr_in *mask = NULL; @@ -106,7 +106,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib) #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ /* Make gateway. */ - for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) + for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; @@ -172,16 +172,16 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib) gate ? (union sockunion *)&sin_gate : NULL, smplsp, ifindex, - rib->flags, - rib->metric); + re->flags, + re->metric); if (IS_ZEBRA_DEBUG_RIB) { if (!gate) { - zlog_debug ("%s: %s: attention! gate not found for rib %p", - __func__, prefix_buf, rib); - rib_dump (p, NULL, rib); + zlog_debug ("%s: %s: attention! gate not found for re %p", + __func__, prefix_buf, re); + route_entry_dump (p, NULL, re); } else inet_ntop (AF_INET, &sin_gate.sin_addr, gate_buf, INET_ADDRSTRLEN); @@ -230,7 +230,7 @@ kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib) /* If there was no useful nexthop, then complain. */ if (nexthop_num == 0 && IS_ZEBRA_DEBUG_KERNEL) - zlog_debug ("%s: No useful nexthops were found in RIB entry %p", __func__, rib); + zlog_debug ("%s: No useful nexthops were found in RIB entry %p", __func__, re); return 0; /*XXX*/ } @@ -262,7 +262,7 @@ sin6_masklen (struct in6_addr mask) /* Interface between zebra message and rtm message. */ static int -kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib) +kernel_rtm_ipv6 (int cmd, struct prefix *p, struct route_entry *re) { struct sockaddr_in6 *mask; struct sockaddr_in6 sin_dest, sin_mask, sin_gate; @@ -289,7 +289,7 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib) #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ /* Make gateway. */ - for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) + for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing)) { if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE)) continue; @@ -349,8 +349,8 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib) gate ? (union sockunion *)&sin_gate : NULL, NULL, ifindex, - rib->flags, - rib->metric); + re->flags, + re->metric); #if 0 if (error) @@ -377,21 +377,21 @@ kernel_rtm_ipv6 (int cmd, struct prefix *p, struct rib *rib) } static int -kernel_rtm (int cmd, struct prefix *p, struct rib *rib) +kernel_rtm (int cmd, struct prefix *p, struct route_entry *re) { switch (PREFIX_FAMILY(p)) { case AF_INET: - return kernel_rtm_ipv4 (cmd, p, rib); + return kernel_rtm_ipv4 (cmd, p, re); case AF_INET6: - return kernel_rtm_ipv6 (cmd, p, rib); + return kernel_rtm_ipv6 (cmd, p, re); } return 0; } int kernel_route_rib (struct prefix *p, struct prefix *src_p, - struct rib *old, struct rib *new) + struct route_entry *old, struct route_entry *new) { int route = 0; -- cgit v1.2.3