Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!CUNIXC.COLUMBIA.EDU!cck
From: cck@CUNIXC.COLUMBIA.EDU (Charlie C. Kim)
Newsgroups: comp.protocols.appletalk
Subject: Re: Hayes InterBridge and KIP 01/88 problem.
Message-ID: <8805111846.AA03360@columbia.edu>
Date: 11 May 88 18:42:23 GMT
References: 
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 126

KIP 01/88's zip query handling is messed up.  My fault: this got
introducted when the code was made to handle long and short ddp in
zipinput.  The patch follows.

The patch also fixes another minor problem where the count returned
might have been incorrect.  It has been tested against Kinetic's
ethertalk gateway and Pacer's VMS gateway.  (By the way, Pacer does
the same thing as AlisaTalk -- it setups a an AppleTalk Bridge to
front end the VMS system).

Charlie C. Kim
User Services
Columbia University

%%%%%%%START OF PATCH%%%%%%%%%%
*** /tmp/,RCSt1024362	Wed May 11 14:38:33 1988
--- rtmp.c	Tue May 10 17:02:39 1988
***************
*** 588,594
    /* else pure ZIP */
    if (ddp.type != ddpZIP)
      goto drop;
!   z = (struct ZIP *)ip->p_off+lapSize+ddpSize;
    if (z->command == zipQuery)
      goto query;
  #ifdef notdef

--- 588,594 -----
    /* else pure ZIP */
    if (ddp.type != ddpZIP)
      goto drop;
!   z = (struct ZIP *)(ip->p_off+lapSize+ddpSize);
    if (z->command == zipQuery)
      goto query;
  #ifdef notdef
***************
*** 602,608
      goto drop;
    po = op->p_off + lapSize + ddpSize + sizeof(struct ZIP);
    sp = (u_short *)(z+1);
!   for (count = 0, len = 0 ; count < z->count && len < 512 ; count++) {
      u.s = i = *sp++;		/* network */
      for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar)
        if (i == ar->net && ar->zone)

--- 602,608 -----
      goto drop;
    po = op->p_off + lapSize + ddpSize + sizeof(struct ZIP);
    sp = (u_short *)(z+1);
!   for (j=0, count = 0, len = 0 ; j < z->count && len < 512 ; j++) {
      u.s = i = *sp++;		/* network */
      for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar) {
        if (i == ar->net && ar->zone)
***************
*** 604,610
    sp = (u_short *)(z+1);
    for (count = 0, len = 0 ; count < z->count && len < 512 ; count++) {
      u.s = i = *sp++;		/* network */
!     for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar)
        if (i == ar->net && ar->zone)
  	break;
      if (ar >= &aroute[NAROUTE])

--- 604,610 -----
    sp = (u_short *)(z+1);
    for (j=0, count = 0, len = 0 ; j < z->count && len < 512 ; j++) {
      u.s = i = *sp++;		/* network */
!     for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar) {
        if (i == ar->net && ar->zone)
  	break;
      }
***************
*** 607,612
      for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar)
        if (i == ar->net && ar->zone)
  	break;
      if (ar >= &aroute[NAROUTE])
        continue;			/* no match */
      pi = azone[ar->zone];

--- 607,613 -----
      for (ar = &aroute[0]; ar < &aroute[NAROUTE] ; ++ar) {
        if (i == ar->net && ar->zone)
  	break;
+     }
      if (ar >= &aroute[NAROUTE])
        continue;			/* no match */
      count++;			/* found one */
***************
*** 609,614
  	break;
      if (ar >= &aroute[NAROUTE])
        continue;			/* no match */
      pi = azone[ar->zone];
      *po++ = u.c[0];		/* copy in network */
      *po++ = u.c[1];

--- 610,616 -----
      }
      if (ar >= &aroute[NAROUTE])
        continue;			/* no match */
+     count++;			/* found one */
      pi = azone[ar->zone];
      *po++ = u.c[0];		/* copy in network */
      *po++ = u.c[1];
***************
*** 613,620
      *po++ = u.c[0];		/* copy in network */
      *po++ = u.c[1];
      bcopy(pi, po, *pi + 1);	/* copy in zone */
!     po += (*pi + 1);
!     len += (*pi + 3);
    }
    z = (struct ZIP *)(op->p_off + lapSize + ddpSize);
    z->command = zipReply;

--- 615,622 -----
      *po++ = u.c[0];		/* copy in network */
      *po++ = u.c[1];
      bcopy(pi, po, *pi + 1);	/* copy in zone */
!     po += (*pi + 1);		/* string + count */
!     len += (*pi + 3);		/* string + count + netnumber */
    }
    z = (struct ZIP *)(op->p_off + lapSize + ddpSize);
    z->command = zipReply;
%%%%%%%END OF PATCH%%%%%%%%%%