]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fetch interface speed on *BSD
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 21 Jul 2017 18:09:58 +0000 (15:09 -0300)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 9 Aug 2017 10:06:06 +0000 (12:06 +0200)
Fixes #407 for FreeBSD and NetBSD.

OpenBSD uses ioctl to fetch interface information on startup and the
SIOCGIFMEDIA command is just too cumbersome to use.

The best way to fix the problem for OpenBSD is probably to stop treating
it differently from the other BSDs for no apparent reason.  There should
be nothing preventing us to make OpenBSD use the routing socket to fetch
interface information on startup (we already do it to detect runtime
changes). This is something that should be done in a separate commit
after a careful analysis.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/kernel_socket.c

index 5df57b253020f0f720d5cd4b74d6a6026885df77..5ca6a488c31b8171742943185cfdea0d3c23cf65 100644 (file)
@@ -627,6 +627,7 @@ int ifm_read(struct if_msghdr *ifm)
 #ifdef HAVE_NET_RT_IFLIST
        ifp->stats = ifm->ifm_data;
 #endif /* HAVE_NET_RT_IFLIST */
+       ifp->speed = ifm->ifm_data.ifi_baudrate / 1000000;
 
        if (IS_ZEBRA_DEBUG_KERNEL)
                zlog_debug("%s: interface %s index %d", __func__, ifp->name,