Patch #: 14 Type: update Priority: none Modification: add support for NetBSD 1.0 Modification: update support for Linux (based on kernel 1.3.96) Submitted: David Hornsby Modification: add support for DEC FDDI (ULTRIX & Digital UNIX) Submitted: Tom King Archived: munnari.OZ.AU mac/cap.patches/arns.patch014 Application: 'cd arns; patch -p < arns.patch014' *** aarp.c.orig Thu May 19 16:54:46 1994 --- aarp.c Sun May 19 21:28:49 1996 *************** *** 15,21 **** * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.3 $ * */ --- 15,21 ---- * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.4 $ * */ *************** *** 93,98 **** --- 93,108 ---- srcNode = pkt[17]; function = (pkt[6] << 8) | pkt[7]; + + #ifdef linux + /* + * 1.3.96 kernel reverses function bytes + * + */ + if (ntohs(function) >= AARPReq + && ntohs(function) <= AARPProbe) + function = ntohs(function); + #endif /* linux */ switch (function) { case AARPProbe: *** arns.c.orig Sat Dec 17 17:06:05 1994 --- arns.c Sun May 19 21:28:53 1996 *************** *** 15,21 **** * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.10 $ * */ --- 15,21 ---- * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.11 $ * */ *************** *** 780,786 **** user = data + strlen(data) + 1; if ((pw = getpwnam(user)) == NULL) return(1); ! return(strcmp(crypt(data, pw->pw_passwd), pw->pw_passwd)); break; default: return(1); --- 780,786 ---- user = data + strlen(data) + 1; if ((pw = getpwnam(user)) == NULL) return(1); ! return(strcmp((char *)crypt(data, pw->pw_passwd), pw->pw_passwd)); break; default: return(1); *************** *** 824,830 **** struct tm *tm, *localtime(); if (logfile != NULL) { ! tm = localtime(&tn.tv_sec); fprintf(log, "%2d/%02d/%02d %02d:%02d:%02d ", tm->tm_year, tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); fprintf(log, "IP %-15s ", inet_ntoa(from->sin_addr)); --- 824,830 ---- struct tm *tm, *localtime(); if (logfile != NULL) { ! tm = localtime((time_t *)&tn.tv_sec); fprintf(log, "%2d/%02d/%02d %02d:%02d:%02d ", tm->tm_year, tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); fprintf(log, "IP %-15s ", inet_ntoa(from->sin_addr)); *************** *** 875,880 **** --- 875,881 ---- static char name[128]; static unsigned long addr = 0; struct hostent *h, *gethostbyaddr(); + char *inet_ntoa(); if (addr == 0) name[0] = '\0'; *** arnsrd.c.orig Sat May 1 23:50:57 1993 --- arnsrd.c Sun May 19 21:28:55 1996 *************** *** 20,26 **** * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.3 $ * */ --- 20,26 ---- * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.4 $ * */ *************** *** 37,50 **** char *sp, *ep; /* argv/envp space for info */ char *filter; /* name of IP filter list */ ! char *hostname; /* hostname of connected peer */ u_char clntNode; /* node number of ARNS client */ u_char srvrNode; /* node number of ARNS server */ u_char *dataPtr; /* current pointer into ibuf */ u_char ibuf[1024]; /* TCP input buffer (UDP out) */ u_char obuf[1024]; /* TCP output buffer (UDP in) */ ! struct sockaddr_in sin; /* UDP address of server */ struct sockaddr_in min; /* UDP address of relay (me) */ struct timeval timeout; /* select() timeout structure */ struct timeval started; /* time of relay start */ --- 37,51 ---- char *sp, *ep; /* argv/envp space for info */ char *filter; /* name of IP filter list */ ! char hostname[64]; /* hostname of connected peer */ ! u_char clntNode; /* node number of ARNS client */ u_char srvrNode; /* node number of ARNS server */ u_char *dataPtr; /* current pointer into ibuf */ u_char ibuf[1024]; /* TCP input buffer (UDP out) */ u_char obuf[1024]; /* TCP output buffer (UDP in) */ ! struct sockaddr_in lsin; /* UDP address of server */ struct sockaddr_in min; /* UDP address of relay (me) */ struct timeval timeout; /* select() timeout structure */ struct timeval started; /* time of relay start */ *************** *** 64,70 **** int loops; int i, nfds; int fromLen; ! #ifdef SYSTYPE_SYSV void cleanup(); #else /* SYSTYPE_SYSV */ int cleanup(); --- 65,71 ---- int loops; int i, nfds; int fromLen; ! #if (defined(SYSTYPE_SYSV) || defined(linux)) void cleanup(); #else /* SYSTYPE_SYSV */ int cleanup(); *************** *** 133,142 **** ep = envp[-1] + strlen(envp[-1]); /* get name of remote client */ ! if ((h = gethostbyaddr(&from.sin_addr, 4, AF_INET)) == NULL) ! hostname = (char *)inet_ntoa(from.sin_addr); else ! hostname = h->h_name; gettimeofday(&started, NULL); --- 134,143 ---- ep = envp[-1] + strlen(envp[-1]); /* get name of remote client */ ! if ((h = gethostbyaddr((char *)&from.sin_addr, 4, AF_INET)) == NULL) ! strncpy(hostname, (char *)inet_ntoa(from.sin_addr), sizeof(hostname)); else ! strncpy(hostname, (char *)h->h_name, sizeof(hostname)); gettimeofday(&started, NULL); *************** *** 175,184 **** cleanup(); /* arns server address */ ! sin.sin_family = AF_INET; ! sin.sin_addr.s_addr = htonl(0x7f000001); s = getservbyname("arns", "tcp"); ! sin.sin_port = (s == NULL) ? htons(ARNS_PORT) : s->s_port; sendLinkOK(); --- 176,185 ---- cleanup(); /* arns server address */ ! lsin.sin_family = AF_INET; ! lsin.sin_addr.s_addr = htonl(0x7f000001); s = getservbyname("arns", "tcp"); ! lsin.sin_port = (s == NULL) ? htons(ARNS_PORT) : s->s_port; sendLinkOK(); *************** *** 223,228 **** --- 224,234 ---- int fd; { short len; + #if (defined(SYSTYPE_SYSV) || defined(linux)) + void cleanup(); + #else /* SYSTYPE_SYSV */ + int cleanup(); + #endif /* SYSTYPE_SYSV */ if (dataLen == 0) { if ((len = read(fd, &dataLen, sizeof(short))) == sizeof(short)) { *************** *** 245,251 **** if (dataLen == 0) { /* packet complete */ sendto(udpfd, (char *)ibuf, pktLen, 0, ! (struct sockaddr *)&sin, sizeof(sin)); pktsin++; } --- 251,257 ---- if (dataLen == 0) { /* packet complete */ sendto(udpfd, (char *)ibuf, pktLen, 0, ! (struct sockaddr *)&lsin, sizeof(lsin)); pktsin++; } *************** *** 263,268 **** --- 269,279 ---- int fd; { short len; + #if (defined(SYSTYPE_SYSV) || defined(linux)) + void cleanup(); + #else /* SYSTYPE_SYSV */ + int cleanup(); + #endif /* SYSTYPE_SYSV */ if ((len = read(fd, (char *)obuf+2, sizeof(obuf)-2)) == 0) return; *************** *** 336,343 **** */ int ! illegalIP(sin, fromlen) ! struct sockaddr_in *sin; int fromlen; { int i; --- 347,354 ---- */ int ! illegalIP(lsin, fromlen) ! struct sockaddr_in *lsin; int fromlen; { int i; *************** *** 346,352 **** if (filters == 0) return(0); ! addr = sin->sin_addr.s_addr; for (i = 0 ; i < filters ; i++) { if (ipFilter[i].addr != 0L) { --- 357,363 ---- if (filters == 0) return(0); ! addr = lsin->sin_addr.s_addr; for (i = 0 ; i < filters ; i++) { if (ipFilter[i].addr != 0L) { *************** *** 409,415 **** buf[2] = clntNode; buf[3] = CONN_DISCONN; ! sendto(udpfd, buf, 4, 0, (struct sockaddr *)&sin, sizeof(sin)); return; } --- 420,426 ---- buf[2] = clntNode; buf[3] = CONN_DISCONN; ! sendto(udpfd, buf, 4, 0, (struct sockaddr *)&lsin, sizeof(lsin)); return; } *************** *** 474,480 **** * */ ! #ifdef SYSTYPE_SYSV /*ARGSUSED*/ void cleanup(num) --- 485,491 ---- * */ ! #if (defined(SYSTYPE_SYSV) || defined(linux)) /*ARGSUSED*/ void cleanup(num) *** ddp.c.orig Wed Oct 5 13:15:27 1994 --- ddp.c Sun May 19 21:28:58 1996 *************** *** 15,21 **** * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.9 $ * */ --- 15,21 ---- * djh@munnari.OZ.AU * * $Author: djh $ ! * $Revision: 1.10 $ * */ *************** *** 127,132 **** --- 127,148 ---- return; /* drop it */ len = ((pkt[0] & 0x03) << 8) | pkt[1]; + + #ifdef linux + /* + * 1.3.96 kernel sometime reverses length bytes + * this is a temporary hack ... + * + */ + if (pktLen > 60 + && len != (pktLen-22)) { + u_char tmp; + tmp = pkt[0]; + pkt[0] = pkt[1]; + pkt[1] = tmp; + len = ((pkt[0] & 0x03) << 8) | pkt[1]; + } + #endif /* linux */ /* * we need to minimise the traffic over our *** pf.c.orig Sun May 19 22:24:32 1996 --- pf.c Sun May 19 21:29:01 1996 *************** *** 1,11 **** /* * General Purpose AppleTalk Packet Filter Interface * ! * Copyright (c) 1992, The University of Melbourne. ! * All Rights Reserved. Permission to redistribute ! * or use any part of this software for any purpose ! * other than as originally shipped must be obtained ! * in writing from the copyright owner. * * This software is supplied "as is" without express * or implied warranty. --- 1,10 ---- /* * General Purpose AppleTalk Packet Filter Interface * ! * Copyright (c) 1992-1995, The University of Melbourne. ! * All Rights Reserved. Permission to redistribute or ! * use any part of this software for any purpose must ! * be obtained in writing from the copyright owner. * * This software is supplied "as is" without express * or implied warranty. *************** *** 16,21 **** --- 15,21 ---- * SunOS Network InterFace Tap (SNITPF) * DEC ULTRIX Packet Filter (UPFILT) * DEC OSF/Alpha Packet Filter (UPFILT) + * DEC Packet Filter via FDDI (UPFILT_FDDI) * Stanford Ethernet Packet Filter (ENETPF) * Solaris STREAMS Data Link Provider Interface (DLPIPF) * SGI IRIX SNOOP PF for promisc, DRAIN PF for non-promisc *************** *** 26,32 **** * Linux SOCK_PACKET * * $Author: djh $ ! * $Revision: 1.18 $ * */ --- 26,32 ---- * Linux SOCK_PACKET * * $Author: djh $ ! * $Revision: 1.21 $ * */ *************** *** 64,73 **** --- 64,81 ---- #define AIXETH #endif AIX + #ifdef BPFILT + #define NEEDSYSSTROPTS + #endif BPFILT + #ifdef __386BSD__ #define BPFILT #endif __386BSD__ + #ifdef __NetBSD__ + #define BPFILT + #endif __NetBSD__ + #ifdef FreeBSD #define BPFILT #endif FreeBSD *************** *** 90,96 **** --- 98,106 ---- #include #include #include + #ifndef linux #include + #endif linux #include *************** *** 116,128 **** #ifdef BPFILT #include #include ! #if (!(defined(bsdi) || defined(FreeBSD) || defined(__386BSD__))) #include ! #endif /* bsdi || FreeBSD || __386BSD__ */ #endif BPFILT #ifdef UPFILT #include #endif UPFILT #ifdef DLPIPF --- 126,142 ---- #ifdef BPFILT #include #include ! #ifdef NEEDSYSSTROPTS #include ! #endif NEEDSYSSTROPTS #endif BPFILT #ifdef UPFILT #include + #ifdef UPFILT_FDDI + #include + #include + #endif UPFILT_FDDI #endif UPFILT #ifdef DLPIPF *************** *** 162,180 **** #include #endif AIXETH ! #ifndef SOLARIS #include #include ! #endif SOLARIS #ifdef bsdi #include #include #endif bsdi #ifdef linux #include ! #include #endif linux #include --- 176,200 ---- #include #endif AIXETH ! #if (!(defined(SOLARIS) || defined(linux))) #include #include ! #endif SOLARIS || linux ! ! #ifdef __NetBSD__ ! #include ! #include ! #endif __NetBSD__ #ifdef bsdi #include #include + #include #endif bsdi #ifdef linux #include ! #include #endif linux #include *************** *** 245,254 **** --- 265,280 ---- #undef USE_SADDMULTI #endif __386BSD__ + #ifdef __NetBSD__ + #define USE_SIOCGIFCONF + #undef USE_GIFADDR + #endif __NetBSD__ + #ifdef FreeBSD #endif FreeBSD #ifdef bsdi + #define USE_SIOCGIFCONF #undef USE_GIFADDR #endif bsdi *************** *** 262,268 **** */ #define READBUFSIZ 4096 ! #define NUMRDS 32 struct RDS { u_short dataLen; --- 288,294 ---- */ #define READBUFSIZ 4096 ! #define NUMRDS 32 struct RDS { u_short dataLen; *************** *** 287,296 **** u_int pf_bufsize = READBUFSIZ; #endif BPFILT #ifdef linux struct socklist { struct sockaddr sa; ! } socklist[32 /* ZZ */]; #endif linux struct ifreq ifr; --- 313,330 ---- u_int pf_bufsize = READBUFSIZ; #endif BPFILT + #ifdef UPFILT + #ifdef UPFILT_FDDI + int ethtyp[32]; + int onfddi[32]; + #endif UPFILT_FDDI + #endif UPFILT + #ifdef linux struct socklist { + int iflen; struct sockaddr sa; ! } socklist[32]; #endif linux struct ifreq ifr; *************** *** 356,361 **** --- 390,406 ---- perror(interface); return(-1); } + #ifdef UPFILT_FDDI + { struct endevp devParams; + + if (ioctl(s, EIOCDEVP, &devParams) < 0) { + perror(interface); + return(-1); + } + onfddi[s] = (devParams.end_dev_type == ENDT_FDDI); + ethtyp[s] = typ; + } + #endif UPFILT_FDDI #endif UPFILT *************** *** 468,484 **** #ifdef linux { u_short prot; ! prot = ((typ == 2) ? htons(ETH_P_ALL) : htons(protocol)); if ((s = socket(AF_INET, SOCK_PACKET, prot)) < 0) { perror(interface); return(-1); } - /* ZZ */ if (s >= 32) { ! fprintf(stderr, "OOPS: socket() returned %d\n", s); return(-1); } - /* ZZ */ } #endif linux --- 513,527 ---- #ifdef linux { u_short prot; ! prot = ((typ == 2) ? htons(ETH_P_802_2) : htons(protocol)); if ((s = socket(AF_INET, SOCK_PACKET, prot)) < 0) { perror(interface); return(-1); } if (s >= 32) { ! close(s); return(-1); } } #endif linux *************** *** 669,676 **** #ifdef linux ! /* record socket interface name */ strncpy(socklist[s].sa.sa_data, interface, sizeof(socklist[s].sa.sa_data)); #endif linux return(s); --- 712,720 ---- #ifdef linux ! /* record socket interface name and length */ strncpy(socklist[s].sa.sa_data, interface, sizeof(socklist[s].sa.sa_data)); + socklist[s].iflen = strlen(interface); #endif linux return(s); *************** *** 744,752 **** #define s_offset(structp, element) (&(((structp)0)->element)) bzero((char *)&pf, sizeof(pf)); pf.Pf_Priority = 128; ! offset = ((int)s_offset(struct ether_header *, ether_type))/sizeof(u_short); ! if (typ == 2) /* EtherTalk Phase 2 */ ! offset += 4; /* shorts: 2 bytes length + 6 bytes of 802.2 and SNAP */ *fwp++ = ENF_PUSHWORD + offset; *fwp++ = ENF_PUSHLIT | ENF_EQ; *fwp++ = htons(prot); --- 788,809 ---- #define s_offset(structp, element) (&(((structp)0)->element)) bzero((char *)&pf, sizeof(pf)); pf.Pf_Priority = 128; ! #ifdef UPFILT_FDDI ! if (onfddi[s]) { ! /* ! * fddi is always 802 format so have ! * if_fddi header then if_llc header ! * ! */ ! offset = (sizeof(struct fddi_header) + ! (int)s_offset(struct llc *, llc_un.type_snap.ether_type))/sizeof(u_short); ! } else ! #endif UPFILT_FDDI ! { ! offset = ((int)s_offset(struct ether_header *, ether_type))/sizeof(u_short); ! if (typ == 2) /* EtherTalk Phase 2 */ ! offset += 4; /* shorts: 2 bytes length + 6 bytes of 802.2 and SNAP */ ! } *fwp++ = ENF_PUSHWORD + offset; *fwp++ = ENF_PUSHLIT | ENF_EQ; *fwp++ = htons(prot); *************** *** 984,998 **** u_char *addr; { - #ifdef bsdi - return(get_eth_addr(s, interface, addr)); - #endif bsdi - - #ifdef USE_GIFADDR { struct sockaddr *sa; strcpy(ifr.ifr_name, interface); if (ioctl(s, SIOCGIFADDR, &ifr) < 0) { perror("SIOCGIFADDR"); return(-1); --- 1041,1051 ---- u_char *addr; { #ifdef USE_GIFADDR { struct sockaddr *sa; strcpy(ifr.ifr_name, interface); + ifr.ifr_addr.sa_family = AF_UNSPEC; if (ioctl(s, SIOCGIFADDR, &ifr) < 0) { perror("SIOCGIFADDR"); return(-1); *************** *** 1007,1012 **** --- 1060,1110 ---- #endif USE_GIFADDR + #ifdef USE_SIOCGIFCONF + { int len, sock; + struct ifconf ifconf; + struct sockaddr_dl *sadl; + struct ifreq ifrbuf[32], *ifra, *ifrb; + + strcpy(ifr.ifr_name, interface); + ifconf.ifc_len = sizeof(ifrbuf); + ifconf.ifc_buf = (caddr_t)ifrbuf; + + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("SOCK_DGRAM"); + return(-1); + } + if (ioctl(sock, SIOCGIFCONF, &ifconf) < 0) { + perror("SIOCGIFCONF"); + close(sock); + return(-1); + } + close(sock); + ifra = ifrbuf; + ifrb = (struct ifreq *)((char *)ifra + ifconf.ifc_len); + while (ifra < ifrb) { + if (strcmp(ifr.ifr_name, ifra->ifr_name) == 0) { + if (ifra->ifr_addr.sa_family == AF_LINK) { + sadl = (struct sockaddr_dl *)&ifra->ifr_addr; + if (sadl->sdl_type == IFT_ETHER) { + bcopy((char *)LLADDR(sadl), (char *)addr, 6); + return(0); + } + #ifdef bsdi + if (sadl->sdl_alen == 0) /* no addr, try other method */ + return(get_eth_addr(s, interface, addr)); + #endif bsdi + } + } + if ((len = ifra->ifr_addr.sa_len+sizeof(ifra->ifr_name)) < sizeof(*ifra)) + len = sizeof(*ifra); + ifra = (struct ifreq *)((char *)ifra + len); + } + } + return(-1); + #endif USE_SIOCGIFCONF + + #ifdef USE_ENET { struct endevp endev; *************** *** 1080,1090 **** perror("SIOCGIFHWADDR"); return(-1); } - #ifdef OLD_SIOCGIFHWADDR memcpy((char *)addr, ifr.ifr_hwaddr.sa_data, 6); - #else OLD_SIOCGIFHWADDR - memcpy((char *)addr, ifr.ifr_hwaddr, 6); - #endif OLD_SIOCGIFHWADDR #endif linux return(0); --- 1178,1184 ---- *************** *** 1478,1506 **** #ifdef linux int fromlen; struct sockaddr sa; ! /* ! * this is slightly less than optimal due to Linux SOCK_PACKET limitations ! * ! */ RDS[0].dataLen = 0; fromlen = sizeof(struct sockaddr); - #ifdef USE_MSG_PEEK - if ((cc = recvfrom(fd, (char *)buf, 22, MSG_PEEK, &sa, &fromlen)) <= 0) - return(cc); - #else USE_MSG_PEEK if ((cc = recvfrom(fd, (char *)buf, len, 0, &sa, &fromlen)) <= 0) return(cc); - #endif USE_MSG_PEEK ! /* check if right interface */ ! if (strcmp(sa.sa_data, socklist[fd].sa.sa_data)) ! return(0); ! ! #ifdef USE_MSG_PEEK ! if ((cc = recvfrom(fd, (char *)buf, len, 0, NULL, NULL)) <= 0) ! return(cc); ! #endif USE_MSG_PEEK RDS[0].dataLen = cc; RDS[0].dataPtr = buf; --- 1572,1588 ---- #ifdef linux int fromlen; struct sockaddr sa; ! RDS[0].dataLen = 0; fromlen = sizeof(struct sockaddr); if ((cc = recvfrom(fd, (char *)buf, len, 0, &sa, &fromlen)) <= 0) return(cc); ! /* check if from right interface */ ! for (i = socklist[fd].iflen-1; i >= 0; i--) ! if (sa.sa_data[i] != socklist[fd].sa.sa_data[i]) ! return(0); RDS[0].dataLen = cc; RDS[0].dataPtr = buf; *************** *** 1510,1515 **** --- 1592,1646 ---- #endif linux + #ifdef UPFILT + #ifdef UPFILT_FDDI + if (onfddi[fd]) { + struct fddi_header fddibit; + struct iovec fdiov[3]; + struct llc llcbit; + int off; + + RDS[0].dataLen = 0; + + /* + * use readv to get the data we want. Based on + * protocol type we need to preserve a length and + * sap data in the input buffer + * + */ + off = (ethtyp[fd] == 2) ? 22 : 14; + fdiov[0].iov_base = (caddr_t)&fddibit; + fdiov[0].iov_len = sizeof(struct fddi_header); + fdiov[1].iov_base = (caddr_t)&llcbit; + fdiov[1].iov_len = sizeof(struct llc); + fdiov[2].iov_base = (caddr_t)(buf+off); + fdiov[2].iov_len = len-off; + + if ((cc = readv(fd, fdiov, 3)) <= 0) + return(cc); + + bcopy((char *)fddibit.fddi_dhost, (char *)buf, 12); /* addresses */ + cc = cc - fdiov[0].iov_len - fdiov[1].iov_len + off;/* eth length */ + + if (ethtyp[fd] == 2) { + bcopy((char *)&llcbit, (char *)(buf+14), 8); /* SAP */ + buf[12] = (cc >> 8) & 0xff; /* len */ + buf[13] = (cc & 0xff); + } else { /* type */ + buf[12] = (llcbit.llc_un.type_snap.ether_type >> 8) & 0xff; + buf[13] = (llcbit.llc_un.type_snap.ether_type & 0xff); + } + + RDS[0].dataLen = cc; + RDS[0].dataPtr = buf; + RDS[1].dataLen = 0; + + return(cc); + } + #endif UPFILT_FDDI + #endif UPFILT + + #if (!(defined(BPFILT) || defined(sgi) || defined(hpux) || defined(linux))) RDS[0].dataLen = 0; *************** *** 1525,1530 **** --- 1656,1662 ---- return(cc); #endif /* BPFILT || sgi || hpux */ + } /* *************** *** 1555,1560 **** --- 1687,1693 ---- #ifdef USE_WRITEV struct iovec iov[2]; + #ifdef FreeBSD_SWAP_BUG u_char swap; *************** *** 1563,1574 **** --- 1696,1748 ---- buf[13] = swap; #endif FreeBSD_SWAP_BUG + + #ifdef UPFILT + #ifdef UPFILT_FDDI + if (onfddi[fd]) { + int off, tot; + struct llc llcbit; + struct iovec fdiov[3]; + struct fddi_header fddibit; + unsigned char sapSnap[6] = { LLC_SNAP_LSAP, LLC_SNAP_LSAP, + LLC_UI, '\0', '\0', '\0' }; + + fddibit.fddi_fc = FDDIFC_LLC_ASYNC; /* frame control */ + bcopy(buf, fddibit.fddi_dhost, 12); /* mac addresses */ + + if (ethtyp[fd] == 2) { + bcopy((char *)(buf+14), (char *)&llcbit, 8); /* SAP */ + off = 22; + } else { + bcopy(sapSnap, (char *)&llcbit.llc_dsap, 6); /* sap snap */ + llcbit.llc_un.type_snap.ether_type = (buf[12] << 8) | buf[13]; + off = 14; + } + + fdiov[0].iov_base = (caddr_t)&fddibit; + fdiov[0].iov_len = sizeof(struct fddi_header); + fdiov[1].iov_base = (caddr_t)&llcbit; + fdiov[1].iov_len = sizeof(struct llc); + fdiov[2].iov_base = (caddr_t)(buf+off); + fdiov[2].iov_len = len-off; + + tot = len-off+sizeof(struct fddi_header)+sizeof(struct llc); + + if (writev(fd, fdiov, 3) == tot) + return(len); + + } + #endif UPFILT_FDDI + #endif UPFILT + iov[0].iov_base = (caddr_t)buf; iov[0].iov_len = 14; iov[1].iov_base = (caddr_t)buf+14; iov[1].iov_len = len-14; + if (writev(fd, iov, 2) == len) return(len); + #endif USE_WRITEV *** Makefile.orig Sun May 19 22:40:42 1996 --- Makefile Sun May 19 23:34:13 1996 *************** *** 1,7 **** # # A Remote Network Server for AppleTalk # ! # Copyright (c) 1992-1994, The University of Melbourne # djh@munnari.OZ.AU # --- 1,7 ---- # # A Remote Network Server for AppleTalk # ! # Copyright (c) 1992-1996, The University of Melbourne # djh@munnari.OZ.AU # *************** *** 14,19 **** --- 14,22 ---- # -DBPFILT BERKELEY PF # -DENETPF ENET PF # + # To enable FDDI support under ULTRIX or Digital UNIX (OSF/1), add + # -DUPFILT_FDDI + # # For Sony NEWS OS4.2 or later to allow use of EtherTalk Phase 2 # CFLAGS=-Dsony_phaseII # LFLAGS= *************** *** 29,39 **** # LFLAGS= # LIBS=-lsocket -lnsl # - # For DEC Alpha OSF/1, Phase 1 or Phase 2 - # CFLAGS= - # LFLAGS= - # LIBS=pfopen.o - # # For 386BSD, FreeBSD 1.0, Phase 1 only # CFLAGS=-D__386BSD__ # LFLAGS= --- 32,37 ---- *************** *** 44,49 **** --- 42,52 ---- # CFLAGS=-DFreeBSD -DFreeBSD_SWAP_BUG # LFLAGS= # LIBS= + # + # For NetBSD 1.0 + # CFLAGS= + # LFLAGS= + # LIBS=-lcrypt # # For BSDI BSD/386, Phase 1 or Phase 2 # CFLAGS= *** README.orig Sat Dec 17 17:55:42 1994 --- README Sun May 19 22:40:19 1996 *************** *** 5,19 **** The University of Melbourne djh@munnari.OZ.AU January, 1992 ! version 1.13 ARNS is 'A Remote Network Server' package for AppleTalk that allows a remote client to participate in local network services such as printing and file sharing. The ARNS server runs on a UNIX host that is connected to an EtherTalk network. Connectivity between a client and server may be ! provided by a variety of transport systems. This version of ARNS supports ! UDP/IP datagrams and TCP/IP streams. ARNS client nodes (which may be anywhere on the IP connected Internet) can --- 5,19 ---- The University of Melbourne djh@munnari.OZ.AU January, 1992 ! version 1.14 ARNS is 'A Remote Network Server' package for AppleTalk that allows a remote client to participate in local network services such as printing and file sharing. The ARNS server runs on a UNIX host that is connected to an EtherTalk network. Connectivity between a client and server may be ! provided by a variety of transport systems. This version of ARNS for UNIX ! supports UDP/IP datagrams and TCP/IP streams. ARNS client nodes (which may be anywhere on the IP connected Internet) can *************** *** 33,44 **** IPRemote and Async AppleTalk2 are included with the ARNS distribution, 'aarap' and 'atppp' are available via FTP from munnari.OZ.AU in the ! directories mac/arns_arap and mac/arns_ppp. NOTICE ! Copyright (c) 1992-1994, The University of Melbourne. All Rights Reserved. ARNS may NOT be publicly redistributed (for example via anonymous FTP), sold, or the source used for any other --- 33,46 ---- IPRemote and Async AppleTalk2 are included with the ARNS distribution, 'aarap' and 'atppp' are available via FTP from munnari.OZ.AU in the ! directories mac/arns_arap and mac/arns_ppp. A Macintosh based ARNS ! server which supports connections via UDP/IP is available from the ! same location in the mac/arns_mac directory. NOTICE ! Copyright (c) 1992-1996, The University of Melbourne. All Rights Reserved. ARNS may NOT be publicly redistributed (for example via anonymous FTP), sold, or the source used for any other *************** *** 52,61 **** ARNS SERVER The ARNS server currently supports Phase 1 and Phase 2 EtherTalk networks ! on SUN SunOS/Solaris, DEC ULTRIX/Alpha, SGI IRIX, Sony NEWS 4.2, HP-UX 8.07, ! IBM RS6000 AIX, Linux 1.1.74, BSDI BSD/386 1.1 and FreeBSD 2.0 workstations, and Phase 1 only on Sony NEWS pre-4.2 and 386BSD/FreeBSD 1.0 workstations. Security for access to the server is provided with an optional server password and/or username & password pair. Access can be restricted to clients that appear on an IP address filter list. The server may only --- 54,66 ---- ARNS SERVER The ARNS server currently supports Phase 1 and Phase 2 EtherTalk networks ! on SUN SunOS/Solaris, DEC ULTRIX/Alpha, SGI IRIX, Sony NEWS 4.2, HP-UX, ! IBM RS6000 AIX, Linux 1.3.96, BSDI BSD/386 1.1 and FreeBSD 2.0 workstations, and Phase 1 only on Sony NEWS pre-4.2 and 386BSD/FreeBSD 1.0 workstations. + Note: ARNS supports AppleTalk over FDDI for ULTRIX & Digital UNIX. + Refer to the "Notes for DEC FDDI" section below. + Security for access to the server is provided with an optional server password and/or username & password pair. Access can be restricted to clients that appear on an IP address filter list. The server may only *************** *** 292,297 **** --- 297,309 ---- You MUST manually set the define for LIBS=pfopen.o in the Makefile and copy /usr/lib/examples/packetfilter/pfopen.c to the ARNS directory. + ------------------- + Notes for DEC FDDI: + + ARNS supports FDDI interfaces under DEC ULTRIX and Digital UNIX (tested + with the "fta" interface under OSF/1 3.2). You must define UPFILT_FDDI + in the Makefile to enable the FDDI code. + ---------------------- Notes for HP-UX users: *************** *** 317,322 **** --- 329,338 ---- -------------------------- Notes for Sony NEWS users: + Yasuaki Honda + Sony Computer Science Laboratory Inc. + honda@csl.sony.co.jp + You may know that recently Sony Corp. released NEWS-OS4.2 which supports AppleTalk protocols. ARNS runs on both NEWS-OS4.2 and pre-4.2 NEWS-OS that supports /dev/ether0 device. This note describes how to use ARNS on SONY NEWS. *************** *** 408,415 **** on the host whose afsd is invisible. This will initialize AARP table and everything will be visible. - - - Yasuaki Honda - Sony Computer Science Laboratory Inc. - honda@csl.sony.co.jp --- 424,426 ----