summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-12-21 17:22:30 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-12-21 17:22:30 +0000
commita8f56963b7fda33484acc4726c3f378751726d64 (patch)
tree4a92ae4408800b5d5a3a50d2c2ddb673fe8e6685 /usr.sbin
parent35dd2c2c4258c727e28c9dcc5d95685514eee241 (diff)
Unbreak redistribute default and make it possible to specify a metric for
the default route as well. OK norby@, michele@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospfd/ospfd.c13
-rw-r--r--usr.sbin/ospfd/ospfd.h3
-rw-r--r--usr.sbin/ospfd/parse.y16
3 files changed, 18 insertions, 14 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index 88687d33a7f..46fb7930622 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.37 2006/12/07 19:14:27 claudio Exp $ */
+/* $OpenBSD: ospfd.c,v 1.38 2006/12/21 17:22:29 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -543,10 +543,13 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
void
ospf_redistribute_default(int type)
{
- struct kroute kr;
+ struct rroute rr;
- bzero(&kr, sizeof(kr));
- if (conf->redistribute & REDISTRIBUTE_DEFAULT)
- main_imsg_compose_rde(type, 0, &kr, sizeof(struct kroute));
+ if (!(conf->redistribute & REDISTRIBUTE_DEFAULT))
+ return;
+
+ bzero(&rr, sizeof(rr));
+ rr.metric = conf->defaultmetric;
+ main_imsg_compose_rde(type, 0, &rr, sizeof(struct rroute));
}
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 1c036f35ace..8fc481b6e62 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.62 2006/12/07 19:14:27 claudio Exp $ */
+/* $OpenBSD: ospfd.h,v 1.63 2006/12/21 17:22:29 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -383,6 +383,7 @@ struct ospfd_conf {
LIST_HEAD(, vertex) cand_list;
SIMPLEQ_HEAD(, redistribute) redist_list;
+ u_int32_t defaultmetric;
u_int32_t opts;
#define OSPFD_OPT_VERBOSE 0x00000001
#define OSPFD_OPT_VERBOSE2 0x00000002
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index a114b10aef4..3b71518c72f 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.39 2006/12/07 19:14:27 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.40 2006/12/21 17:22:29 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -191,13 +191,13 @@ conf_main : ROUTERID STRING {
struct redistribute *r;
if (!strcmp($3, "default")) {
- conf->redistribute |= REDISTRIBUTE_DEFAULT;
- if ($1) {
- yyerror("cannot use 'no' with "
- "redistribute default");
- free($3);
- YYERROR;
- }
+ if (!$1)
+ conf->redistribute |=
+ REDISTRIBUTE_DEFAULT;
+ else
+ conf->redistribute &=
+ ~REDISTRIBUTE_DEFAULT;
+ conf->defaultmetric = $4;
} else {
if ((r = calloc(1, sizeof(*r))) == NULL)
fatal(NULL);