]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: Get main to work correctly
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 14 May 2017 03:16:03 +0000 (23:16 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 14 May 2017 03:16:03 +0000 (23:16 -0400)
Get main to init up in the libfrr paradigm.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
babeld/babel_main.c

index 7fd620e98162d30cb451ce459829ffc8d81d17ca..472bad849b8fb751e64500d068c47378d5065be5 100644 (file)
@@ -46,8 +46,6 @@ THE SOFTWARE.
 #include "resend.h"
 #include "babel_zebra.h"
 
-
-static void babel_init (int argc, char **argv);
 static void babel_fail(void);
 static void babel_init_random(void);
 static void babel_replace_by_null(int fd);
@@ -85,6 +83,7 @@ static zebra_capabilities_t _caps_p [] =
     ZCAP_NET_RAW,
     ZCAP_BIND
 };
+
 static struct zebra_privs_t babeld_privs =
 {
 #if defined(FRR_USER)
@@ -97,7 +96,7 @@ static struct zebra_privs_t babeld_privs =
     .vty_group = VTY_GROUP,
 #endif
     .caps_p = _caps_p,
-    .cap_num_p = 2,
+    .cap_num_p = array_size(_caps_p),
     .cap_num_i = 0
 };
 
@@ -149,23 +148,10 @@ FRR_DAEMON_INFO(babeld, BABELD,
 int
 main(int argc, char **argv)
 {
-    struct thread thread;
-    /* and print banner too */
-    babel_init(argc, argv);
-    while (thread_fetch (master, &thread)) {
-        thread_call (&thread);
-    }
-    return 0;
-}
-
-/* make initialisations witch don't need infos about kernel(interfaces, etc.) */
-static void
-babel_init(int argc, char **argv)
-{
-  int rc;
+    int rc;
 
-  frr_preinit (&babeld_di, argc, argv);
-  frr_opt_add ("", longopts, "");
+    frr_preinit (&babeld_di, argc, argv);
+    frr_opt_add ("", longopts, "");
   
     babel_init_random();
 
@@ -193,7 +179,7 @@ babel_init(int argc, char **argv)
     }
 
     /* create the threads handler */
-    master = thread_master_create ();
+    master = frr_init ();
 
     /* Library inits. */
     zprivs_init (&babeld_privs);
@@ -222,6 +208,11 @@ babel_init(int argc, char **argv)
     schedule_neighbours_check(5000, 1);
 
     zlog_notice ("BABELd %s starting: vty@%d", BABEL_VERSION, babel_vty_port);
+
+    frr_config_fork();
+    frr_run(master);
+
+    return 0;
 }
 
 static void