lib, zebra: unify link layer type and hardware address handling
This removes the BSD specific usage of struct sockaddr_dl
hardware address. This unifies to use explict hw_addr member for
the address, and zebra specific enumeration for the link layer
type.
Additionally the zapi is updated to never send platform specific
structures over the wire, but the ll_type along with hw_addr_len
and hw_addr are now sent for all platforms.
Based on initial work by Paul Jakma.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/zebra/interface.c b/zebra/interface.c
index 411712d..8a9225a 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -705,9 +705,6 @@
static void
if_dump_vty (struct vty *vty, struct interface *ifp)
{
-#ifdef HAVE_STRUCT_SOCKADDR_DL
- struct sockaddr_dl *sdl;
-#endif /* HAVE_STRUCT_SOCKADDR_DL */
struct connected *connected;
struct listnode *node;
struct route_node *rn;
@@ -759,19 +756,7 @@
if_flag_dump (ifp->flags), VTY_NEWLINE);
/* Hardware address. */
-#ifdef HAVE_STRUCT_SOCKADDR_DL
- sdl = &ifp->sdl;
- if (sdl != NULL && sdl->sdl_alen != 0)
- {
- int i;
- u_char *ptr;
-
- vty_out (vty, " HWaddr: ");
- for (i = 0, ptr = (u_char *)LLADDR (sdl); i < sdl->sdl_alen; i++, ptr++)
- vty_out (vty, "%s%02x", i == 0 ? "" : ":", *ptr);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
-#else
+ vty_out (vty, " Type: %s%s", if_link_type_str (ifp->ll_type), VTY_NEWLINE);
if (ifp->hw_addr_len != 0)
{
int i;
@@ -781,7 +766,6 @@
vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]);
vty_out (vty, "%s", VTY_NEWLINE);
}
-#endif /* HAVE_STRUCT_SOCKADDR_DL */
/* Bandwidth in kbps */
if (ifp->bandwidth != 0)