summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-01-14 22:39:50 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-01-14 22:39:50 +0000
commitb1c3d07d4d4cfedeb893c21778201c4158a94d10 (patch)
tree49fb0c3d25c2d8568db362b0e9951d1aa7611a4b /usr.sbin/bgpd/rde.c
parent337207ec49af7a59ee151a9cef2218d82ffafc29 (diff)
Small step in supporting the Adj-RIB-In additionaly to the Local-RIB.
First step is to define two flags F_LOCAL and F_ORIGINAL. These flags are used to distinguish prefix in the Local-RIB and those in the Adj- RIB-In. Adapt prefix API and add additional checks so that no Adj-RIB- In prefixes get mistakenly selected. Currently no F_ORIGINAL prefixes are created but this may change soon. Looks good Henning.
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 3d42f8b1407..f876984be1f 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.192 2006/01/13 13:04:33 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.193 2006/01/14 22:39:49 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -722,7 +722,8 @@ rde_update_dispatch(struct imsg *imsg)
}
rde_update_log("withdraw", peer, NULL, &prefix, prefixlen);
- prefix_remove(peer, &prefix, prefixlen);
+ prefix_remove(peer, &prefix, prefixlen, F_LOCAL);
+ prefix_remove(peer, &prefix, prefixlen, F_ORIGINAL);
}
if (attrpath_len == 0) /* 0 = no NLRI information in this message */
@@ -774,7 +775,10 @@ rde_update_dispatch(struct imsg *imsg)
rde_update_log("withdraw", peer, NULL,
&prefix, prefixlen);
- prefix_remove(peer, &prefix, prefixlen);
+ prefix_remove(peer, &prefix, prefixlen,
+ F_LOCAL);
+ prefix_remove(peer, &prefix, prefixlen,
+ F_ORIGINAL);
}
break;
default:
@@ -1473,7 +1477,9 @@ rde_dump_upcall(struct pt_entry *pt, void *ptr)
memcpy(&pid, ptr, sizeof(pid));
LIST_FOREACH(p, &pt->prefix_h, prefix_l)
- rde_dump_rib_as(p, pid);
+ /* for now dump only stuff from the local-RIB */
+ if (p->flags & F_LOCAL)
+ rde_dump_rib_as(p, pid);
}
void
@@ -1490,7 +1496,9 @@ rde_dump_as(struct filter_as *a, pid_t pid)
continue;
/* match found */
LIST_FOREACH(p, &asp->prefix_h, path_l)
- rde_dump_rib_as(p, pid);
+ /* for now dump only stuff from the local-RIB */
+ if (p->flags & F_LOCAL)
+ rde_dump_rib_as(p, pid);
}
}
}
@@ -1512,7 +1520,9 @@ rde_dump_prefix_upcall(struct pt_entry *pt, void *ptr)
return;
if (!prefix_compare(&ctl->pref->prefix, &addr, ctl->pref->prefixlen))
LIST_FOREACH(p, &pt->prefix_h, prefix_l)
- rde_dump_rib_as(p, ctl->pid);
+ /* for now dump only stuff from the local-RIB */
+ if (p->flags & F_LOCAL)
+ rde_dump_rib_as(p, ctl->pid);
}
void
@@ -2173,10 +2183,15 @@ network_add(struct network_config *nc, int flagstatic)
void
network_delete(struct network_config *nc, int flagstatic)
{
+ struct rde_peer *p;
+
if (flagstatic)
- prefix_remove(&peerself, &nc->prefix, nc->prefixlen);
+ p = &peerself;
else
- prefix_remove(&peerdynamic, &nc->prefix, nc->prefixlen);
+ p = &peerdynamic;
+
+ prefix_remove(p, &nc->prefix, nc->prefixlen, F_LOCAL);
+ prefix_remove(p, &nc->prefix, nc->prefixlen, F_ORIGINAL);
}
void