summaryrefslogtreecommitdiffstats
path: root/proto/ospf/ospf.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-05-06 23:38:11 +0200
committerMartin Mares <mj@ucw.cz>1999-05-06 23:38:11 +0200
commit9a158361da249e0eab1e0f7bd2c7dbe9f32eddfa (patch)
tree4d9dff14fd053aaa2d45be859144148eb8851a4d /proto/ospf/ospf.c
parentec8b579e9c9703601bf745745b620103fe2e2477 (diff)
downloadbird-9a158361da249e0eab1e0f7bd2c7dbe9f32eddfa.tar
bird-9a158361da249e0eab1e0f7bd2c7dbe9f32eddfa.zip
I rewrote the interface handling code, so that it supports multiple
addresses per interface (needed for example for IPv6 support). Visible changes: o struct iface now contains a list of all interface addresses (represented by struct ifa), iface->addr points to the primary address (if any). o Interface has IF_UP set iff it's up and it has a primary address. o IF_UP is now independent on IF_IGNORED (i.e., you need to test IF_IGNORED in the protocols; I've added this, but please check). o The if_notify_change hook has been simplified (only one interface pointer etc.). o Introduced a ifa_notify_change hook. (For now, only the Direct protocol does use it -- it's wise to just listen to device routes in all other protocols.) o Removed IF_CHANGE_FLAGS notifier flag (it was meaningless anyway). o Updated all the code except netlink (I'll look at it tomorrow) to match the new semantics (please look at your code to ensure I did it right). Things to fix: o Netlink. o Make krt-iface interpret "eth0:1"-type aliases as secondary addresses.
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r--proto/ospf/ospf.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 6aedb2a..486ddbf 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -155,7 +155,7 @@ wait_timer_hook(timer *timer)
{
debug(" OSPF: Changing state into DR.\n");
ifa->state=OSPF_IS_DR;
- ifa->drip=ifa->iface->ip;
+ ifa->drip=ifa->iface->addr->ip;
/* FIXME: Set ifa->drid */
}
else
@@ -221,7 +221,7 @@ find_iface(struct proto_ospf *p, struct iface *what)
}
void
-ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface *old)
+ospf_if_notify(struct proto *p, unsigned flags, struct iface *iface)
{
struct ospf_iface *ifa;
sock *mcsk, *newsk;
@@ -231,13 +231,15 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface
c=(struct ospf_config *)(p->cf);
DBG(" OSPF: If notify called\n");
+ if (iface->flags & IF_IGNORE)
+ return;
- if((flags & IF_CHANGE_UP) && is_good_iface(p, new))
+ if((flags & IF_CHANGE_UP) && is_good_iface(p, iface))
{
- debug(" OSPF: using interface %s.\n", new->name);
+ debug(" OSPF: using interface %s.\n", iface->name);
/* FIXME: Latter I'll use config - this is incorrect */
ifa=mb_alloc(p->pool, sizeof(struct ospf_iface));
- ifa->iface=new;
+ ifa->iface=iface;
add_tail(&((struct proto_ospf *)p)->iface_list, NODE ifa);
ospf_iface_default(ifa);
/* FIXME: This should read config */
@@ -253,17 +255,17 @@ ospf_if_notify(struct proto *p, unsigned flags, struct iface *new, struct iface
if(flags & IF_CHANGE_DOWN)
{
- if((ifa=find_iface((struct proto_ospf *)p, old))!=NULL)
+ if((ifa=find_iface((struct proto_ospf *)p, iface))!=NULL)
{
- debug(" OSPF: killing interface %s.\n", old->name);
+ debug(" OSPF: killing interface %s.\n", iface->name);
}
}
if(flags & IF_CHANGE_MTU)
{
- if((ifa=find_iface((struct proto_ospf *)p, old))!=NULL)
+ if((ifa=find_iface((struct proto_ospf *)p, iface))!=NULL)
{
- debug(" OSPF: changing MTU on interface %s.\n", old->name);
+ debug(" OSPF: changing MTU on interface %s.\n", iface->name);
}
}
}
@@ -321,6 +323,4 @@ struct protocol proto_ospf = {
start: ospf_start,
preconfig: ospf_preconfig,
postconfig: ospf_postconfig,
-
};
-