diff options
author | jhay <jhay@FreeBSD.org> | 1997-07-06 07:38:36 +0000 |
---|---|---|
committer | jhay <jhay@FreeBSD.org> | 1997-07-06 07:38:36 +0000 |
commit | 18fa8ff2b470b736a50fb803e1e891bc2f4d247b (patch) | |
tree | 99ed7bad5d7b247fd7423644806e43dc4dc3a8dc /usr.sbin/IPXrouted/input.c | |
parent | 60f787e21f64c5425b302b242c9a638f55ebb6ad (diff) | |
download | FreeBSD-src-18fa8ff2b470b736a50fb803e1e891bc2f4d247b.zip FreeBSD-src-18fa8ff2b470b736a50fb803e1e891bc2f4d247b.tar.gz |
Major IPXrouted rework.
In rt_change() remember to update the interface pointer otherwise we will
send the RIP packets to the wrong interface(s) in future.
Update the hash generator and increase the size of the hash tables.
Only use the network and host parts when comparing IPX interface addresses.
Immediately broadscast RIP and SAP changes.
Change the alarm code to use the setitimer() call and only set a flag in
the alarm signal handler. This gets rid of possible race conditions.
Remove the host routing table. IPX RIP cannot do host routes, only net routes.
Make the delay between broadcast packets 50ms. It seems that some Netware
4.x servers is very slow and don't have much input buffering.
Handle received messages about networks and services that go down, better.
Add tracing of RIP and SAP changes. It gets sysloged with a level of
LOG_DEBUG.
Diffstat (limited to 'usr.sbin/IPXrouted/input.c')
-rw-r--r-- | usr.sbin/IPXrouted/input.c | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/usr.sbin/IPXrouted/input.c b/usr.sbin/IPXrouted/input.c index cf54e89..a9e2f39 100644 --- a/usr.sbin/IPXrouted/input.c +++ b/usr.sbin/IPXrouted/input.c @@ -35,7 +35,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: input.c,v 1.5 1997/02/22 16:00:56 peter Exp $ */ #ifndef lint @@ -69,10 +69,11 @@ rip_input(from, size) struct sockaddr *from; int size; { + int newsize; + int rtchanged = 0; struct rt_entry *rt; struct netinfo *n; struct interface *ifp = 0; - int newsize; struct afswitch *afp; struct sockaddr_ipx *ipxp; @@ -116,7 +117,7 @@ rip_input(from, size) if (ipx_neteqnn(n->rip_dst, ipx_anynet) && ntohs(n->rip_metric) == HOPCNT_INFINITY && size == 0) { - supply(from, 0, ifp); + supply(from, 0, ifp, 0); return; } /* @@ -195,9 +196,10 @@ rip_input(from, size) /* are we talking to ourselves? */ if ((ifp = if_ifwithaddr(from)) != 0) { rt = rtfind(from); - if (rt == 0 || (rt->rt_state & RTS_INTERFACE) == 0) + if (rt == 0 || (rt->rt_state & RTS_INTERFACE) == 0) { addrouteforif(ifp); - else + rtchanged = 1; + } else rt->rt_timer = 0; return; } @@ -211,17 +213,21 @@ rip_input(from, size) } else if ((ifp = if_ifwithdstaddr(from)) != 0) { if(ftrace) fprintf(ftrace, "Got partner\n"); addrouteforif(ifp); + rtchanged = 1; } for (; size > 0; size -= sizeof (struct netinfo), n++) { struct sockaddr *sa; if (size < sizeof (struct netinfo)) break; - if ((unsigned) ntohs(n->rip_metric) >= HOPCNT_INFINITY) + if ((unsigned) ntohs(n->rip_metric) > HOPCNT_INFINITY) continue; rt = rtfind(sa = ipx_nettosa(n->rip_dst)); if (rt == 0) { + if (ntohs(n->rip_metric) == HOPCNT_INFINITY) + continue; rtadd(sa, from, ntohs(n->rip_metric), ntohs(n->rip_ticks), 0); + rtchanged = 1; continue; } @@ -237,12 +243,11 @@ rip_input(from, size) * from anywhere and less ticks or * if same ticks and shorter, * or getting stale and equivalent. - * - * XXX I don't think this is quite right. */ if (!equal(from, &rt->rt_router) && - ntohs(n->rip_ticks == rt->rt_ticks) && - ntohs(n->rip_metric == rt->rt_metric)) { + ntohs(n->rip_ticks) == rt->rt_ticks && + ntohs(n->rip_metric) == rt->rt_metric && + ntohs(n->rip_metric) != HOPCNT_INFINITY) { register struct rt_entry *trt = rt->rt_clone; while (trt) { @@ -266,16 +271,34 @@ rip_input(from, size) ((ntohs(n->rip_ticks) == rt->rt_ticks) && (ntohs(n->rip_metric) < rt->rt_metric)) || (rt->rt_timer > (EXPIRE_TIME*2/3) && - rt->rt_metric == ntohs(n->rip_metric))) { + rt->rt_metric == ntohs(n->rip_metric) && + ntohs(n->rip_metric) != HOPCNT_INFINITY)) { rtchange(rt, from, ntohs(n->rip_metric), ntohs(n->rip_ticks)); - rt->rt_timer = 0; + if (ntohs(n->rip_metric) == HOPCNT_INFINITY) + rt->rt_timer = EXPIRE_TIME; + else + rt->rt_timer = 0; + rtchanged = 1; } else if (equal(from, &rt->rt_router) && (ntohs(n->rip_ticks) == rt->rt_ticks) && - (ntohs(n->rip_metric) == rt->rt_metric)) { + (ntohs(n->rip_metric) == rt->rt_metric) && + (ntohs(n->rip_metric) != HOPCNT_INFINITY)) { rt->rt_timer = 0; } } + if (rtchanged) { + register struct rthash *rh; + register struct rt_entry *rt; + + toall(supply, NULL, 1); + for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++) + for (rt = rh->rt_forw; + rt != (struct rt_entry *)rh; + rt = rt->rt_forw) + rt->rt_state &= ~RTS_CHANGED; + } + return; } } |