From 9063f422e28cc8f126337b982fd2b589a38b870b Mon Sep 17 00:00:00 2001 From: Andre Oppermann Date: Mon, 3 May 2004 16:30:32 +0000 Subject: [PATCH] Link state change notification of ethernet media to the routing socket. o Print the link state for interface messages in monitor mode. No objections by: sam, wpaul, ru, bms Brucification by: bde --- sbin/route/route.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sbin/route/route.c b/sbin/route/route.c index 10fbee6094c5..dcd1ddcaefba 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1318,6 +1318,7 @@ print_rtmsg(rtm, msglen) struct ifma_msghdr *ifmam; #endif struct if_announcemsghdr *ifan; + char *state; if (verbose == 0) return; @@ -1334,7 +1335,19 @@ print_rtmsg(rtm, msglen) switch (rtm->rtm_type) { case RTM_IFINFO: ifm = (struct if_msghdr *)rtm; - (void) printf("if# %d, flags:", ifm->ifm_index); + (void) printf("if# %d, ", ifm->ifm_index); + switch (ifm->ifm_data.ifi_link_state) { + case LINK_STATE_DOWN: + state = "down"; + break; + case LINK_STATE_UP: + state = "up"; + break; + default: + state = "unknown"; + break; + } + (void) printf("link: %s, flags:", state); bprintf(stdout, ifm->ifm_flags, ifnetflags); pmsg_addrs((char *)(ifm + 1), ifm->ifm_addrs); break;