summaryrefslogtreecommitdiffstats
path: root/ripd
diff options
context:
space:
mode:
Diffstat (limited to 'ripd')
-rw-r--r--ripd/ChangeLog8
-rw-r--r--ripd/rip_main.c12
-rw-r--r--ripd/rip_routemap.c2
-rw-r--r--ripd/ripd.c5
4 files changed, 23 insertions, 4 deletions
diff --git a/ripd/ChangeLog b/ripd/ChangeLog
index 50f8dfd7..68813f14 100644
--- a/ripd/ChangeLog
+++ b/ripd/ChangeLog
@@ -1,3 +1,11 @@
+2006-09-11 Paul Jakma <paul.jakma@sun.com>
+
+ * ripd.c: (rip_read) remove gratuitous use of mid-function
+ declaration of vrecv, bug #278.
+ * rip_routemap.c: (route_set_metric) underflow check needs to
+ use signed, problem identified and diagnosed by Pavel
+ Nikiforov in bug #293.
+
2006-06-29 Paul Jakma <paul.jakma@sun.com>
* rip_zebra: (general) convert redistribute commands to use
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index c9d564b7..dfcd6c26 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -42,6 +42,7 @@ static struct option longopts[] =
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
{ "help", no_argument, NULL, 'h'},
+ { "dryrun", no_argument, NULL, 'C'},
{ "vty_addr", required_argument, NULL, 'A'},
{ "vty_port", required_argument, NULL, 'P'},
{ "retain", no_argument, NULL, 'r'},
@@ -110,6 +111,7 @@ Daemon which manages RIP version 1 and 2.\n\n\
-i, --pid_file Set process identifier file name\n\
-A, --vty_addr Set vty's bind address\n\
-P, --vty_port Set vty's port number\n\
+-C, --dryrun Check configuration for validity and exit\n\
-r, --retain When program terminates, retain added route by ripd.\n\
-u, --user User to run as\n\
-g, --group Group to run as\n\
@@ -185,6 +187,7 @@ main (int argc, char **argv)
{
char *p;
int daemon_mode = 0;
+ int dryrun = 0;
char *progname;
struct thread thread;
@@ -203,7 +206,7 @@ main (int argc, char **argv)
{
int opt;
- opt = getopt_long (argc, argv, "df:i:hA:P:u:g:rv", longopts, 0);
+ opt = getopt_long (argc, argv, "df:i:hA:P:u:g:rvC", longopts, 0);
if (opt == EOF)
break;
@@ -238,6 +241,9 @@ main (int argc, char **argv)
case 'r':
retain_mode = 1;
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'u':
ripd_privs.user = optarg;
break;
@@ -280,6 +286,10 @@ main (int argc, char **argv)
/* Get configuration file. */
vty_read_config (config_file, config_default);
+ /* Start execution only if not in dry-run mode */
+ if(dryrun)
+ return (0);
+
/* Change to the daemon program. */
if (daemon_mode)
daemon (0, 0);
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c
index 9d6fd16e..cb87ea55 100644
--- a/ripd/rip_routemap.c
+++ b/ripd/rip_routemap.c
@@ -530,7 +530,7 @@ route_set_metric (void *rule, struct prefix *prefix,
else if (mod->type == metric_absolute)
rinfo->metric_out = mod->metric;
- if (rinfo->metric_out < 1)
+ if ((signed int)rinfo->metric_out < 1)
rinfo->metric_out = 1;
if (rinfo->metric_out > RIP_METRIC_INFINITY)
rinfo->metric_out = RIP_METRIC_INFINITY;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 518e4861..a1630f6c 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1818,6 +1818,7 @@ rip_read (struct thread *t)
struct rip_packet *packet;
struct sockaddr_in from;
int len;
+ int vrecv;
socklen_t fromlen;
struct interface *ifp;
struct connected *ifc;
@@ -1937,8 +1938,8 @@ rip_read (struct thread *t)
}
/* RIP Version check. RFC2453, 4.6 and 5.1 */
- int vrecv = ((ri->ri_receive == RI_RIP_UNSPEC) ?
- rip->version_recv : ri->ri_receive);
+ vrecv = ((ri->ri_receive == RI_RIP_UNSPEC) ?
+ rip->version_recv : ri->ri_receive);
if ((packet->version == RIPv1) && !(vrecv & RIPv1))
{
if (IS_RIP_DEBUG_PACKET)