Patch #: 85 Type: operational change Priority: none Modification: let thisNode=0 in atalk.local represent last IP addr byte Submitted: Lennart Lovstrand, Ian Daniel Submitted: David Hornsby Archived: munnari.OZ.AU mac/cap.patches/cap60.patch085 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch085' Summary: do gethostname(), gethostbyname() to get IP address WARNING: this feature is disabled for hosts with > 1 IP interface File: cap60/lib/cap/atalkdbm.c *** lib/cap/atalkdbm.c.orig Wed May 29 22:42:09 1991 --- lib/cap/atalkdbm.c Mon Feb 17 13:14:17 1992 *************** *** 1,7 **** /* ! * $Date: 1991/05/29 12:42:02 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/atalkdbm.c,v 2.6 1991/05/29 12:42:02 djh Rel djh $ ! * $Revision: 2.6 $ * * mods for async appletalk support, /etc/etalk.local for EtherTalk and * changes for quoted zone names: djh@munnari.OZ.AU, 27/11/90 --- 1,7 ---- /* ! * $Date: 1992/02/17 02:13:58 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/atalkdbm.c,v 2.8 1992/02/17 02:13:58 djh Rel djh $ ! * $Revision: 2.8 $ * * mods for async appletalk support, /etc/etalk.local for EtherTalk and * changes for quoted zone names: djh@munnari.OZ.AU, 27/11/90 *************** *** 203,208 **** --- 203,229 ---- getfield(st, sizeof(st), 0); this_node = atoi(st) & 0xff; getfield(this_zone, sizeof(this_zone), 0); + + /* + * let node "0" stand for last byte of IP address + * Lennart Lovstrand 890430 + * + */ + if (this_node == 0) { + struct hostent *he, *gethostbyname(); + char name[100]; + + (void) gethostname(name, sizeof(name)); + if ((he = gethostbyname(name)) == NULL) { + perror(name); + exit(2); + } + /* if only one interface */ + if (he->h_addr_list[1] == NULL) + /* get the last byte for node number */ + this_node = (unsigned char) he->h_addr[3]; + } + if (this_net == 0 || this_node == 0 || *this_zone == '\0') { fprintf(stderr, "openatalkdb: in %s, error at line %d\n",fn,linecnt); fprintf(stderr, "openatalkdb: bad format/missing information\n"); *************** *** 210,215 **** --- 231,237 ---- } continue; } + if (bridge_net == 0) { getfield(st, sizeof(st), 0); bridge_net = htons(atnetshort(st)); *** README.orig Mon Feb 17 00:03:05 1992 --- README Mon Feb 17 00:03:37 1992 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 84, February 1992 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 85, February 1992 Introduction ------------