diff options
Diffstat (limited to 'freebsd/sbin/ifconfig/af_link.c')
-rw-r--r-- | freebsd/sbin/ifconfig/af_link.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/freebsd/sbin/ifconfig/af_link.c b/freebsd/sbin/ifconfig/af_link.c index ffd92e30..1c37496e 100644 --- a/freebsd/sbin/ifconfig/af_link.c +++ b/freebsd/sbin/ifconfig/af_link.c @@ -1,5 +1,9 @@ #include <machine/rtems-bsd-user-space.h> +#ifdef __rtems__ +#include "rtems-bsd-ifconfig-namespace.h" +#endif /* __rtems__ */ + /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -34,6 +38,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#ifdef __rtems__ +#include <machine/rtems-bsd-program.h> +#endif /* __rtems__ */ #include <sys/types.h> #include <sys/ioctl.h> #include <sys/socket.h> @@ -50,23 +57,35 @@ static const char rcsid[] = #include <net/ethernet.h> #include "ifconfig.h" +#ifdef __rtems__ +#include "rtems-bsd-ifconfig-af_link-data.h" +#endif /* __rtems__ */ static struct ifreq link_ridreq; +extern char *f_ether; + static void link_status(int s __unused, const struct ifaddrs *ifa) { /* XXX no const 'cuz LLADDR is defined wrong */ struct sockaddr_dl *sdl = (struct sockaddr_dl *) ifa->ifa_addr; + char *ether_format, *format_char; if (sdl != NULL && sdl->sdl_alen > 0) { if ((sdl->sdl_type == IFT_ETHER || sdl->sdl_type == IFT_L2VLAN || sdl->sdl_type == IFT_BRIDGE) && - sdl->sdl_alen == ETHER_ADDR_LEN) - printf("\tether %s\n", - ether_ntoa((struct ether_addr *)LLADDR(sdl))); - else { + sdl->sdl_alen == ETHER_ADDR_LEN) { + ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl)); + if (f_ether != NULL && strcmp(f_ether, "dash") == 0) { + for (format_char = strchr(ether_format, ':'); + format_char != NULL; + format_char = strchr(ether_format, ':')) + *format_char = '-'; + } + printf("\tether %s\n", ether_format); + } else { int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; printf("\tlladdr %s\n", link_ntoa(sdl) + n); @@ -129,9 +148,6 @@ void #endif /* __rtems__ */ link_ctor(void) { -#ifdef __rtems__ - memset(&link_ridreq, 0, sizeof(link_ridreq)); -#endif /* __rtems__ */ af_register(&af_link); af_register(&af_ether); af_register(&af_lladdr); |