ospf6d, bgpd: avoid calling if_nametoindex

As the comments in if.h, it is better to call ifname2ifindex()
instead of if_nametoindex().

And ifname2ifindex() can work for VRF by appending a parameter
while if_nametoindex() can not.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index f18d916..8ae7f46 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -572,7 +572,7 @@
       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 @@
       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 @@
 
       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;