diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-31 03:24:07 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-31 03:24:07 +0000 |
commit | 096d22c2a59ca8fd190428607badf44481bcb88e (patch) | |
tree | 37d9e8b77bbe608b52e203e5937e6677f8341847 /usr.sbin/ospfd/ospfd.c | |
parent | 4efb916c2227091b9bdd87d8d5abc6720e52da33 (diff) |
More redistribute fun. Add a possibility to deny redistribution of specified
routes via "no redistribute rtlabel admin". Redistribute rules are parsed
in order and the first match is used. Only exception is "redistribute default"
Which is independent of the other rules and can't be negated.
Diffstat (limited to 'usr.sbin/ospfd/ospfd.c')
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index fd07d6bb078..472fbc79e08 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.32 2006/05/30 22:06:14 claudio Exp $ */ +/* $OpenBSD: ospfd.c,v 1.33 2006/05/31 03:24:06 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -500,10 +500,10 @@ ospf_redistribute(struct kroute *kr) return (0); SIMPLEQ_FOREACH(r, &conf->redist_list, entry) { - switch (r->type) { + switch (r->type & ~REDIST_NO) { case REDIST_LABEL: if (kr->rtlabel == r->label) - return (1); + return (r->type & REDIST_NO ? 0 : 1); break; case REDIST_STATIC: /* @@ -514,14 +514,19 @@ ospf_redistribute(struct kroute *kr) if (kr->flags & F_DYNAMIC) continue; if (kr->flags & F_STATIC) - return (1); + return (r->type & REDIST_NO ? 0 : 1); case REDIST_CONNECTED: if (kr->flags & F_DYNAMIC) continue; if (kr->flags & F_CONNECTED) - return (1); + return (r->type & REDIST_NO ? 0 : 1); case REDIST_ADDR: - /* ignore */ + 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)) + return (r->type & REDIST_NO? 0 : 1); break; } } |