summaryrefslogtreecommitdiffstats
path: root/nest/rt-dev.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 /nest/rt-dev.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 'nest/rt-dev.c')
-rw-r--r--nest/rt-dev.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index d6035f5..1225f1d 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -19,19 +19,18 @@
#include "lib/resource.h"
static void
-dev_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old)
+dev_ifa_notify(struct proto *p, unsigned c, struct ifa *ad)
{
struct rt_dev_config *P = (void *) p->cf;
- if (old && !iface_patt_match(&P->iface_list, old) ||
- new && !iface_patt_match(&P->iface_list, new))
+ if (!iface_patt_match(&P->iface_list, ad->iface))
return;
if (c & IF_CHANGE_DOWN)
{
net *n;
- debug("dev_if_notify: %s going down\n", old->name);
- n = net_find(p->table, old->prefix, old->pxlen);
+ DBG("dev_if_notify: %s:%I going down\n", ad->iface->name, ad->ip);
+ n = net_find(p->table, ad->prefix, ad->pxlen);
if (!n)
{
debug("dev_if_notify: device shutdown: prefix not found\n");
@@ -45,20 +44,20 @@ dev_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old)
net *n;
rte *e;
- debug("dev_if_notify: %s going up\n", new->name);
+ debug("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
bzero(&A, sizeof(A));
A.proto = p;
A.source = RTS_DEVICE;
- A.scope = (new->flags & IF_LOOPBACK) ? SCOPE_HOST : SCOPE_UNIVERSE;
+ A.scope = ad->scope;
A.cast = RTC_UNICAST;
A.dest = RTD_DEVICE;
- A.iface = new;
+ A.iface = ad->iface;
A.attrs = NULL;
a = rta_lookup(&A);
- if (new->flags & IF_UNNUMBERED)
- n = net_get(p->table, new->opposite, new->pxlen);
+ if (ad->flags & IF_UNNUMBERED)
+ n = net_get(p->table, ad->opposite, ad->pxlen);
else
- n = net_get(p->table, new->prefix, new->pxlen);
+ n = net_get(p->table, ad->prefix, ad->pxlen);
e = rte_get_temp(a);
e->net = n;
e->pflags = 0;
@@ -71,7 +70,7 @@ dev_init(struct proto_config *c)
{
struct proto *p = proto_new(c, sizeof(struct proto));
- p->if_notify = dev_if_notify;
+ p->ifa_notify = dev_ifa_notify;
return p;
}