summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-02-07 14:21:24 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-02-07 15:35:49 +0100
commitd21f1a930fb82114a63c4060d18c12fe48771100 (patch)
treefd78d32dd1f1db3a4341dc98b7a6123afa9121b3
parentsharpd: Allow nhop tracking to specify connected (diff)
downloadfrr-d21f1a930fb82114a63c4060d18c12fe48771100.tar.xz
frr-d21f1a930fb82114a63c4060d18c12fe48771100.zip
sharpd: Add start of global data structures
We have a bit of a mess with globals in the sharp daemon. Let's start formalizing it a bit. Future commits will take advantage of this, as that we need to have the ability to start dumping stats about commands we have issued. These changes will be useful for debugging and understanding what is going on. Signed-off-by: Donald sharp <sharpd@cumulusnetworks.com>
-rw-r--r--sharpd/sharp_globals.h28
-rw-r--r--sharpd/sharp_main.c10
-rw-r--r--sharpd/subdir.am1
3 files changed, 38 insertions, 1 deletions
diff --git a/sharpd/sharp_globals.h b/sharpd/sharp_globals.h
new file mode 100644
index 000000000..6b6cafc3c
--- /dev/null
+++ b/sharpd/sharp_globals.h
@@ -0,0 +1,28 @@
+/*
+ * SHARP - code to track globals
+ * Copyright (C) 2019 Cumulus Networks, Inc.
+ * Donald Sharp
+ *
+ * This file is part of FRR.
+ *
+ * FRR is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * FRR is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef __SHARP_GLOBAL_H__
+#define __SHARP_GLOBAL_H__
+
+struct sharp_global {
+};
+
+#endif
diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c
index 175a27608..c389b0bc3 100644
--- a/sharpd/sharp_main.c
+++ b/sharpd/sharp_main.c
@@ -46,6 +46,7 @@
#include "sharp_zebra.h"
#include "sharp_vty.h"
+#include "sharp_globals.h"
uint32_t total_routes = 0;
uint32_t installed_routes = 0;
@@ -125,7 +126,12 @@ FRR_DAEMON_INFO(sharpd, SHARP, .vty_port = SHARP_VTY_PORT,
.privs = &sharp_privs, .yang_modules = sharpd_yang_modules,
.n_yang_modules = array_size(sharpd_yang_modules), )
-extern void sharp_vty_init(void);
+struct sharp_global sg;
+
+static void sharp_global_init(void)
+{
+ memset(&sg, 0, sizeof(sg));
+}
int main(int argc, char **argv, char **envp)
{
@@ -151,6 +157,8 @@ int main(int argc, char **argv, char **envp)
master = frr_init();
+ sharp_global_init();
+
nexthop_group_init(NULL, NULL, NULL, NULL);
vrf_init(NULL, NULL, NULL, NULL, NULL);
diff --git a/sharpd/subdir.am b/sharpd/subdir.am
index c00d90ea0..6e8864ad7 100644
--- a/sharpd/subdir.am
+++ b/sharpd/subdir.am
@@ -17,6 +17,7 @@ sharpd_libsharp_a_SOURCES = \
noinst_HEADERS += \
sharpd/sharp_vty.h \
+ sharpd/sharp_globals.h \
sharpd/sharp_zebra.h \
# end