diff options
-rw-r--r-- | bgpd/bgp_network.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_zebra.c | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_route.c | 15 | ||||
-rw-r--r-- | ospf6d/ospf6_zebra.c | 5 |
4 files changed, 13 insertions, 15 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 97650964..7059e8ae 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -402,7 +402,7 @@ bgp_connect (struct peer *peer) #ifdef HAVE_IPV6 if (peer->ifname) - ifindex = if_nametoindex (peer->ifname); + ifindex = ifname2ifindex (peer->ifname); #endif /* HAVE_IPV6 */ if (BGP_DEBUG (events, EVENTS)) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index f18d916f..8ae7f465 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -572,7 +572,7 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr)) { if (peer->ifname) - ifp = if_lookup_by_index (if_nametoindex (peer->ifname)); + ifp = if_lookup_by_name (peer->ifname); } else ifp = if_lookup_by_ipv6 (&local->sin6.sin6_addr); @@ -792,7 +792,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, sa if (IN6_IS_ADDR_LINKLOCAL (nexthop) && ! ifindex) { if (info->peer->ifname) - ifindex = if_nametoindex (info->peer->ifname); + ifindex = ifname2ifindex (info->peer->ifname); else if (info->peer->nexthop.ifp) ifindex = info->peer->nexthop.ifp->ifindex; } @@ -913,7 +913,7 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi) if (IN6_IS_ADDR_LINKLOCAL (nexthop) && ! ifindex) if (info->peer->ifname) - ifindex = if_nametoindex (info->peer->ifname); + ifindex = ifname2ifindex (info->peer->ifname); api.flags = flags; api.type = ZEBRA_ROUTE_BGP; diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 30927737..50575564 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -792,7 +792,8 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) { int i; char destination[64], nexthop[64]; - char duration[16], ifname[IFNAMSIZ]; + char duration[16]; + const char *ifname; struct timeval now, res; quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); @@ -812,8 +813,7 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) /* nexthop */ inet_ntop (AF_INET6, &route->nexthop[0].address, nexthop, sizeof (nexthop)); - if (! if_indextoname (route->nexthop[0].ifindex, ifname)) - snprintf (ifname, sizeof (ifname), "%d", route->nexthop[0].ifindex); + ifname = ifindex2ifname (route->nexthop[0].ifindex); vty_out (vty, "%c%1s %2s %-30s %-25s %6.*s %s%s", (ospf6_route_is_best (route) ? '*' : ' '), @@ -827,8 +827,7 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) /* nexthop */ inet_ntop (AF_INET6, &route->nexthop[i].address, nexthop, sizeof (nexthop)); - if (! if_indextoname (route->nexthop[i].ifindex, ifname)) - snprintf (ifname, sizeof (ifname), "%d", route->nexthop[i].ifindex); + ifname = ifindex2ifname (route->nexthop[i].ifindex); vty_out (vty, "%c%1s %2s %-30s %-25s %6.*s %s%s", ' ', "", "", "", nexthop, IFNAMSIZ, ifname, "", VNL); @@ -838,7 +837,8 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) { - char destination[64], nexthop[64], ifname[IFNAMSIZ]; + const char *ifname; + char destination[64], nexthop[64]; char area_id[16], id[16], adv_router[16], capa[16], options[16]; struct timeval now, res; char duration[16]; @@ -924,8 +924,7 @@ ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) /* nexthop */ inet_ntop (AF_INET6, &route->nexthop[i].address, nexthop, sizeof (nexthop)); - if (! if_indextoname (route->nexthop[i].ifindex, ifname)) - snprintf (ifname, sizeof (ifname), "%d", route->nexthop[i].ifindex); + ifname = ifindex2ifname (route->nexthop[i].ifindex); vty_out (vty, " %s %.*s%s", nexthop, IFNAMSIZ, ifname, VNL); } vty_out (vty, "%s", VNL); diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 85f70647..ac3235c4 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -443,11 +443,10 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request) { if (IS_OSPF6_DEBUG_ZEBRA (SEND)) { - char ifname[IFNAMSIZ]; + const char *ifname; inet_ntop (AF_INET6, &request->nexthop[i].address, buf, sizeof (buf)); - if (!if_indextoname(request->nexthop[i].ifindex, ifname)) - strlcpy(ifname, "unknown", sizeof(ifname)); + ifname = ifindex2ifname (request->nexthop[i].ifindex); zlog_debug (" nexthop: %s%%%.*s(%d)", buf, IFNAMSIZ, ifname, request->nexthop[i].ifindex); } |