summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorremi <remi@cvs.openbsd.org>2019-01-15 22:18:11 +0000
committerremi <remi@cvs.openbsd.org>2019-01-15 22:18:11 +0000
commitdd6a9cbdd5ceca7b78866578dc7c99818a9c3069 (patch)
tree1165e0645c55e1a1ea42e40555ae70066f44eeef /usr.sbin/ospf6d
parent5f84aee44160c6a6cb838c4b100ca8ee1eebba27 (diff)
For external LSAs the type (1 or 2) is encoded in the metric field. Do not
overwrite this when using "redistribute X set type 2 depend on ifX" and ifX is down. Problem reported for ospfd by Igor Podlesny. ok benno@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r--usr.sbin/ospf6d/ospf6d.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.c b/usr.sbin/ospf6d/ospf6d.c
index 1e66d32d4e5..cccaec322e7 100644
--- a/usr.sbin/ospf6d/ospf6d.c
+++ b/usr.sbin/ospf6d/ospf6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6d.c,v 1.42 2019/01/14 16:50:56 florian Exp $ */
+/* $OpenBSD: ospf6d.c,v 1.43 2019/01/15 22:18:10 remi Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -534,7 +534,8 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
switch (r->type & ~REDIST_NO) {
case REDIST_LABEL:
if (kr->rtlabel == r->label) {
- *metric = depend_ok ? r->metric : MAX_METRIC;
+ *metric = depend_ok ? r->metric :
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
}
break;
@@ -549,7 +550,8 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
if (kr->flags & F_DYNAMIC)
continue;
if (kr->flags & F_STATIC) {
- *metric = depend_ok ? r->metric : MAX_METRIC;
+ *metric = depend_ok ? r->metric :
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
}
break;
@@ -559,7 +561,8 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
if (kr->flags & F_DYNAMIC)
continue;
if (kr->flags & F_CONNECTED) {
- *metric = depend_ok ? r->metric : MAX_METRIC;
+ *metric = depend_ok ? r->metric :
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
}
break;
@@ -571,7 +574,7 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
r->prefixlen == 0) {
if (is_default) {
*metric = depend_ok ? r->metric :
- MAX_METRIC;
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
} else
return (0);
@@ -581,13 +584,15 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
inet6applymask(&inb, &r->addr, r->prefixlen);
if (IN6_ARE_ADDR_EQUAL(&ina, &inb) &&
kr->prefixlen >= r->prefixlen) {
- *metric = depend_ok ? r->metric : MAX_METRIC;
+ *metric = depend_ok ? r->metric :
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
}
break;
case REDIST_DEFAULT:
if (is_default) {
- *metric = depend_ok ? r->metric : MAX_METRIC;
+ *metric = depend_ok ? r->metric :
+ r->metric | MAX_METRIC;
return (r->type & REDIST_NO ? 0 : 1);
}
break;