summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/neighbor.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-04-12 09:55:00 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-04-12 09:55:00 +0000
commit6b4b64159e389c13ae22556f749cd2d103f28244 (patch)
tree9dbba619914322f3d16f2e05b3764371d59085b2 /usr.sbin/ospfd/neighbor.c
parentc1405cb6b63a5233eeb1ca7db8fc6d64eaa8d531 (diff)
Support for self originated AS-external LSA.
With "redistribute (static|connected|default|none)" it is possible to tell ospfd which external routes should be announced. Connected routes will be announced only if there is no corresponding interface configured, in that case the prefix is not external. Adding and removing of announced prefixes are done automaticaly. OK norby@
Diffstat (limited to 'usr.sbin/ospfd/neighbor.c')
-rw-r--r--usr.sbin/ospfd/neighbor.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c
index c7847167297..4eddf908738 100644
--- a/usr.sbin/ospfd/neighbor.c
+++ b/usr.sbin/ospfd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.14 2005/03/31 19:32:10 norby Exp $ */
+/* $OpenBSD: neighbor.c,v 1.15 2005/04/12 09:54:59 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -50,7 +50,7 @@ struct nbr_table {
#define NBR_HASH(x) \
&nbrtable.hashtbl[(x) & nbrtable.hashmask]
-u_int32_t peercnt;
+u_int32_t peercnt = NBR_CNTSTART;
struct {
int state;
@@ -230,6 +230,8 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
void
nbr_init(u_int32_t hashsize)
{
+ struct nbr_head *head;
+ struct nbr *nbr;
u_int32_t hs, i;
for (hs = 1; hs < hashsize; hs <<= 1)
@@ -242,13 +244,27 @@ nbr_init(u_int32_t hashsize)
LIST_INIT(&nbrtable.hashtbl[i]);
nbrtable.hashmask = hs - 1;
+
+ /* allocate a dummy neighbor used for self originated AS ext routes */
+ if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
+ fatal("nbr_init");
+
+ nbr->id.s_addr = ospfe_router_id();
+ nbr->state = NBR_STA_DOWN;
+ nbr->peerid = NBR_IDSELF;
+ head = NBR_HASH(nbr->peerid);
+ LIST_INSERT_HEAD(head, nbr, hash);
+
+ TAILQ_INIT(&nbr->ls_retrans_list);
+ TAILQ_INIT(&nbr->db_sum_list);
+ TAILQ_INIT(&nbr->ls_req_list);
}
struct nbr *
nbr_new(u_int32_t nbr_id, struct iface *iface, int self)
{
struct nbr_head *head;
- struct nbr *nbr = NULL;
+ struct nbr *nbr;
struct rde_nbr rn;
if ((nbr = calloc(1, sizeof(*nbr))) == NULL)