]> git.puffer.fish Git - matthieu/frr.git/commitdiff
babeld: Error handling and tweaks for babeld commands.
authorJuliusz Chroboczek <jch@pps.jussieu.fr>
Tue, 7 Feb 2012 04:43:36 +0000 (05:43 +0100)
committerPaul Jakma <paul@quagga.net>
Sun, 25 Mar 2012 16:06:53 +0000 (17:06 +0100)
babeld/babel_interface.c
babeld/babel_main.c
babeld/babeld.c

index a874289cc925a046fc29dd04b33a58cd587c5905..906f349e730d05ee097bb62e0da8f5d7f69baa9b 100644 (file)
@@ -429,13 +429,14 @@ DEFUN (babel_set_hello_interval,
 {
     struct interface *ifp;
     babel_interface_nfo *babel_ifp;
+    int interval;
 
-    int interval = atoi(argv[0]);
+    VTY_GET_INTEGER_RANGE("hello interval", interval, argv[0], 20, 10 * 0xFFFE);
 
     ifp = vty->index;
     babel_ifp = babel_get_if_nfo(ifp);
-
     assert (babel_ifp != NULL);
+
     babel_ifp->hello_interval = interval;
     return CMD_SUCCESS;
 }
@@ -450,7 +451,7 @@ DEFUN (babel_passive_interface,
     if (allow_duplicates) {
         return CMD_WARNING;
     }
-    parasitic = -1;
+    parasitic = 1;
     return CMD_SUCCESS;
 }
 
@@ -900,7 +901,7 @@ DEFUN (show_babel_running_config,
     vty_out(vty, "    -- Babel running configuration --%s", VTY_NEWLINE);
     show_babel_main_configuration(vty);
     show_babeld_configuration(vty);
-    vty_out(vty, "    -- ditribution lists --%s", VTY_NEWLINE);
+    vty_out(vty, "    -- distribution lists --%s", VTY_NEWLINE);
     config_show_distribute(vty);
 
     return CMD_SUCCESS;
index 951da7d19730f3b7c2be0af9c3662bc6248fe092..a75171e0d81fa3feb78311d4bb263f99bbbf11fa 100644 (file)
@@ -227,8 +227,7 @@ babel_init(int argc, char **argv)
                 break;
             case 'P':
                 babel_vty_port = atoi (optarg);
-                if (babel_vty_port < 0 || babel_vty_port > 0xffff
-                    || (babel_vty_port == 0 && optarg[0] != '0'/*atoi error*/))
+                if (babel_vty_port <= 0 || babel_vty_port > 0xffff)
                     babel_vty_port = BABEL_VTY_PORT;
                 break;
             case 'u':
index 33b5d9e12a688b0edd2ee92cbcea78181a6e6cfe..da07434902209dc79a39e90ddf5c4982fabc986e 100644 (file)
@@ -608,6 +608,7 @@ DEFUN (router_babel,
         /* Notice to user we couldn't create Babel. */
         if (ret < 0) {
             zlog_warn ("can't create Babel");
+            return CMD_WARNING;
         }
     }
 
@@ -666,9 +667,11 @@ DEFUN (babel_set_protocol_port,
        "Set the protocol port (default is defined in RFC).\n"
        "IPv6 address")
 {
-    int port = atoi(argv[0]);
-    protocol_port = port;
+    int port;
 
+    VTY_GET_INTEGER_RANGE("port", port, argv[0], 1, 0xFFFF);
+
+    protocol_port = port;
     return CMD_SUCCESS;
 }