summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-03-26 14:48:01 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-03-26 14:48:01 +0100
commitaf157fa3dbe2bba0674eb7634efd3ade6c89d604 (patch)
treea4ea7c3b83a3af814eace38d9c02bd2f468d644d /proto
parent885b3d6127ae2c5c4f17d9dba95ffe67bdf7a688 (diff)
downloadbird-af157fa3dbe2bba0674eb7634efd3ade6c89d604.tar
bird-af157fa3dbe2bba0674eb7634efd3ade6c89d604.zip
Disable multiple OSPF pseudointerfaces on BSD.
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/iface.c2
-rw-r--r--proto/ospf/ospf.c13
-rw-r--r--proto/ospf/ospf.h19
3 files changed, 27 insertions, 7 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 987698e..b30a811 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -423,7 +423,7 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr,
ifa->strictnbma = ip->strictnbma;
ifa->waitint = ip->waitint;
ifa->dead = (ip->dead == 0) ? ip->deadc * ifa->helloint : ip->dead;
- ifa->stub = ip->stub;
+ ifa->stub = ospf_iface_stubby(ip, addr);
ifa->ioprob = OSPF_I_OK;
ifa->rxbuf = ip->rxbuf;
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index e77156b..e824511 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -763,16 +763,17 @@ ospf_reconfigure(struct proto *p, struct proto_config *c)
}
/* stub */
- if ((oldip->stub == 0) && (newip->stub != 0))
+ int old_stub = ospf_iface_stubby(oldip, ifa->addr);
+ int new_stub = ospf_iface_stubby(newip, ifa->addr);
+ if (!old_stub && new_stub)
{
- ifa->stub = newip->stub;
+ ifa->stub = 1;
OSPF_TRACE(D_EVENTS, "Interface %s is now stub.", ifa->iface->name);
}
- if ((oldip->stub != 0) && (newip->stub == 0) && (ifa->ioprob == OSPF_I_OK))
+ if (old_stub && !new_stub && (ifa->ioprob == OSPF_I_OK))
{
- ifa->stub = newip->stub;
- OSPF_TRACE(D_EVENTS,
- "Interface %s is no longer stub.", ifa->iface->name);
+ ifa->stub = 0;
+ OSPF_TRACE(D_EVENTS, "Interface %s is no longer stub.", ifa->iface->name);
}
#ifdef OSPFv2
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index 9e02d75..ef51b9f 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -772,6 +772,25 @@ struct ospf_iface_patt
#endif
};
+#if defined(OSPFv2) && !defined(CONFIG_MC_PROPER_SRC)
+static inline int
+ospf_iface_stubby(struct ospf_iface_patt *ip, struct ifa *addr)
+{
+ /*
+ * We cannot properly support multiple OSPF ifaces on real iface
+ * with multiple prefixes, therefore we force OSPF ifaces with
+ * non-primary IP prefixes to be stub.
+ */
+ return ip->stub || !(addr->flags & IA_PRIMARY);
+}
+#else
+static inline int
+ospf_iface_stubby(struct ospf_iface_patt *ip, struct ifa *addr UNUSED)
+{
+ return ip->stub;
+}
+#endif
+
int ospf_import_control(struct proto *p, rte **new, ea_list **attrs,
struct linpool *pool);
struct ea_list *ospf_make_tmp_attrs(struct rte *rt, struct linpool *pool);