diff options
author | 2019-01-15 22:18:10 +0000 | |
---|---|---|
committer | 2019-01-15 22:18:10 +0000 | |
commit | 17e34b32ed8c08ec67ab2ae29cfec42b0710ec9d (patch) | |
tree | 7b231e27ce568553352acc5f84acadd6c8ad84b6 | |
parent | Make otus(4) modify its DMA_TRIGGER register with readable macros (diff) | |
download | wireguard-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@
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.c | 19 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 19 |
2 files changed, 24 insertions, 14 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; diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index 1aa7cde3248..d01a2fa66b8 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.104 2019/01/14 16:50:56 florian Exp $ */ +/* $OpenBSD: ospfd.c,v 1.105 2019/01/15 22:18:10 remi Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -564,7 +564,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; @@ -579,7 +580,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; @@ -589,7 +591,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; @@ -601,7 +604,7 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric) r->mask.s_addr == INADDR_ANY) { if (is_default) { *metric = depend_ok ? r->metric : - MAX_METRIC; + r->metric | MAX_METRIC; return (r->type & REDIST_NO ? 0 : 1); } else return (0); @@ -610,13 +613,15 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric) if ((kr->prefix.s_addr & r->mask.s_addr) == (r->addr.s_addr & r->mask.s_addr) && kr->prefixlen >= mask2prefixlen(r->mask.s_addr)) { - *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; |