diff options
author | ru <ru@FreeBSD.org> | 2002-01-18 14:33:04 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2002-01-18 14:33:04 +0000 |
commit | 7bbde3fb1fe2ff7b5efd1426bdbd435faa950f70 (patch) | |
tree | 868a544aec0071521723bf9f4a0985c76b46ad04 /sbin/route | |
parent | d254e724006714f3f20b2ea58624a58cc97d2874 (diff) | |
download | FreeBSD-src-7bbde3fb1fe2ff7b5efd1426bdbd435faa950f70.zip FreeBSD-src-7bbde3fb1fe2ff7b5efd1426bdbd435faa950f70.tar.gz |
Introduce an interface announcement message for the routing
socket so that routing daemons and other interested parties
know when an interface is attached/detached.
PR: kern/33747
Obtained from: NetBSD
MFC after: 2 weeks
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/route.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index fcec843..ee6b924 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1335,6 +1335,7 @@ char *msgtypes[] = { "RTM_IFINFO: iface status change", "RTM_NEWMADDR: new multicast group membership on iface", "RTM_DELMADDR: multicast group membership removed from iface", + "RTM_IFANNOUNCE: interface arrival/departure", 0, }; @@ -1363,6 +1364,7 @@ print_rtmsg(rtm, msglen) #ifdef RTM_NEWMADDR struct ifma_msghdr *ifmam; #endif + struct if_announcemsghdr *ifan; if (verbose == 0) return; @@ -1371,7 +1373,11 @@ print_rtmsg(rtm, msglen) rtm->rtm_version); return; } - (void)printf("%s: len %d, ", msgtypes[rtm->rtm_type], rtm->rtm_msglen); + if (msgtypes[rtm->rtm_type] != NULL) + (void)printf("%s: ", msgtypes[rtm->rtm_type]); + else + (void)printf("#%d: ", rtm->rtm_type); + (void)printf("len %d, ", rtm->rtm_msglen); switch (rtm->rtm_type) { case RTM_IFINFO: ifm = (struct if_msghdr *)rtm; @@ -1393,6 +1399,23 @@ print_rtmsg(rtm, msglen) pmsg_addrs((char *)(ifmam + 1), ifmam->ifmam_addrs); break; #endif + case RTM_IFANNOUNCE: + ifan = (struct if_announcemsghdr *)rtm; + (void) printf("if# %d, what: ", ifan->ifan_index); + switch (ifan->ifan_what) { + case IFAN_ARRIVAL: + printf("arrival"); + break; + case IFAN_DEPARTURE: + printf("departure"); + break; + default: + printf("#%d", ifan->ifan_what); + break; + } + printf("\n"); + break; + default: (void) printf("pid: %ld, seq %d, errno %d, flags:", (long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno); |