From f89fa4a231402099db1e26ddb2e8ab8746e1bc23 Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Mon, 10 Jun 2002 22:18:49 +0000 Subject: print ethernet address; ok provos@, itojun@ --- sbin/ifconfig/ifconfig.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sbin') diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 392fc178d57..618176ba54d 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.64 2002/05/22 08:21:02 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.65 2002/06/10 22:18:48 markus Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -81,7 +81,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #else -static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.64 2002/05/22 08:21:02 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.65 2002/06/10 22:18:48 markus Exp $"; #endif #endif /* not lint */ @@ -92,6 +92,7 @@ static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.64 2002/05/22 08:21:02 der #include #include #include +#include #include #include #include @@ -304,7 +305,7 @@ int getinfo(struct ifreq *); void getsock(int); void printif(struct ifreq *, int); void printb(char *, unsigned short, char *); -void status(int); +void status(int, struct sockaddr_dl *); void usage(); const char *get_string(const char *, const char *, u_int8_t *, int *); void print_string(const u_int8_t *, int); @@ -630,7 +631,7 @@ printif(ifrm, ifaliases) namep = ifa->ifa_name; if (getinfo(ifrp) < 0) continue; - status(1); + status(1, (struct sockaddr_dl *)ifa->ifa_addr); count++; noinet = 1; continue; @@ -708,7 +709,7 @@ printif(ifrm, ifaliases) ifreq = ifr = *ifrp; if (getinfo(&ifreq) < 0) continue; - status(1); + status(1, NULL); count++; noinet = 1; continue; @@ -1623,8 +1624,9 @@ const struct ifmedia_status_description ifm_status_descriptions[] = * specified, show it and it only; otherwise, show them all. */ void -status(link) +status(link, sdl) int link; + struct sockaddr_dl *sdl; { const struct afswtch *p = afp; struct ifmediareq ifmr; @@ -1637,6 +1639,9 @@ status(link) if (mtu) printf(" mtu %d", mtu); putchar('\n'); + if (sdl != NULL && sdl->sdl_type == IFT_ETHER && sdl->sdl_alen) + (void)printf("\taddress: %s\n", ether_ntoa( + (struct ether_addr *)LLADDR(sdl))); #ifndef INET_ONLY vlan_status(); -- cgit v1.2.3