summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2019-01-15 22:18:10 +0000
committerremi <remi@openbsd.org>2019-01-15 22:18:10 +0000
commit17e34b32ed8c08ec67ab2ae29cfec42b0710ec9d (patch)
tree7b231e27ce568553352acc5f84acadd6c8ad84b6 /usr.sbin/ospf6d
parentMake otus(4) modify its DMA_TRIGGER register with readable macros (diff)
downloadwireguard-openbsd-17e34b32ed8c08ec67ab2ae29cfec42b0710ec9d.tar.xz
wireguard-openbsd-17e34b32ed8c08ec67ab2ae29cfec42b0710ec9d.zip
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;