summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-06-20 15:21:10 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-06-20 15:29:47 +0000
commit795b5abf69904d8607e88f4dba92ab371755d2c0 (patch)
treed28900922b3a387975af0f3a6b26d0fab0df02e6
parent76981cd383e4bed69454bcc4151a0aae89e8ca84 (diff)
zebra: Add ipv6 router advertisement message counter
Ticket: CM-4497 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/interface.c2
-rw-r--r--zebra/interface.h1
-rw-r--r--zebra/rtadv.c20
3 files changed, 23 insertions, 0 deletions
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