diff options
author | Martin Mares <mj@ucw.cz> | 1999-05-06 21:38:11 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-05-06 21:38:11 +0000 |
commit | 9a158361da249e0eab1e0f7bd2c7dbe9f32eddfa (patch) | |
tree | 4d9dff14fd053aaa2d45be859144148eb8851a4d /proto/rip | |
parent | ec8b579e9c9703601bf745745b620103fe2e2477 (diff) |
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/rip')
-rw-r--r-- | proto/rip/rip.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 24d2e82b..f7978ce2 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -491,9 +491,9 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags) if (want_multicast) rif->sock->daddr = ipa_from_u32(0x7f000001); /* FIXME: must lookup address in rfc's */ if (flags & IF_BROADCAST) - rif->sock->daddr = new->brd; + rif->sock->daddr = new->addr->brd; if (flags & IF_UNNUMBERED) - rif->sock->daddr = new->opposite; + rif->sock->daddr = new->addr->opposite; if (!ipa_nonzero(rif->sock->daddr)) log( L_WARN "RIP: interface %s is too strange for me", rif->iface ? rif->iface->name : "(dummy)" ); @@ -507,24 +507,26 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags) } static void -rip_if_notify(struct proto *p, unsigned c, struct iface *new, struct iface *old) +rip_if_notify(struct proto *p, unsigned c, struct iface *iface) { DBG( "RIP: if notify\n" ); - if (old) { + if (iface->flags & IF_IGNORE) + return; + if (c & IF_CHANGE_DOWN) { struct rip_interface *i; - i = find_interface(p, old); + i = find_interface(p, iface); if (i) { rem_node(NODE i); kill_iface(p, i); } } - if (new) { + if (c & IF_CHANGE_UP) { struct rip_interface *rif; - struct iface_patt *k = iface_patt_match(&P_CF->iface_list, new); + struct iface_patt *k = iface_patt_match(&P_CF->iface_list, iface); if (!k) return; /* We are not interested in this interface */ - DBG("adding interface %s\n", new->name ); - rif = new_iface(p, new, new->flags); + DBG("adding interface %s\n", iface->name ); + rif = new_iface(p, iface, iface->flags); rif->patt = (void *) k; add_head( &P->interfaces, NODE rif ); } |