diff options
author | phk <phk@FreeBSD.org> | 1999-06-19 18:42:31 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-06-19 18:42:31 +0000 |
commit | 1048fa73010ca9dfb0cfba83b166fcfa2ef994be (patch) | |
tree | 32836c1e0c0e6d5d181e3dd1260ec5097dfa0a32 /sbin | |
parent | d99f3d7a9346a2099e09e6afbacee7bffacdbdaa (diff) | |
download | FreeBSD-src-1048fa73010ca9dfb0cfba83b166fcfa2ef994be.zip FreeBSD-src-1048fa73010ca9dfb0cfba83b166fcfa2ef994be.tar.gz |
Add a new interface ioctl, to return "aux status".
This is inteded for to allow ifconfig to print various unstructured
information from an interface.
The data is returned from the kernel in ASCII form, see the comment in
if.h for some technicalities.
Canonical cut&paste example to be found in if_tun.c
Initial use:
Now tun* interfaces tell the PID of the process which opened them.
Future uses could be (volounteers welcome!):
Have ppp/slip interfaces tell which tty they use.
Make sync interfaces return their media state: red/yellow/blue
alarm, timeslot assignment and so on.
Make ethernets warn about missing heartbeats and/or cables
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 57ffbdc..f2ab7de 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif static const char rcsid[] = - "$Id: ifconfig.c,v 1.39 1999/03/15 01:22:01 wpaul Exp $"; + "$Id: ifconfig.c,v 1.40 1999/06/06 09:17:30 phk Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -720,6 +720,7 @@ status(afp, addrcount, sdl, ifm, ifam) const struct afswtch *p = NULL; struct rt_addrinfo info; int allfamilies, s; + struct ifstat ifs; if (afp == NULL) { allfamilies = 1; @@ -757,6 +758,10 @@ status(afp, addrcount, sdl, ifm, ifam) printf(" mtu %d", mtu); putchar('\n'); + strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name); + if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) + printf("%s", ifs.ascii); + while (addrcount > 0) { info.rti_addrs = ifam->ifam_addrs; |