From 9a158361da249e0eab1e0f7bd2c7dbe9f32eddfa Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 6 May 1999 21:38:11 +0000 Subject: 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. --- proto/rip/rip.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'proto/rip') diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 24d2e82..f7978ce 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 ); } -- cgit v1.2.3