summaryrefslogtreecommitdiff
path: root/zebra/rtadv.c
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 /zebra/rtadv.c
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>
Diffstat (limited to 'zebra/rtadv.c')
-rw-r--r--zebra/rtadv.c20
1 files changed, 20 insertions, 0 deletions
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