summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-09-20 21:17:34 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-20 21:17:34 -0400
commit460a768914822df062bc1282296e6bf6a3c6f725 (patch)
tree5997cc60a574e56f4960103caa9d9f35a36bc4e2 /zebra/interface.c
parent844ec28cee41395cdd1cc0cdf8cf0168f9dc1adf (diff)
parente3e29b328d161c6d129e479a9564ce216688da81 (diff)
Merge remote-tracking branch 'origin/cmaster-next' into vtysh-grammar
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 2b1e6f4ac6..9be97e2214 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -28,6 +28,7 @@
#include "prefix.h"
#include "command.h"
#include "memory.h"
+#include "zebra_memory.h"
#include "ioctl.h"
#include "connected.h"
#include "log.h"
@@ -1255,6 +1256,19 @@ ALIAS (zebra_interface,
"Interface's name\n"
VRF_CMD_HELP_STR)
+static void
+interface_update_stats (void)
+{
+#ifdef HAVE_PROC_NET_DEV
+ /* If system has interface statistics via proc file system, update
+ statistics. */
+ ifstat_update_proc ();
+#endif /* HAVE_PROC_NET_DEV */
+#ifdef HAVE_NET_RT_IFLIST
+ ifstat_update_sysctl ();
+#endif /* HAVE_NET_RT_IFLIST */
+}
+
struct cmd_node interface_node =
{
INTERFACE_NODE,
@@ -1300,14 +1314,7 @@ DEFUN (show_interface, show_interface_cmd,
struct interface *ifp;
vrf_id_t vrf_id = VRF_DEFAULT;
-#ifdef HAVE_PROC_NET_DEV
- /* If system has interface statistics via proc file system, update
- statistics. */
- ifstat_update_proc ();
-#endif /* HAVE_PROC_NET_DEV */
-#ifdef HAVE_NET_RT_IFLIST
- ifstat_update_sysctl ();
-#endif /* HAVE_NET_RT_IFLIST */
+ interface_update_stats ();
if (argc > 0)
VRF_GET_ID (vrf_id, argv[0]);
@@ -1337,14 +1344,7 @@ DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd,
struct interface *ifp;
vrf_iter_t iter;
-#ifdef HAVE_PROC_NET_DEV
- /* If system has interface statistics via proc file system, update
- statistics. */
- ifstat_update_proc ();
-#endif /* HAVE_PROC_NET_DEV */
-#ifdef HAVE_NET_RT_IFLIST
- ifstat_update_sysctl ();
-#endif /* HAVE_NET_RT_IFLIST */
+ interface_update_stats ();
/* All interface print. */
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
@@ -1367,14 +1367,7 @@ DEFUN (show_interface_name_vrf,
struct interface *ifp;
vrf_id_t vrf_id = VRF_DEFAULT;
-#ifdef HAVE_PROC_NET_DEV
- /* If system has interface statistics via proc file system, update
- statistics. */
- ifstat_update_proc ();
-#endif /* HAVE_PROC_NET_DEV */
-#ifdef HAVE_NET_RT_IFLIST
- ifstat_update_sysctl ();
-#endif /* HAVE_NET_RT_IFLIST */
+ interface_update_stats ();
if (argc > 1)
VRF_GET_ID (vrf_id, argv[1]);
@@ -1404,14 +1397,7 @@ DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd,
vrf_iter_t iter;
int found = 0;
-#ifdef HAVE_PROC_NET_DEV
- /* If system has interface statistics via proc file system, update
- statistics. */
- ifstat_update_proc ();
-#endif /* HAVE_PROC_NET_DEV */
-#ifdef HAVE_NET_RT_IFLIST
- ifstat_update_sysctl ();
-#endif /* HAVE_NET_RT_IFLIST */
+ interface_update_stats ();
/* All interface print. */
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))