summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-10-11 12:19:32 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-10-11 12:19:32 +0000
commit883c6340d4913899a5a68266d31ecd995948b29b (patch)
treec4591506486065ed4d292fc7d71d84e7eef7b957 /usr.sbin
parent64d51fafbb58bdc7417dd57ca5c83c8275143b4e (diff)
Bye bye global ospf options. OSPF options are per area (at least the one
flag that we set). So introduce a area_ospf_options() function that will return the correct flags for each area. This makes stub area support a lot easier. OK norby@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospfd/area.c12
-rw-r--r--usr.sbin/ospfd/database.c4
-rw-r--r--usr.sbin/ospfd/hello.c4
-rw-r--r--usr.sbin/ospfd/ospfd.h4
-rw-r--r--usr.sbin/ospfd/ospfe.c8
-rw-r--r--usr.sbin/ospfd/parse.y3
-rw-r--r--usr.sbin/ospfd/rde.c12
7 files changed, 28 insertions, 19 deletions
diff --git a/usr.sbin/ospfd/area.c b/usr.sbin/ospfd/area.c
index 95784de2826..2d3522094dc 100644
--- a/usr.sbin/ospfd/area.c
+++ b/usr.sbin/ospfd/area.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: area.c,v 1.7 2007/09/28 08:19:52 claudio Exp $ */
+/* $OpenBSD: area.c,v 1.8 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -115,3 +115,13 @@ area_border_router(struct ospfd_conf *conf)
return (active > 1);
}
+u_int8_t
+area_ospf_options(struct area *area)
+{
+ u_int8_t opt = 0;
+
+ if (area && !area->stub)
+ opt |= OSPF_OPTION_E;
+
+ return (opt);
+}
diff --git a/usr.sbin/ospfd/database.c b/usr.sbin/ospfd/database.c
index b222d82a4b4..247ed323ed3 100644
--- a/usr.sbin/ospfd/database.c
+++ b/usr.sbin/ospfd/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.20 2007/10/11 08:21:29 claudio Exp $ */
+/* $OpenBSD: database.c,v 1.21 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -138,7 +138,7 @@ send_db_description(struct nbr *nbr)
fatalx("send_db_description: unknown interface type");
}
- dd_hdr.opts = oeconf->options;
+ dd_hdr.opts = area_ospf_options(nbr->iface->area);
dd_hdr.bits = bits;
dd_hdr.dd_seq_num = htonl(nbr->dd_seq_num);
diff --git a/usr.sbin/ospfd/hello.c b/usr.sbin/ospfd/hello.c
index 8bd805efc4c..56b786a70bb 100644
--- a/usr.sbin/ospfd/hello.c
+++ b/usr.sbin/ospfd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.13 2006/03/09 14:16:34 claudio Exp $ */
+/* $OpenBSD: hello.c,v 1.14 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -75,7 +75,7 @@ send_hello(struct iface *iface)
/* hello header */
hello.mask = iface->mask.s_addr;
hello.hello_interval = htons(iface->hello_interval);
- hello.opts = oeconf->options;
+ hello.opts = area_ospf_options(iface->area);
hello.rtr_priority = iface->priority;
hello.rtr_dead_interval = htonl(iface->dead_interval);
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 0ef4258fe14..e4926bd1a89 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.70 2007/09/25 11:25:41 claudio Exp $ */
+/* $OpenBSD: ospfd.h,v 1.71 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -407,7 +407,6 @@ struct ospfd_conf {
int spf_state;
int ospf_socket;
int flags;
- int options; /* OSPF options */
u_int8_t rfc1583compat;
u_int8_t border;
u_int8_t redistribute;
@@ -555,6 +554,7 @@ int area_del(struct area *);
struct area *area_find(struct ospfd_conf *, struct in_addr);
void area_track(struct area *, int);
int area_border_router(struct ospfd_conf *);
+u_int8_t area_ospf_options(struct area *);
/* buffer.c */
struct buf *buf_open(size_t);
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 0dbaeaa5bf0..d462f888f13 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.58 2007/10/01 08:35:12 norby Exp $ */
+/* $OpenBSD: ospfe.c,v 1.59 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -895,7 +895,7 @@ orig_rtr_lsa(struct area *area)
* Set the E bit as soon as an as-ext lsa may be redistributed, only
* setting it in case we redistribute something is not worth the fuss.
*/
- if (oeconf->redistribute && (oeconf->options & OSPF_OPTION_E))
+ if (oeconf->redistribute && !area->stub)
lsa_rtr.flags |= OSPF_RTR_E;
border = (area_border_router(oeconf) != 0);
@@ -918,7 +918,7 @@ orig_rtr_lsa(struct area *area)
/* LSA header */
lsa_hdr.age = htons(DEFAULT_AGE);
- lsa_hdr.opts = oeconf->options; /* XXX */
+ lsa_hdr.opts = area_ospf_options(area);
lsa_hdr.type = LSA_TYPE_ROUTER;
lsa_hdr.ls_id = oeconf->rtr_id.s_addr;
lsa_hdr.adv_rtr = oeconf->rtr_id.s_addr;
@@ -982,7 +982,7 @@ orig_net_lsa(struct iface *iface)
else
lsa_hdr.age = htons(MAX_AGE);
- lsa_hdr.opts = oeconf->options; /* XXX */
+ lsa_hdr.opts = area_ospf_options(iface->area);
lsa_hdr.type = LSA_TYPE_NETWORK;
lsa_hdr.ls_id = iface->addr.s_addr;
lsa_hdr.adv_rtr = oeconf->rtr_id.s_addr;
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 5ca5373bd30..a942ac6fc62 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.52 2007/10/01 08:35:12 norby Exp $ */
+/* $OpenBSD: parse.y,v 1.53 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -918,7 +918,6 @@ parse_config(char *filename, int opts)
defs->metric = DEFAULT_METRIC;
defs->priority = DEFAULT_PRIORITY;
- conf->options = OSPF_OPTION_E;
conf->spf_delay = DEFAULT_SPF_DELAY;
conf->spf_hold_time = DEFAULT_SPF_HOLDTIME;
conf->spf_state = SPF_IDLE;
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index 02e5cc06503..81fa82e3287 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.71 2007/10/01 08:35:12 norby Exp $ */
+/* $OpenBSD: rde.c,v 1.72 2007/10/11 12:19:31 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -60,7 +60,7 @@ struct lsa *rde_asext_get(struct rroute *);
struct lsa *rde_asext_put(struct rroute *);
struct lsa *orig_asext_lsa(struct rroute *, u_int16_t);
-struct lsa *orig_sum_lsa(struct rt_node *, u_int8_t, int);
+struct lsa *orig_sum_lsa(struct rt_node *, struct area *, u_int8_t, int);
struct ospfd_conf *rdeconf = NULL, *nconf = NULL;
struct imsgbuf *ibuf_ospfe;
@@ -1093,7 +1093,7 @@ rde_summary_update(struct rt_node *rte, struct area *area)
/* update lsa but only if it was changed */
v = lsa_find(area, type, rte->prefix.s_addr, rde_router_id());
- lsa = orig_sum_lsa(rte, type, rte->invalid);
+ lsa = orig_sum_lsa(rte, area, type, rte->invalid);
lsa_merge(rde_nbr_self(area), lsa, v);
if (v == NULL)
@@ -1123,7 +1123,7 @@ orig_asext_lsa(struct rroute *rr, u_int16_t age)
/* LSA header */
lsa->hdr.age = htons(age);
- lsa->hdr.opts = rdeconf->options; /* XXX not updated */
+ lsa->hdr.opts = area_ospf_options(NULL);
lsa->hdr.type = LSA_TYPE_EXTERNAL;
lsa->hdr.adv_rtr = rdeconf->rtr_id.s_addr;
lsa->hdr.seq_num = htonl(INIT_SEQ_NUM);
@@ -1158,7 +1158,7 @@ orig_asext_lsa(struct rroute *rr, u_int16_t age)
}
struct lsa *
-orig_sum_lsa(struct rt_node *rte, u_int8_t type, int invalid)
+orig_sum_lsa(struct rt_node *rte, struct area *area, u_int8_t type, int invalid)
{
struct lsa *lsa;
u_int16_t len;
@@ -1169,7 +1169,7 @@ orig_sum_lsa(struct rt_node *rte, u_int8_t type, int invalid)
/* LSA header */
lsa->hdr.age = htons(invalid ? MAX_AGE : DEFAULT_AGE);
- lsa->hdr.opts = rdeconf->options; /* XXX not updated */
+ lsa->hdr.opts = area_ospf_options(area);
lsa->hdr.type = type;
lsa->hdr.adv_rtr = rdeconf->rtr_id.s_addr;
lsa->hdr.seq_num = htonl(INIT_SEQ_NUM);