---
bgpd/bgp_main.c | 17 ++++++++++++++++-
zebra/main.c | 17 +++++++++++++++--
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 25669a0..0ca2b99 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -39,6 +39,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA
#include "stream.h"
#include "vrf.h"
#include "workqueue.h"
+#include "plugin.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
@@ -57,6 +58,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA
static const struct option longopts[] =
{
{ "daemon", no_argument, NULL, 'd'},
+ { "module", required_argument, NULL, 'M'},
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
{ "socket", required_argument, NULL, 'z'},
@@ -151,6 +153,7 @@ usage (char *progname, int status)
Daemon which manages kernel routing table management and \
redistribution between different routing protocols.\n\n\
-d, --daemon Runs in daemon mode\n\
+-M, --module Load specified module\n\
-f, --config_file Set configuration file name\n\
-i, --pid_file Set process identifier file name\n\
-z, --socket Set path of zebra socket\n\
@@ -335,6 +338,8 @@ bgp_exit (int status)
exit (status);
}
+QUAGGA_PLUGIN_SETUP(.name = "bgpd process")
+
/* Main routine of bgpd. Treatment of argument and start bgp finite
state machine is handled at here. */
int
@@ -347,6 +352,8 @@ main (int argc, char **argv)
char *progname;
struct thread thread;
int tmp_port;
+ struct qplug_runtime *plugin;
+ char plugerr[256];
/* Set umask before anything for security */
umask (0027);
@@ -363,7 +370,7 @@ main (int argc, char **argv)
/* Command line argument treatment. */
while (1)
{
- opt = getopt_long (argc, argv, "df:i:z:hp:l:A:P:rnu:g:vC", longopts, 0);
+ opt = getopt_long (argc, argv, "df:i:z:hp:l:A:P:rnu:g:vCM:", longopts,
0);
if (opt == EOF)
break;
@@ -375,6 +382,14 @@ main (int argc, char **argv)
case 'd':
daemon_mode = 1;
break;
+ case 'M':
+ plugin = qplug_load(optarg, plugerr, sizeof(plugerr));
+ if (!plugin)
+ {
+ fprintf(stderr, "%s\n", plugerr);
+ return 1;
+ }
+ break;
case 'f':
config_file = optarg;
break;
diff --git a/zebra/main.c b/zebra/main.c
index ee80283..b3ff649 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -35,6 +35,7 @@
#include "privs.h"
#include "sigevent.h"
#include "vrf.h"
+#include "plugin.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
@@ -72,6 +73,7 @@ struct option longopts[] =
{
{ "batch", no_argument, NULL, 'b'},
{ "daemon", no_argument, NULL, 'd'},
+ { "module", required_argument, NULL, 'M'},
{ "keep_kernel", no_argument, NULL, 'k'},
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
@@ -131,6 +133,7 @@ usage (char *progname, int status)
"redistribution between different routing protocols.\n\n"\
"-b, --batch Runs in batch mode\n"\
"-d, --daemon Runs in daemon mode\n"\
+ "-M, --module Load specified module\n"
"-f, --config_file Set configuration file name\n"\
"-i, --pid_file Set process identifier file name\n"\
"-z, --socket Set path of zebra socket\n"\
@@ -297,6 +300,8 @@ main (int argc, char **argv)
char *progname;
struct thread thread;
char *zserv_path = NULL;
+ struct qplug_runtime *plugin;
+ char plugerr[256];
/* Set umask before anything for security */
umask (0027);
@@ -312,9 +317,9 @@ main (int argc, char **argv)
int opt;
#ifdef HAVE_NETLINK
- opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vs:C", longopts, 0);
+ opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vs:CM:", longopts, 0);
#else
- opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vC", longopts, 0);
+ opt = getopt_long (argc, argv, "bdkf:i:z:hA:P:ru:g:vCM:", longopts, 0);
#endif /* HAVE_NETLINK */
if (opt == EOF)
@@ -329,6 +334,14 @@ main (int argc, char **argv)
case 'd':
daemon_mode = 1;
break;
+ case 'M':
+ plugin = qplug_load(optarg, plugerr, sizeof(plugerr));
+ if (!plugin)
+ {
+ fprintf(stderr, "%s\n", plugerr);
+ return 1;
+ }
+ break;
case 'k':
keep_kernel_mode = 1;
break;
--
2.7.3
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev