diff options
author | Avneesh Sachdev <avneesh@sproute.com> | 2016-04-04 19:54:58 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-23 18:12:16 +0200 |
commit | fb0aa88623f72b7e4d0f35e8df3f96aa090fc5c8 (patch) | |
tree | 4958c96776674bd17f7bcd16a9272e4ac3c4b3df /zebra/main.c | |
parent | Use only the ISC license for .proto files. (diff) | |
download | frr-fb0aa88623f72b7e4d0f35e8df3f96aa090fc5c8.tar.xz frr-fb0aa88623f72b7e4d0f35e8df3f96aa090fc5c8.zip |
zebra: optionally use protobuf with FPM
Change zebra so that it can optionally use protobuf serialization when
communicating with a Forwarding Plane Manager component.
* zebra/main.c
Add the --fpm-format/-F command line option. This allows the user
to control the format (protbuf|netlink) that is used to
communicate with the FPM.
* zebra/zebra_fpm.c
- zebra_init_msg_format(),
This new function is invoked on process startup to determine the
FPM format that should be used.
- zfpm_init()
Change to accept any 'FPM message format' specified by the user
(via the new command line flag).
- zebra_encode_route()
Tweak to use the selected FPM format.
* zebra_fpm_protobuf.c
New code to build protobuf messages to be sent to the FPM.
* zebra/Makefile.am
- Include common.am
- Build new file zebra_fpm_protobuf.c when protobuf is available.
- Link with the fpm_pb library.
Signed-off-by: Avneesh Sachdev <avneesh@sproute.com>
Diffstat (limited to 'zebra/main.c')
-rw-r--r-- | zebra/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/main.c b/zebra/main.c index faa6cdb31..da7e6b6fb 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -83,6 +83,7 @@ struct option longopts[] = { "daemon", no_argument, NULL, 'd'}, { "allow_delete", no_argument, NULL, 'a'}, { "keep_kernel", no_argument, NULL, 'k'}, + { "fpm_format", required_argument, NULL, 'F'}, { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "socket", required_argument, NULL, 'z'}, @@ -143,6 +144,7 @@ usage (char *progname, int status) "-d, --daemon Runs in daemon mode\n"\ "-a, --allow_delete Allow other processes to delete Quagga Routes\n" \ "-f, --config_file Set configuration file name\n"\ + "-F, --fpm_format Set fpm format to 'netlink' or 'protobuf'\n"\ "-i, --pid_file Set process identifier file name\n"\ "-z, --socket Set path of zebra socket\n"\ "-k, --keep_kernel Don't delete old routes which installed by "\ @@ -238,6 +240,7 @@ main (int argc, char **argv) char *progname; struct thread thread; char *zserv_path = NULL; + char *fpm_format = NULL; /* Set umask before anything for security */ umask (0027); @@ -257,9 +260,9 @@ main (int argc, char **argv) int opt; #ifdef HAVE_NETLINK - opt = getopt_long (argc, argv, "bdakf:i:z:hA:P:ru:g:vs:C", longopts, 0); + opt = getopt_long (argc, argv, "bdakf:F:i:z:hA:P:ru:g:vs:C", longopts, 0); #else - opt = getopt_long (argc, argv, "bdakf:i:z:hA:P:ru:g:vC", longopts, 0); + opt = getopt_long (argc, argv, "bdakf:F:i:z:hA:P:ru:g:vC", longopts, 0); #endif /* HAVE_NETLINK */ if (opt == EOF) @@ -286,6 +289,9 @@ main (int argc, char **argv) case 'f': config_file = optarg; break; + case 'F': + fpm_format = optarg; + break; case 'A': vty_addr = optarg; break; @@ -377,9 +383,9 @@ main (int argc, char **argv) #endif /* HAVE_SNMP */ #ifdef HAVE_FPM - zfpm_init (zebrad.master, 1, 0); + zfpm_init (zebrad.master, 1, 0, fpm_format); #else - zfpm_init (zebrad.master, 0, 0); + zfpm_init (zebrad.master, 0, 0, fpm_format); #endif /* Process the configuration file. Among other configuration |