[comp.protocols.appletalk] atalkad patch for SPARCstation 1

hops@gmdzi.UUCP (Peter Seuffert) (09/29/89)

This week we got some SPARCs and we did a quick&dirty hack to the
KFPS boot daemon "atalkad.c" of KIP-Release KIP0688 to run it on the SPARC.
Works OK.

Would any kind soul mail the patch files "at-kip-align.shar" to me ???
I missed them on USENET.
Thanks

Peter


------------------------------------------------------------------------------
Mail:   Peter Seuffert
	c/o German National Research Center for Computer Science (GMD)
	Schloss Birlinghoven
	Postfach 1240
	D-5205 St.Augustin 1
	FRG
Phone: (++49 2241) 142868
Fax:   (++49 2241) 142084
Email:  hops@gmdzi.gmd.de or
	...!{uunet|mcavx}!unido!gmdzi!hops
------------------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#               "End of shell archive."
# Contents:  atalkad.SPARC.diff
# Wrapped by hops@f3svb on Fri Sep 29 09:04:00 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'atalkad.SPARC.diff' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'atalkad.SPARC.diff'\"
else
echo shar: Extracting \"'atalkad.SPARC.diff'\" \(11289 characters\)
sed "s/^X//" >'atalkad.SPARC.diff' <<'END_OF_FILE'
X*** atalkad.c  Wed Sep  6 11:29:45 1989
X--- atalkad.c.SPARC1   Fri Sep 29 08:58:27 1989
X***************
X*** 130,135 ****
X--- 130,143 ----
X    exit(1);
X  }
X
X+ static char *innethac(laddr) iaddr_t laddr; {
X+      struct in_addr iaddr;
X+      char *inet_ntoa();
X+
X+      iaddr.s_addr = laddr;
X+      return(inet_ntoa(iaddr));
X+ }
X+
X  main(argc, argv)
X       char *argv[];
X  {
X***************
X*** 268,292 ****
X                           (an->flags & arouteKbox) &&
X                           (an->flags & arouteEtalk) == 0)
X                               goto found;
X!              log("aaCONF from %s ***** not in table", inet_ntoa(aa.ipaddr));
X               return;
X  found:
X!              log("aaCONF to %s", inet_ntoa(aa.ipaddr));
X               n = an->confsize;
X               bcopy(an->conf, aa.stuff, n);
X               break;
X       case aaZONE:
X!              log("aaZONE to %s", inet_ntoa(aa.ipaddr));
X               n = azoneslen;
X               bcopy(azones, aa.stuff, n);
X               break;
X       case aaZONEQ:
X!              log("aaZONEq from %s", inet_ntoa(aa.ipaddr));
X               if ((n = zipinput()) <= 0)
X                 return;       /* drop */
X               break;
X       case aaROUTEI:
X!              log("aaROUTEI to %s", inet_ntoa(aa.ipaddr));
X               n = arouteslen;
X               bcopy(aroutes, aa.stuff, n);
X               break;
X--- 276,300 ----
X                           (an->flags & arouteKbox) &&
X                           (an->flags & arouteEtalk) == 0)
X                               goto found;
X!              log("aaCONF from %s ***** not in table", innethac(aa.ipaddr));
X               return;
X  found:
X!              log("aaCONF to %s", innethac(aa.ipaddr));
X               n = an->confsize;
X               bcopy(an->conf, aa.stuff, n);
X               break;
X       case aaZONE:
X!              log("aaZONE to %s", innethac(aa.ipaddr));
X               n = azoneslen;
X               bcopy(azones, aa.stuff, n);
X               break;
X       case aaZONEQ:
X!              log("aaZONEq from %s", innethac(aa.ipaddr));
X               if ((n = zipinput()) <= 0)
X                 return;       /* drop */
X               break;
X       case aaROUTEI:
X!              log("aaROUTEI to %s", innethac(aa.ipaddr));
X               n = arouteslen;
X               bcopy(aroutes, aa.stuff, n);
X               break;
X***************
X*** 369,375 ****
X      putchar('\n');
X      if ((an->flags & arouteKbox) && (an->flags & arouteEtalk) == 0) {
X        conf = (struct conf *)an->conf;
X!       printf("\tIP Broadcast: %s, ", inet_ntoa(conf->ipbroad));
X        if (conf->ipname == conf->ipdebug) {
X       printf("IP name and debug: %s\n", hostnameof(conf->ipname));
X       printf("\tIP file server (unused)", hostnameof(conf->ipfile));
X--- 377,383 ----
X      putchar('\n');
X      if ((an->flags & arouteKbox) && (an->flags & arouteEtalk) == 0) {
X        conf = (struct conf *)an->conf;
X!       printf("\tIP Broadcast: %s, ", innethac(conf->ipbroad));
X        if (conf->ipname == conf->ipdebug) {
X       printf("IP name and debug: %s\n", hostnameof(conf->ipname));
X       printf("\tIP file server (unused)", hostnameof(conf->ipfile));
X***************
X*** 407,414 ****
X       re = rs = ntohl(an->iaddr)+1;
X       re += (ntohs(conf->ipstatic)-1);
X       printf("\tIP static address range: %s",
X!             inet_ntoa(htonl(rs)));
X!      printf(" %s\n",inet_ntoa(htonl(re)));
X        } else {
X       printf("\tIP static address range: empty\n");
X       re = ntohl(an->iaddr);
X--- 415,422 ----
X       re = rs = ntohl(an->iaddr)+1;
X       re += (ntohs(conf->ipstatic)-1);
X       printf("\tIP static address range: %s",
X!             innethac(htonl(rs)));
X!      printf(" %s\n",innethac(htonl(re)));
X        } else {
X       printf("\tIP static address range: empty\n");
X       re = ntohl(an->iaddr);
X***************
X*** 417,424 ****
X       re = rs = re+1;
X       re += (ntohs(conf->ipdynamic)-1);
X       printf("\tIP dynamic address range: %s",
X!             inet_ntoa(htonl(rs)));
X!      printf(" %s\n",inet_ntoa(htonl(re)));
X        } else {
X       printf("\tIP dynamic address range: empty\n");
X       re = ntohl(an->iaddr);
X--- 425,432 ----
X       re = rs = re+1;
X       re += (ntohs(conf->ipdynamic)-1);
X       printf("\tIP dynamic address range: %s",
X!             innethac(htonl(rs)));
X!      printf(" %s\n",innethac(htonl(re)));
X        } else {
X       printf("\tIP dynamic address range: empty\n");
X       re = ntohl(an->iaddr);
X***************
X*** 443,470 ****
X   * Return byte count of tuples deposited.
X   */
X  buildart(at, maxsize)
X!      register struct arouteTuple *at;
X       int maxsize;
X  {
X!      register struct anets *an;
X!      register n, size;
X!
X       size = 0;
X       for (an = &anets[0], n = 0 ; n < nanets ; an++, n++, at++) {
X!              size += sizeof *at;
X               at->node = an->iaddr;
X               at->net = an->net;
X               at->flags = an->flags;
X               at->hops = 0; /* start at one - incremented in gateway */
X       }
X!      log("art build: %d bytes, %d entries, %d maximum",
X!          size, size/(sizeof(struct arouteTuple)),
X!          maxsize/(sizeof(struct arouteTuple)));
X       if (size > maxsize)
X               log("art build: routing table too big!!");
X!      if (size > (maxsize - 10) )
X!              log("art build: routing table size %d is near maximum of %d",
X!                  size, maxsize );
X       return (size);
X  }
X
X--- 451,481 ----
X   * Return byte count of tuples deposited.
X   */
X  buildart(at, maxsize)
X!      struct arouteTuple *at;
X       int maxsize;
X  {
X!      struct anets *an;
X!      int n, size, inc;
X       size = 0;
X+      inc = sizeof( struct arouteTuple);
X       for (an = &anets[0], n = 0 ; n < nanets ; an++, n++, at++) {
X!              size += inc;
X               at->node  = an->iaddr;
X               at->net   = an->net;
X               at->flags = an->flags;
X               at->hops  = 0;          /* start at one - incremented in gateway */
X       }
X!      log("art build: %d bytes",  size);
X!      log("art build: %d entries",size/(sizeof(struct arouteTuple)));
X!      log("art build: %d maximum",maxsize/(sizeof(struct arouteTuple)));
X       if (size > maxsize)
X               log("art build: routing table too big!!");
X!      if (size > (maxsize - 10) ) {
X!              log("art build: routing table size %d ",
X!                  size);
X!              log("art build: ... is near maximum of %d",
X!                  maxsize );
X!      }
X       return (size);
X  }
X
X***************
X*** 526,535 ****
X       if (n > sizeof(azones)) {
X         log("buildzones: ZIP table too large");
X        log("buildzones: don't worry if you are using a KIP later than 1/88");
X!      } else if (n > (sizeof(azones)-10))
X!        log("buildzones: ZIP table size %d approaching maximum of %d",
X!            n, sizeof(azones));
X       log("zone names take %d bytes in gateway", n);
X       return (n);
X  }
X
X--- 537,547 ----
X       if (n > sizeof(azones)) {
X         log("buildzones: ZIP table too large");
X         log("buildzones: don't worry if you are using a KIP later than 1/88");
X!      } else if (n > (sizeof(azones)-10))  {
X!        log("buildzones: ZIP table size %d", n);
X!        log("buildzones: ... approaching maximum of %d", sizeof(azones));
X         log("zone names take %d bytes in gateway", n);
X+         }
X       return (n);
X  }
X
X***************
X*** 583,589 ****
X                                       continue;
X                               }
X                               log("no response from %s",
X!                                  inet_ntoa(an->iaddr));
X                               break;
X                       }
X                       fsinlen = sizeof fsin;
X--- 595,601 ----
X                                       continue;
X                               }
X                               log("no response from %s",
X!                                  innethac(an->iaddr));
X                               break;
X                       }
X                       fsinlen = sizeof fsin;
X***************
X*** 742,748 ****
X                       case '0': case '1': case '2': case '3':
X                               i |= (*cpp - '0');  break;
X                       default:
X!                              log("bad switch %s, linenum %d", st, linenum);
X                       }
X               }
X               an->flags = i;
X--- 754,761 ----
X                       case '0': case '1': case '2': case '3':
X                               i |= (*cpp - '0');  break;
X                       default:
X!                              log("bad switch %s ", st);
X!                              log("... linenum %d", linenum);
X                       }
X               }
X               an->flags = i;
X***************
X*** 783,795 ****
X                               (char*)&conf_proto.atneta-(char*)&conf_proto)
X                             flag = arouteKbox;
X                           else {
X!                            log("%%N at unexpected offset %d, line %d\n",
X!                                cp - an->conf, linenum);
X                             flag = arouteKbox;
X                           }
X
X!                          if ((*(short *)cp =
X!                               getanet(flag, an->iaddr)) == 0)
X                             log("%%N not set, line %d\n", linenum);
X                           cp += 2;
X                           an->confsize += 2;
X--- 796,807 ----
X                               (char*)&conf_proto.atneta-(char*)&conf_proto)
X                             flag = arouteKbox;
X                           else {
X!                            log("%%N at unexpected offset %d", cp - an->conf);
X!                            log("... line %d\n", linenum);
X                             flag = arouteKbox;
X                           }
X
X!                          if ((*(short *)cp=getanet(flag,an->iaddr)) == 0)
X                             log("%%N not set, line %d\n", linenum);
X                           cp += 2;
X                           an->confsize += 2;
X***************
X*** 796,802 ****
X                           break;
X
X                         default:
X!                          log("bad field type %s, linenum %d", st, linenum);
X                           break;
X                         }
X                         break;
X--- 808,815 ----
X                           break;
X
X                         default:
X!                          log("bad field type %s", st);
X!                          log("... linenum %d", linenum);
X                           break;
X                         }
X                         break;
X***************
X*** 852,865 ****
X                               break;
X
X                       default:
X!                              log("bad field type %s, linenum %d",
X!                                      st, linenum);
X                               break;
X                       }
X                       continue;       /* get next field in line */
X  badalign:
X!                      log("long/short bad alignment %s, linenum %d",
X!                              st, linenum);
X                       break;
X               }
X               /* get next line */
X--- 865,878 ----
X                               break;
X
X                       default:
X!                              log("bad field type %s", st);
X!                              log("... linenum %d", linenum);
X                               break;
X                       }
X                       continue;       /* get next field in line */
X  badalign:
X!                      log("long/short bad alignment %s,", st);
X!                      log("... linenum %d", linenum);
X                       break;
X               }
X               /* get next line */
X***************
X*** 905,911 ****
X               *cp++ = *linep;
X               if (--len <= 0) {
X                       *cp = 0;
X!                      log("string truncated: %s, linenum %d", str, linenum);
X                       return;
X               }
X       }
X--- 918,925 ----
X               *cp++ = *linep;
X               if (--len <= 0) {
X                       *cp = 0;
X!                      log("string truncated: %s,", str);
X!                      log("... linenum %d", linenum);
X                       return;
X               }
X       }
X***************
X*** 930,937 ****
X       } else {
X               c = "%d";
X       }
X!      if (sscanf(s, c, &v) != 1)
X!              log("bad numeric field %s, linenum %d", s, linenum);
X       return (v);
X  }
X
X--- 944,953 ----
X       } else {
X               c = "%d";
X       }
X!      if (sscanf(s, c, &v) != 1) {
X!              log("bad numeric field %s, ", s);
X!              log("... linenum %d", linenum);
X!              }
X       return (v);
X  }
X
X***************
X*** 947,956 ****
X
X       if (isdigit(*st)) {
X               if ((iaddr = inet_addr(st)) == -1 || iaddr == 0)
X!                      log("bad ipaddress %s, linenum %d", st, linenum);
X       } else {
X!              if ((host = gethostbyname(st)) == 0)
X!                      log("bad hostname %s, linenum %d", st, linenum);
X               bcopy(host->h_addr, (caddr_t)&iaddr, sizeof iaddr);
X       }
X       return (iaddr);
X--- 963,974 ----
X
X       if (isdigit(*st)) {
X               if ((iaddr = inet_addr(st)) == -1 || iaddr == 0)
X!                      log("bad ipaddress %s, ", st);
X       } else {
X!              if ((host = gethostbyname(st)) == 0) {
X!                      log("bad hostname %s, ", st);
X!                      log("... linenum %d", linenum);
X!              }
X               bcopy(host->h_addr, (caddr_t)&iaddr, sizeof iaddr);
X       }
X       return (iaddr);
X***************
X*** 1032,1038 ****
X        a->iaddr == ia))
X        return(a->net);
X    }
X!   log("unable to match appletalk net (%x), line %d\n", flags, linenum);
X    return(0);
X  }
X
X--- 1050,1057 ----
X        a->iaddr == ia))
X        return(a->net);
X    }
X!   log("unable to match appletalk net (%x), ", flags);
X!   log("... line %d\n", linenum);
X    return(0);
X  }
X
X***************
X*** 1046,1060 ****
X    return((a1 & node_mask) == (a2 & node_mask));
X  }
X
X! char *
X! hostnameof(ipaddr)
X! struct in_addr ipaddr;
X! {
X    struct hostent *host;
X
X!   host = gethostbyaddr(&ipaddr.s_addr, sizeof(ipaddr.s_addr), AF_INET);
X!   if (!host)
X!     return((char *)inet_ntoa(ipaddr));
X    return(host->h_name);
X  }
X
X--- 1065,1075 ----
X    return((a1 & node_mask) == (a2 & node_mask));
X  }
X
X! char * hostnameof(ipaddr) iaddr_t ipaddr; {
X    struct hostent *host;
X
X!   host = gethostbyaddr( (char *)&ipaddr, sizeof(ipaddr), AF_INET );
X!   if (!host) return(innethac(ipaddr));
X    return(host->h_name);
X  }
X
END_OF_FILE
if test 11289 -ne `wc -c <'atalkad.SPARC.diff'`; then
    echo shar: \"'atalkad.SPARC.diff'\" unpacked with wrong size!
fi
# end of 'atalkad.SPARC.diff'
fi
echo shar: End of shell archive.
exit 0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++