summaryrefslogtreecommitdiffstats
path: root/usr.sbin/IPXrouted/sap_input.c
diff options
context:
space:
mode:
authorjhay <jhay@FreeBSD.org>1997-07-06 07:38:36 +0000
committerjhay <jhay@FreeBSD.org>1997-07-06 07:38:36 +0000
commit18fa8ff2b470b736a50fb803e1e891bc2f4d247b (patch)
tree99ed7bad5d7b247fd7423644806e43dc4dc3a8dc /usr.sbin/IPXrouted/sap_input.c
parent60f787e21f64c5425b302b242c9a638f55ebb6ad (diff)
downloadFreeBSD-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/sap_input.c')
-rw-r--r--usr.sbin/IPXrouted/sap_input.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/usr.sbin/IPXrouted/sap_input.c b/usr.sbin/IPXrouted/sap_input.c
index c55d82f..26130fe 100644
--- a/usr.sbin/IPXrouted/sap_input.c
+++ b/usr.sbin/IPXrouted/sap_input.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: sap_input.c,v 1.4 1997/02/22 16:00:59 peter Exp $
*/
/*
@@ -45,10 +45,11 @@ sap_input(from, size)
struct sockaddr *from;
int size;
{
+ int newsize;
+ int sapchanged = 0;
struct sap_entry *sap;
struct sap_info *n;
struct interface *ifp = 0;
- int newsize;
struct afswitch *afp;
struct sockaddr_ipx *ipxp;
@@ -106,7 +107,7 @@ sap_input(from, size)
if (ftrace)
fprintf(ftrace, "Received a sap REQ packet.\n");
- sap_supply(from, 0, ifp, n->ServType);
+ sap_supply(from, 0, ifp, n->ServType, 0);
return;
case SAP_RESP_NEAR:
@@ -128,9 +129,24 @@ sap_input(from, size)
for (; size > 0; size -= sizeof (struct sap_info), n++) {
if (size < sizeof (struct netinfo))
break;
+ /*
+ * The idea here is that if the hop count is more
+ * than INFINITY it is bogus and should be discarded.
+ * If it is equal to INFINITY it is a message to say
+ * that a service went down. If we don't allready
+ * have it in our tables discard it. Otherwise
+ * update our table and set the timer to EXPIRE_TIME
+ * so that it is removed next time we go through the
+ * tables.
+ */
+ if (ntohs(n->hops) > HOPCNT_INFINITY)
+ continue;
sap = sap_lookup(n->ServType, n->ServName);
if (sap == 0) {
+ if (ntohs(n->hops) == HOPCNT_INFINITY)
+ continue;
sap_add(n, from);
+ sapchanged = 1;
continue;
}
@@ -145,8 +161,6 @@ sap_input(from, size)
* Update if from gateway and different,
* from anywhere and less hops or
* getting stale and equivalent.
- *
- * XXX I don't think this is quite right yet.
*/
if (((ifp != sap->ifp) ||
!equal(&sap->source, from)) &&
@@ -167,15 +181,32 @@ sap_input(from, size)
}
continue;
}
- if (((ifp == sap->ifp) &&
- equal(&sap->source, from) &&
- (n->hops != sap->sap.hops)) ||
- (ntohs(n->hops) < ntohs(sap->sap.hops)) ||
- (sap->timer > (EXPIRE_TIME*2/3) &&
- ntohs(sap->sap.hops) == ntohs(n->hops))) {
+ if ((ifp == sap->ifp) &&
+ equal(&sap->source, from) &&
+ (ntohs(n->hops) == ntohs(sap->sap.hops)))
+ sap->timer = 0;
+ else if (((ifp == sap->ifp) &&
+ equal(&sap->source, from) &&
+ (n->hops != sap->sap.hops)) ||
+ (ntohs(n->hops) < ntohs(sap->sap.hops)) ||
+ (sap->timer > (EXPIRE_TIME*2/3) &&
+ ntohs(sap->sap.hops) == ntohs(n->hops) &&
+ ntohs(n->hops) != HOPCNT_INFINITY)) {
sap_change(sap, n, from);
+ sapchanged = 1;
}
}
+ if (sapchanged) {
+ register struct sap_entry *sap;
+ register struct sap_hash *sh;
+ sap_supply_toall(1);
+
+ for (sh = sap_head; sh < &sap_head[SAPHASHSIZ]; sh++)
+ for (sap = sh->forw;
+ sap != (struct sap_entry *)sh;
+ sap = sap->forw)
+ sap->state &= ~RTS_CHANGED;
+ }
return;
}
}
OpenPOWER on IntegriCloud