summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/rde.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-01-07 21:16:37 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-01-07 21:16:37 +0000
commitf4ea0dc4cd832d8220a0e28e73e5b23280105bda (patch)
treee16005117e1c12bb228dbf9bae26167a7dfbc369 /usr.sbin/ospfd/rde.c
parentbc6003da3f34e9f1662e6941edeca975ece693d1 (diff)
Full stub area support. This allows ABRs to announce a default network
summary LSA into stub areas so that these routers are able to reach the outside of the area. OK norby@
Diffstat (limited to 'usr.sbin/ospfd/rde.c')
-rw-r--r--usr.sbin/ospfd/rde.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index 5e63c5d3225..11d782c1d64 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.75 2008/12/12 22:43:17 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.76 2009/01/07 21:16:36 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -589,6 +589,7 @@ rde_dispatch_parent(int fd, short event, void *bula)
struct imsgbuf *ibuf = bula;
struct lsa *lsa;
struct vertex *v;
+ struct redistribute *nred;
ssize_t n;
int shut = 0;
@@ -667,9 +668,17 @@ rde_dispatch_parent(int fd, short event, void *bula)
LIST_INIT(&narea->iface_list);
LIST_INIT(&narea->nbr_list);
RB_INIT(&narea->lsa_tree);
+ SIMPLEQ_INIT(&narea->redist_list);
LIST_INSERT_HEAD(&nconf->area_list, narea, entry);
break;
+ case IMSG_RECONF_REDIST:
+ if ((nred= malloc(sizeof(struct redistribute))) == NULL)
+ fatal(NULL);
+ memcpy(nred, imsg.data, sizeof(struct redistribute));
+
+ SIMPLEQ_INSERT_TAIL(&narea->redist_list, nred, entry);
+ break;
case IMSG_RECONF_IFACE:
if ((niface = malloc(sizeof(struct iface))) == NULL)
fatal(NULL);
@@ -709,6 +718,16 @@ rde_router_id(void)
return (rdeconf->rtr_id.s_addr);
}
+struct area *
+rde_backbone_area(void)
+{
+ struct in_addr id;
+
+ id.s_addr = INADDR_ANY;
+
+ return (area_find(rdeconf, id));
+}
+
void
rde_send_change_kroute(struct rt_node *r)
{
@@ -1056,6 +1075,8 @@ rde_asext_put(struct rroute *rr)
void
rde_summary_update(struct rt_node *rte, struct area *area)
{
+ struct rt_nexthop *rn;
+ struct rt_node *nr;
struct vertex *v = NULL;
struct lsa *lsa;
u_int8_t type = 0;
@@ -1072,7 +1093,16 @@ rde_summary_update(struct rt_node *rte, struct area *area)
/* no need to originate inter-area routes to the backbone */
if (rte->p_type == PT_INTER_AREA && area->id.s_addr == INADDR_ANY)
return;
- /* TODO nexthop check, nexthop part of area -> no summary */
+ /* nexthop check, nexthop part of area -> no summary */
+ TAILQ_FOREACH(rn, &rte->nexthop, entry) {
+ nr = rt_lookup(DT_NET, rn->nexthop.s_addr);
+ if (nr && nr->area.s_addr == area->id.s_addr)
+ continue;
+ break;
+ }
+ if (rn == NULL) /* all nexthops belong to this area */
+ return;
+
if (rte->cost >= LS_INFINITY)
return;
/* TODO AS border router specific checks */