summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/ospfd.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-12-07 19:14:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-12-07 19:14:28 +0000
commit68a9ac9db714345f6ff1bc54590577d0aeafd263 (patch)
tree30fd0a4940f64cb6acebc75046db78b9b4479b7f /usr.sbin/ospfd/ospfd.c
parentcc46e39f28415c23d89297b7a0c3d56c202d470b (diff)
Make it possible to set the metric and LSA type for redistributed routes.
Mostly based on a diff by Pierre-Yves Ritschard (I just simplified the parser code). OK norby@
Diffstat (limited to 'usr.sbin/ospfd/ospfd.c')
-rw-r--r--usr.sbin/ospfd/ospfd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index 7af4b2515c4..88687d33a7f 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.36 2006/11/01 13:20:18 claudio Exp $ */
+/* $OpenBSD: ospfd.c,v 1.37 2006/12/07 19:14:27 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -485,7 +485,7 @@ imsg_event_add(struct imsgbuf *ibuf)
}
int
-ospf_redistribute(struct kroute *kr)
+ospf_redistribute(struct kroute *kr, u_int32_t *metric)
{
struct redistribute *r;
@@ -511,22 +511,28 @@ ospf_redistribute(struct kroute *kr)
*/
if (kr->flags & F_DYNAMIC)
continue;
- if (kr->flags & F_STATIC)
+ if (kr->flags & F_STATIC) {
+ *metric = r->metric;
return (r->type & REDIST_NO ? 0 : 1);
+ }
break;
case REDIST_CONNECTED:
if (kr->flags & F_DYNAMIC)
continue;
- if (kr->flags & F_CONNECTED)
+ if (kr->flags & F_CONNECTED) {
+ *metric = r->metric;
return (r->type & REDIST_NO ? 0 : 1);
+ }
break;
case REDIST_ADDR:
if (kr->flags & F_DYNAMIC)
continue;
if ((kr->prefix.s_addr & r->mask.s_addr) ==
(r->addr.s_addr & r->mask.s_addr) &&
- kr->prefixlen >= mask2prefixlen(r->mask.s_addr))
+ kr->prefixlen >= mask2prefixlen(r->mask.s_addr)) {
+ *metric = r->metric;
return (r->type & REDIST_NO? 0 : 1);
+ }
break;
}
}