lindberg@chalmers.UUCP (Gunnar Lindberg) (03/20/88)
Anybody tried to use the Kinetics box (rev 09/87) on a Class-B net that requires old IP-broadcast addresses? Well, we did... The changes needed to make it work are presented below. Please reply by mail since I don't regularly read "comp.protocols.appletalk". Gunnar Lindberg Department of Computer Science Chalmers University of Technology S-412 96 Gothenburg, SWEDEN lindberg@cs.chalmers.se ..!uunet!mcvax!enea!chalmers!cs.chalmers.se!lindberg --------------------------------------------------------------- Feb 11 1987 Gunnar Lindberg, lindberg@cs.chalmers.se Two problems showed up on our Class B IP network: 1) Due to compatibility problems (the "Arp Storm Problem") we still can not use a correct IP-broadcast address with host number replaced by all 1:s (129.16.255.255), but have to stay with the old one (129.16.0.0). However, such a configuration (/etc/atalkatab - "N0") made the box use broadcast addresses like 129.16.5.0 which is even worse, since it starts the "Arp Storm" from *all* hosts without any of them recognizing it as a valid broadcast address (we can't use subnets either). 2) Recognition of IP broadcast required "all 1:s" and was "hardwired" to be a Class C network (or subnets). The comment said "Jeff would complain" and we fully agree. Over all, the code seems to have Class C networking "hardwired" into it, but it does work on a non-subnetted Class B network as long as the Appletalk IP-net is assigned on "Class C boundries". IP addresses are essentially created by: ipaddr = (gateway_ipaddr & 0xFF) + apple_hostno; which requires that the gateway's IP address is chosen with some care to work on a Class B net (since Appletalk host numbers are only 8 bits there is really no other way to do this). Changes: 1) A new "iaddr_t mkipbroadcast(ia, new)" was added and is used whenever a broadcast address is created. The "new" flag is used to choose between "all 1:s" and "all 0:s" and gets its value from "N0" with obvious semantics. Changes go into gw.c and gw2.c below. 2) The "ipbroadcast(ia)" macro was modified to use the complete host-part and to accept both broadcasts. Changes goes into gw.h below. RCS file: gw.c,v retrieving revision 1.1 diff -r1.1 gw.c 596c596 < idst = (ar->node & ~0xFF) + ddp.dstNode; --- > idst = (ar->node & ~0xFF) + ddp.dstNode; 598,603c598 < if (ddp.dstNet == ifie.if_dnet) { < idst = conf.ipbroad; < } else { < idst = ar->node < + ipbroadtypes[ar->flags&arouteBMask]; < } --- > idst = mkipbroadcast(ar->node,ar->flags&arouteBMask); 607c602 < idst = (ar->node & ~0xFF) + ddp.dstNode; --- > idst = (ar->node & ~0xFF) + ddp.dstNode; 609,610c604,605 < idst = ar->node; < port = rebPort; --- > idst = mkipbroadcast(ar->node,ar->flags&arouteBMask); > port = rebPort; =================================================================== =================================================================== RCS file: gw2.c,v retrieving revision 1.1 diff -r1.1 gw2.c 735a736,755 > > iaddr_t > mkipbroadcast(ia, new) > register iaddr_t ia; > { > register iaddr_t br; > > if (new) /* Use new or old IP broadcast */ > br = INADDR_BROADCAST; > else > br = INADDR_ANY; > > if (IN_CLASSC(ia)) > return((ia & IN_CLASSC_NET) | (br & IN_CLASSC_HOST)); > if (IN_CLASSB(ia)) > return((ia & IN_CLASSB_NET) | (br & IN_CLASSB_HOST)); > if (IN_CLASSA(ia)) > return((ia & IN_CLASSA_NET) | (br & IN_CLASSA_HOST)); > return(br); /* Should never happen ... */ > } =================================================================== RCS file: gw.h,v retrieving revision 1.1 diff -r1.1 gw.h 156d156 < #define ipbroadcast(ia) (((ia) & 0xFF) == 0xFF) /* Jeff would complain */ 160a161,162 > #define ipbroadcast(ia) ((~iphostpart(ia) == 0) ||\ > (iphostpart(ia) == 0)) /* new or old */ ---------------------------------------------------------------