diff --git a/zebra/interface.c b/zebra/interface.c index 4a2adbf01d..9d0a0c9d3d 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -933,6 +933,8 @@ nd_dump_vty (struct vty *vty, struct interface *ifp) rtadv->AdvReachableTime, VTY_NEWLINE); vty_out (vty, " ND advertised retransmit interval is %d milliseconds%s", rtadv->AdvRetransTimer, VTY_NEWLINE); + vty_out (vty, " ND router advertisements sent: %d rcvd: %d%s", + zif->ra_sent, zif->ra_rcvd, VTY_NEWLINE); interval = rtadv->MaxRtrAdvInterval; if (interval % 1000) vty_out (vty, " ND router advertisements are sent every " diff --git a/zebra/interface.h b/zebra/interface.h index f58596db2d..2857198373 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -204,6 +204,7 @@ struct zebra_if #if defined(HAVE_RTADV) struct rtadvconf rtadv; + unsigned int ra_sent, ra_rcvd; #endif /* HAVE_RTADV */ #ifdef HAVE_IRDP diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 909b8cd646..22fbf0b9c6 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -69,6 +69,20 @@ static void rtadv_event (struct zebra_ns *, enum rtadv_event, int); static int if_join_all_router (int, struct interface *); static int if_leave_all_router (int, struct interface *); +static int rtadv_increment_received(unsigned int *ifindex) { + int ret = -1; + struct interface *iface; + struct zebra_if *zif; + + iface = if_lookup_by_index_vrf(*ifindex, VRF_DEFAULT); + if (iface && iface->info) { + zif = iface->info; + zif->ra_rcvd++; + ret = 0; + } + return ret; +} + static int rtadv_recv_packet (int sock, u_char *buf, int buflen, struct sockaddr_in6 *from, unsigned int *ifindex, @@ -119,6 +133,10 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen, *hoplimit = *hoptr; } } + + if(rtadv_increment_received(ifindex) < 0) + zlog_err("%s: could not increment RA received counter", __func__); + return ret; } @@ -367,6 +385,8 @@ rtadv_send_packet (int sock, struct interface *ifp) zlog_err ("%s(%u): Tx RA failed, socket %u error %d (%s)", ifp->name, ifp->ifindex, sock, errno, safe_strerror(errno)); } + else + zif->ra_sent++; } static int