Attachment 'pvm3-3.3.5-v6-13082007.diff.txt'

Download

   1 diff -ruN pvm3.old/console/cmds.c pvm3/console/cmds.c
   2 --- pvm3.old/console/cmds.c	2004-01-14 19:46:20.000000000 +0100
   3 +++ pvm3/console/cmds.c	2007-08-13 10:24:37.000000000 +0200
   4 @@ -437,7 +437,7 @@
   5  	int hd_dsig;				/* data signature */
   6  	int hd_err;					/* error code */
   7  	int hd_mtu;					/* max snd/rcv length */
   8 -	/* struct sockaddr_in hd_sad;	/^ UDP address/port */
   9 +	/* struct SOCKADDR_IN hd_sad;	/^ UDP address/port */
  10  	int hd_rxseq;				/* expected next seq num from host */
  11  	int hd_txseq;				/* next tx seq num to host */
  12  	/* struct pkt *hd_txq;		/^ not-yet-sent packet queue to host */
  13 diff -ruN pvm3.old/hoster/pvmwinrexec.c pvm3/hoster/pvmwinrexec.c
  14 --- pvm3.old/hoster/pvmwinrexec.c	2003-02-04 21:06:31.000000000 +0100
  15 +++ pvm3/hoster/pvmwinrexec.c	2007-08-13 10:24:37.000000000 +0200
  16 @@ -318,7 +318,7 @@
  17  {
  18  	WSADATA wsadata;
  19  
  20 -	struct sockaddr_in server_addr, my_err_addr, junk_addr;
  21 +	struct SOCKADDR_IN server_addr, my_err_addr, junk_addr;
  22  	struct servent *sv;
  23  	struct hostent *hent;
  24  	static char portbuf[30];
  25 @@ -341,7 +341,7 @@
  26  		return(0);
  27  	}
  28  
  29 -	hent = gethostbyname(remote_host);
  30 +	hent = GETHOSTBYNAME(remote_host);
  31  	if(!hent) {
  32  		fprintf(stderr, "Lookup of server hostname failed: error=%d.\n",
  33  			WSAGetLastError());
  34 @@ -373,7 +373,7 @@
  35  
  36  	memset(&my_err_addr, '\0', sizeof my_err_addr);
  37  	my_err_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  38 -	my_err_addr.sin_family = AF_INET;
  39 +	my_err_addr.sin_family = AF_FAMILY;
  40  	my_err_addr.sin_port = 0;
  41  
  42  	if ((sTmp=socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
  43 diff -ruN pvm3.old/hoster/pvmwinrsh.c pvm3/hoster/pvmwinrsh.c
  44 --- pvm3.old/hoster/pvmwinrsh.c	1999-03-15 22:52:03.000000000 +0100
  45 +++ pvm3/hoster/pvmwinrsh.c	2007-08-13 10:24:37.000000000 +0200
  46 @@ -33,8 +33,8 @@
  47  #include <pvmwin.h>
  48  #include <winsock.h>
  49  
  50 -struct sockaddr_in anaddr; // local socket address structure 
  51 -struct sockaddr_in saddr; // server socket address structure
  52 +struct SOCKADDR_IN anaddr; // local socket address structure 
  53 +struct SOCKADDR_IN saddr; // server socket address structure
  54  
  55  u_short rshPort; // the local rsh port; determined dynamically
  56  u_short rshErrPort; // the local rsh port for client stderr output
  57 @@ -61,12 +61,12 @@
  58  int
  59  rresvport (u_short *alport, int sProto)
  60  {
  61 -    struct sockaddr_in sin;
  62 +    struct SOCKADDR_IN sin;
  63      int s;
  64  
  65 -    sin.sin_family=AF_INET;
  66 +    sin.sin_family=AF_FAMILY;
  67      sin.sin_addr.s_addr=INADDR_ANY;
  68 -    s=socket(AF_INET, SOCK_STREAM, sProto);
  69 +    s=socket(PF_FAMILY, SOCK_STREAM, sProto);
  70      if(s<0)
  71          return -1;
  72  
  73 @@ -139,7 +139,7 @@
  74  	if(saddr.sin_addr.s_addr==(u_long)INADDR_NONE)
  75  	{
  76  		// must have gotten host name instead of IP address; resolve!
  77 -		struct hostent* hostInfo=gethostbyname(hostname);
  78 +		struct hostent* hostInfo=GETHOSTBYNAME(hostname);
  79  		if(!hostInfo) {
  80  			fprintf(stdout,"Invalid hostname!");
  81  			return 0;
  82 @@ -285,7 +285,7 @@
  83      initSocket();
  84      if(!initErrSocket())
  85  	fprintf(stdout,"Cannot create error socket!");
  86 -	saddr.sin_family=AF_INET;
  87 +	saddr.sin_family=AF_FAMILY;
  88  	saddr.sin_port=rshSPort;
  89  	if(connect(rshClient, (struct sockaddr FAR*)&saddr, sizeof(saddr)))
  90  	     fprintf(stdout,"Cannot connect to RSH port!\n");
  91 diff -ruN pvm3.old/src/AIX4SP2/pvmdmimd.c pvm3/src/AIX4SP2/pvmdmimd.c
  92 --- pvm3.old/src/AIX4SP2/pvmdmimd.c	2002-02-22 00:19:01.000000000 +0100
  93 +++ pvm3/src/AIX4SP2/pvmdmimd.c	2007-08-13 10:24:37.000000000 +0200
  94 @@ -851,13 +851,13 @@
  95  mksock()
  96  {	
  97  	struct hostd *hp = hosts->ht_hosts[hosts->ht_local];
  98 -	struct sockaddr_in sin;
  99 +	struct SOCKADDR_IN sin;
 100  	char buf[128];
 101  	char *p;
 102  	int cc;
 103  	int sock;
 104  
 105 -	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 106 +	if ((sock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 107  		pvmlogperror("mksock() socket");
 108  		return -1;
 109  	}
 110 diff -ruN pvm3.old/src/BEOLIN/pvmdmimd.c pvm3/src/BEOLIN/pvmdmimd.c
 111 --- pvm3.old/src/BEOLIN/pvmdmimd.c	2002-02-22 00:19:15.000000000 +0100
 112 +++ pvm3/src/BEOLIN/pvmdmimd.c	2007-08-13 10:24:37.000000000 +0200
 113 @@ -170,7 +170,7 @@
 114  	struct hostent *hostaddr;
 115  	int 	i;
 116  	int		n;
 117 -	struct in_addr	node_sin_addr;
 118 +	struct IN_ADDR	node_sin_addr;
 119  	char 	nname[128];	/* node name */
 120  	char 	*p, *q;
 121  	char 	*plist;		/* processor list */
 122 @@ -205,16 +205,16 @@
 123  			n = (q = CINDEX(p, ':')) ? q - p : strlen(p);
 124  			strncpy(nname, p, n);
 125  			nname[n] = 0;
 126 -			if (!(hostaddr = gethostbyname( nname )))
 127 +			if (!(hostaddr = GETHOSTBYNAME( nname )))
 128  				{
 129 -				sprintf( pvmtxt, "mpp_init() can't gethostbyname() for %s\n", 
 130 +				sprintf( pvmtxt, "mpp_init() can't GETHOSTBYNAME() for %s\n", 
 131  						nname );
 132  				pvmlogerror( pvmtxt );
 133  				}
 134  			else
 135  				{	/* got addr, now save it */
 136  				BCOPY( hostaddr->h_addr_list[0], (char*)&node_sin_addr,
 137 -					sizeof(struct in_addr));
 138 +					sizeof(struct IN_ADDR));
 139  				}
 140  			nodeaddr[i] = node_sin_addr.s_addr;
 141  			nodelist[i++] = STRALLOC(nname);
 142 diff -ruN pvm3.old/src/ddpro.c pvm3/src/ddpro.c
 143 --- pvm3.old/src/ddpro.c	2004-01-14 19:50:55.000000000 +0100
 144 +++ pvm3/src/ddpro.c	2007-08-13 10:24:37.000000000 +0200
 145 @@ -438,11 +438,13 @@
 146  #include "msgbox.h"
 147  #include "global.h"
 148  
 149 +#include "pvmipv6.h"
 150 +
 151  
 152  void pvmbailout();
 153  char *inadport_hex();
 154  char *getenv();
 155 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 156 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 157  void mesg_rewind __ProtoGlarp__ (( struct pmsg * ));
 158  void tev_send_newtask();
 159  
 160 @@ -925,7 +927,7 @@
 161  
 162  	hp = hosts->ht_hosts[hosts->ht_local];
 163  
 164 -	if ( hp->hd_sad.sin_addr.s_addr == htonl(0x7f000001) ) {
 165 +	if ( ADDR_IS_LOOPBACK(ADDR_FROM_SA(hp->hd_sad))) {
 166  
 167  		/* damn, we're hosed.  bail on host adds with new */
 168  		/* PvmIPLoopback error code... */
 169 @@ -948,14 +950,14 @@
 170  		if (hp->hd_err)
 171  			continue;
 172  
 173 -		if (he = gethostbyname(hp->hd_aname ? hp->hd_aname : hp->hd_name)) {
 174 -			BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
 175 -					sizeof(struct in_addr));
 176 +		if (he = GETHOSTBYNAME(hp->hd_aname ? hp->hd_aname : hp->hd_name)) {
 177 +		    BCOPY(he->h_addr_list[0], (char*)&ADDR_FROM_SA(hp->hd_sad),
 178 +					sizeof(struct IN_ADDR));
 179  
 180  		} else {
 181  			if (pvmdebmask & PDMSTARTUP) {
 182  				pvmlogprintf(
 183 -						"start_slaves() can't gethostbyname: %s\n",
 184 +						"start_slaves() can't GETHOSTBYNAME: %s\n",
 185  						hp->hd_name);
 186  			}
 187  			hp->hd_err = PvmNoHost;
 188 @@ -967,7 +969,7 @@
 189  		if (!(hp->hd_flag & HF_OVERLOAD)) {
 190  			for (hh = hosts->ht_last; hh > 0; hh--)
 191  				if ((hp2 = hosts->ht_hosts[hh])
 192 -				&& (hp2->hd_sad.sin_addr.s_addr == hp->hd_sad.sin_addr.s_addr)) {
 193 +				&& (ADDR_EQUALS(ADDR_FROM_SA(hp2->hd_sad), ADDR_FROM_SA(hp->hd_sad)))) {
 194  					hp->hd_err = PvmDupHost;
 195  					break;
 196  				}
 197 @@ -977,8 +979,7 @@
 198  	/* make sure new ones aren't duplicated */
 199  
 200  			for (j = i; j-- > 0; )
 201 -				if (hp->hd_sad.sin_addr.s_addr
 202 -				== wxp->w_hosts[j]->hd_sad.sin_addr.s_addr) {
 203 +			    if (ADDR_EQUALS(ADDR_FROM_SA(hp->hd_sad),ADDR_FROM_SA(wxp->w_hosts[j]->hd_sad))) {
 204  					hp->hd_err = PvmDupHost;
 205  					break;
 206  				}
 207 @@ -1747,7 +1748,11 @@
 208  {
 209  	int count;			/* number of hosts in message */
 210  	int hh;
 211 +#ifdef INET6
 212 +	char buf[INET6_ADDRSTRLEN+2+20];		/* for converting sockaddr */
 213 +#else
 214  	char buf[16];		/* for converting sockaddr */
 215 +#endif
 216  	struct pmsg *mp2;
 217  
 218  	/* unpack new host table params */
 219 @@ -2064,7 +2069,11 @@
 220  	int count;				/* num of new hosts */
 221  	int happy;				/* num of happy new hosts */
 222  	struct waitc_add *wxp;
 223 +#ifdef INET6
 224 +	char *av[INET6_ADDRSTRLEN+2+20];			/* for reply parsing */
 225 +#else
 226  	char *av[16];			/* for reply parsing */
 227 +#endif
 228  	int ac;
 229  	int ver;
 230  	int i, j;
 231 diff -ruN pvm3.old/src/host.c pvm3/src/host.c
 232 --- pvm3.old/src/host.c	2004-01-14 19:50:55.000000000 +0100
 233 +++ pvm3/src/host.c	2007-08-13 10:24:37.000000000 +0200
 234 @@ -275,7 +275,7 @@
 235  		BZERO((char*)hp, sizeof(struct hostd));
 236  		hp->hd_ref = 1;
 237  		hp->hd_hostpart = hh << (ffs(tidhmask) - 1);
 238 -		hp->hd_sad.sin_family = AF_INET;
 239 +		FAMILY_FROM_SA(hp->hd_sad) = AF_FAMILY;
 240  		hp->hd_txq = pk_new(0);
 241  		hp->hd_opq = pk_new(0);
 242  		hp->hd_rxq = pk_new(0);
 243 @@ -823,7 +823,7 @@
 244  	int err = 0;		/* error count */
 245  	struct hostent *he;
 246  	char *p;
 247 -	struct in_addr *my_in_addrs;
 248 +	struct IN_ADDR *my_in_addrs;
 249  	int num_addrs;
 250  	int i;
 251  	int maxhostid = tidhmask >> (ffs(tidhmask) - 1);
 252 @@ -894,21 +894,21 @@
 253  
 254  	/* look up ip addr */
 255  
 256 -		if (!(he = gethostbyname(hp->hd_aname ? hp->hd_aname : hp->hd_name))) {
 257 -			pvmlogprintf("readhostfile() %s %d: %s: can't gethostbyname\n",
 258 +		if (!(he = GETHOSTBYNAME(hp->hd_aname ? hp->hd_aname : hp->hd_name))) {
 259 +			pvmlogprintf("readhostfile() %s %d: %s: can't GETHOSTBYNAME\n",
 260  				fn, lnum, hp->hd_name);
 261  			err++;
 262  			goto badline;
 263  		}
 264 -		BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
 265 -			sizeof(struct in_addr));
 266 +		BCOPY(he->h_addr_list[0], (char*)&ADDR_FROM_SA(hp->hd_sad),
 267 +			sizeof(struct IN_ADDR));
 268  
 269  	/* mark master host to not start */
 270  
 271  		if (!(hp->hd_flag & HF_OVERLOAD))
 272  			for (i = num_addrs; i-- > 0; ) {
 273 -				if (BCMP((char*)&my_in_addrs[i], (char*)&hp->hd_sad.sin_addr,
 274 -						sizeof(struct in_addr)) == 0) {
 275 +			    if (BCMP((char*)&my_in_addrs[i], (char*)&ADDR_FROM_SA(hp->hd_sad),
 276 +						sizeof(struct IN_ADDR)) == 0) {
 277  					hp->hd_flag |= HF_NOSTART;
 278  					break;
 279  				}
 280 @@ -946,16 +946,77 @@
 281  *
 282  *	Return list of addresses for active network interfaces.
 283  */
 284 +#ifdef INET6
 285 +int
 286 +iflist(alp, np)
 287 +	struct IN_ADDR **alp;	/* return list of addresses */
 288 +	int *np;				/* return len of alp */
 289 +{
 290 +	static struct IN_ADDR *iplist = 0;	/* list of interface addrs found */
 291 +	int nip = 0;						/* length of iplist */
 292 +	char **p;
 293 +
 294 +	FILE *f;
 295 +    	char addr6[40], devname[20];
 296 +    	struct SOCKADDR_IN sap;
 297 +    	int plen, scope, dad_status, if_idx;
 298 +    	char addr6p[8][5];  
 299 +
 300 +
 301 +	if (iplist)
 302 +		PVM_FREE(iplist);
 303 +	iplist = TALLOC(10, struct IN_ADDR, "ifl");
 304 +
 305 +#ifdef IMA_LINUX
 306 +#ifndef _PATH_PROCNET_IFINET6	
 307 +#define _PATH_PROCNET_IFINET6	"/proc/net/if_inet6"
 308 +#endif /* _PATH_PROCNET_IFNET6 */
 309 +#else
 310 +#error "Don't know where to look for IPv6 interfaces"
 311 +#endif
 312 +
 313 +    if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
 314 +	while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
 315 +		      addr6p[0], addr6p[1], addr6p[2], addr6p[3],
 316 +		      addr6p[4], addr6p[5], addr6p[6], addr6p[7],
 317 +		  &if_idx, &plen, &scope, &dad_status, devname) != EOF) {
 318 +		sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
 319 +			addr6p[0], addr6p[1], addr6p[2], addr6p[3],
 320 +			addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
 321 +		pvmlogprintf(" Got interface IPv6 %s\n",addr6);
 322 +		inet_pton(AF_INET6, addr6, sap.sin6_addr.s6_addr);
 323 +		if (nip > 0 && !(nip % 10))
 324 +			iplist = TREALLOC(iplist, (nip + 10), struct IN_ADDR);
 325 +		memcpy(&iplist[nip],&sap.sin6_addr,sizeof(struct IN_ADDR));
 326 +		nip++;
 327 +
 328 +	}
 329 +	fclose(f);
 330 +    }
 331 +    else
 332 +    {
 333 +	fprintf(stderr, "can't open %s\n",_PATH_PROCNET_IFINET6);
 334 +	goto bail;
 335 +    }
 336 +
 337 +	*alp = iplist;
 338 +	*np = nip;
 339 +	return 0;
 340 +
 341 +bail:
 342 +	return -1;
 343 +}
 344 +#else
 345  
 346  #ifdef	SIOCGIFCONF
 347  
 348  int
 349  iflist(alp, np)
 350 -	struct in_addr **alp;	/* return list of addresses */
 351 +	struct IN_ADDR **alp;	/* return list of addresses */
 352  	int *np;				/* return len of alp */
 353  {
 354  	int soc = -1;						/* socket */
 355 -	static struct in_addr *iplist = 0;	/* list of interface addrs found */
 356 +	static struct IN_ADDR *iplist = 0;	/* list of interface addrs found */
 357  	int nip = 0;						/* length of iplist */
 358  	char buf[4096];						/* return space for SIOCGIOCONF */
 359  	struct ifconf sif;
 360 @@ -965,9 +1026,9 @@
 361  
 362  	if (iplist)
 363  		PVM_FREE(iplist);
 364 -	iplist = TALLOC(10, struct in_addr, "ifl");
 365 +	iplist = TALLOC(10, struct IN_ADDR, "ifl");
 366  
 367 -	if ((soc = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
 368 +	if ((soc = socket(PF_FAMILY, SOCK_DGRAM, 0)) == -1) {
 369  		perror("socket");
 370  		goto bail;
 371  	}
 372 @@ -996,7 +1057,7 @@
 373  			cp += sizeof(*reqp) - sizeof(struct sockaddr) + SIZ(reqp->ifr_addr))
 374  	{
 375  		reqp = (struct ifreq*)cp;
 376 -		if (reqp->ifr_addr.sa_family != AF_INET)
 377 +		if (reqp->ifr_addr.sa_family != AF_FAMILY)
 378  			continue;
 379  		BCOPY(reqp->ifr_name, req.ifr_name, sizeof(req.ifr_name));
 380  		if (ioctl(soc, SIOCGIFFLAGS, &req) == -1) {
 381 @@ -1007,13 +1068,13 @@
 382  		/* if (IFF_UP & req.ifr_flags) { */
 383  		if (IFF_UP & req.ifr_ifru.ifru_flags) {
 384  			if (nip > 0 && !(nip % 10))
 385 -				iplist = TREALLOC(iplist, (nip + 10), struct in_addr);
 386 +				iplist = TREALLOC(iplist, (nip + 10), struct IN_ADDR);
 387  			iplist[nip++] =
 388 -			((struct sockaddr_in*)(&reqp->ifr_ifru.ifru_addr))->sin_addr;
 389 +			((struct SOCKADDR_IN*)(&reqp->ifr_ifru.ifru_addr))->sin_addr;
 390  			if (pvmdebmask & PDMNET) {
 391  				long a;
 392  
 393 -				a = ((struct sockaddr_in*)(&reqp->ifr_ifru.ifru_addr))->sin_addr.s_addr;
 394 +				a = ((struct SOCKADDR_IN*)(&reqp->ifr_ifru.ifru_addr))->sin_addr.s_addr;
 395  				a = ntohl(a);
 396  				pvmlogprintf("iflist() %s %d.%d.%d.%d\n",
 397  						reqp->ifr_name,
 398 @@ -1038,10 +1099,10 @@
 399  
 400  int
 401  iflist(alp, np)
 402 -	struct in_addr **alp;	/* return list of addresses */
 403 +	struct IN_ADDR **alp;	/* return list of addresses */
 404  	int *np;				/* return len of alp */
 405  {
 406 -	static struct in_addr *iplist = 0;	/* list of interface addrs found */
 407 +	static struct IN_ADDR *iplist = 0;	/* list of interface addrs found */
 408  	int nip = 0;						/* length of iplist */
 409  	char hn[MAXHOSTNAMELEN];
 410  	struct hostent *he;
 411 @@ -1049,20 +1110,20 @@
 412  
 413  	if (iplist)
 414  		PVM_FREE(iplist);
 415 -	iplist = TALLOC(10, struct in_addr, "ifl");
 416 +	iplist = TALLOC(10, struct IN_ADDR, "ifl");
 417  
 418  	if (gethostname(hn, sizeof(hn))) {
 419  		perror("gethostname");
 420  		goto bail;
 421  	}
 422 -	if (!(he = gethostbyname(hn))) {
 423 -		fprintf(stderr, "can't gethostbyname\n");
 424 +	if (!(he = GETHOSTBYNAME(hn))) {
 425 +		fprintf(stderr, "can't GETHOSTBYNAME\n");
 426  		goto bail;
 427  	}
 428  	for (; he->h_addr_list[nip]; nip++) {
 429  		if (nip > 0 && !(nip % 10))
 430 -			iplist = TREALLOC(iplist, (nip + 10), struct in_addr);
 431 -		iplist[nip].s_addr = ((struct in_addr*)(he->h_addr_list[nip]))->s_addr;
 432 +			iplist = TREALLOC(iplist, (nip + 10), struct IN_ADDR);
 433 +		iplist[nip].s_addr = ((struct IN_ADDR*)(he->h_addr_list[nip]))->s_addr;
 434  	}
 435  
 436  	*alp = iplist;
 437 @@ -1075,6 +1136,7 @@
 438  
 439  #endif	/*SIOCGIFCONF*/
 440  
 441 +#endif /* INET6 */
 442  
 443  /*	acav()
 444  *
 445 diff -ruN pvm3.old/src/host.h pvm3/src/host.h
 446 --- pvm3.old/src/host.h	2001-09-27 01:35:21.000000000 +0200
 447 +++ pvm3/src/host.h	2007-08-13 10:24:37.000000000 +0200
 448 @@ -71,7 +71,7 @@
 449   *
 450   */
 451  
 452 -
 453 +#include "pvmipv6.h"
 454  /* Host descriptor */
 455  
 456  struct hostd {
 457 @@ -89,7 +89,7 @@
 458  	int hd_dsig;				/* data signature */
 459  	int hd_err;					/* error code */
 460  	int hd_mtu;					/* max snd/rcv length */
 461 -	struct sockaddr_in hd_sad;	/* UDP address/port */
 462 +	struct SOCKADDR_IN hd_sad;	/* UDP address/port */
 463  	int hd_rxseq;				/* expected next seq num from host */
 464  	int hd_txseq;				/* next tx seq num to host */
 465  	struct pkt *hd_txq;			/* not-yet-sent packet queue to host */
 466 diff -ruN pvm3.old/src/lpvm.c pvm3/src/lpvm.c
 467 --- pvm3.old/src/lpvm.c	2004-01-14 19:50:55.000000000 +0100
 468 +++ pvm3/src/lpvm.c	2007-08-13 10:24:37.000000000 +0200
 469 @@ -659,7 +659,7 @@
 470   ***************/
 471  
 472  char *getenv();
 473 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 474 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 475  
 476  extern char *inadport_decimal();
 477  extern char *inadport_hex();
 478 @@ -686,7 +686,7 @@
 479   ***************/
 480  
 481  static int mxfersingle = 1;				/* mxfer returns after single frag */
 482 -static struct sockaddr_in pvmourinet;	/* our host ip addr */
 483 +static struct SOCKADDR_IN pvmourinet;	/* our host ip addr */
 484  static struct ttpcb *ttlist = 0;		/* dll of connected tasks */
 485  static struct ttpcb *topvmd = 0;		/* default route (to pvmd) */
 486  static int pvmnfds = 0;					/* 1 + highest bit set in fds */
 487 @@ -1255,7 +1255,7 @@
 488  #endif /*NOUNIXDOM*/
 489  
 490  			} else {
 491 -				if ((pcbp->tt_fd = socket(AF_INET, SOCK_STREAM, 0))
 492 +				if ((pcbp->tt_fd = socket(PF_FAMILY, SOCK_STREAM, 0))
 493  						== -1) {
 494  					pvmlogperror("pvm_tc_conreq() socket");
 495  
 496 @@ -1416,7 +1416,7 @@
 497  #endif /*NOUNIXDOM*/
 498  
 499  					} else {
 500 -						pcbp->tt_osad.sin_family = AF_INET;
 501 +						FAMILY_FROM_SA(pcbp->tt_osad) = AF_FAMILY;
 502  						hex_inadport(buf, &pcbp->tt_osad);
 503  						while ((i = connect(pcbp->tt_fd,
 504  								(struct sockaddr*)&pcbp->tt_osad,
 505 @@ -1791,7 +1791,7 @@
 506  #endif
 507  	char *txcp = 0;				/* point to remainder of txfp */
 508  	int txtogo = 0;				/* len of remainder of txfp */
 509 -	struct sockaddr_in sad;
 510 +	struct SOCKADDR_IN sad;
 511  	int s;
 512  	struct ttpcb *pcbp;
 513  	char *inPlaceHeader = (char  *) NULL;	/* for inplace data */
 514 @@ -2350,7 +2350,7 @@
 515  	int s;						/* socket */
 516  	int sbf;					/* temp TC_CONREQ message */
 517  	struct pmsg *up, *up2;
 518 -	struct sockaddr_in sad;
 519 +	struct SOCKADDR_IN sad;
 520  	int l;
 521  #ifdef SOCKLENISUINT
 522  #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
 523 @@ -2458,7 +2458,7 @@
 524  #endif /* !NOUNIXDOM */
 525  			/* Open a TCP direct Connection here, instead */
 526  
 527 -				if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 528 +				if ((s = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 529  					pvmlogperror("mroute() socket");
 530  
 531  				} else {
 532 @@ -2886,7 +2886,7 @@
 533  #endif /*NOUNIXDOM*/
 534  
 535  	} else {
 536 -		if ((topvmd->tt_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 537 +		if ((topvmd->tt_fd = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 538  			pvmlogperror("mksocs() socket");
 539  			goto bail;
 540  		}
 541 @@ -2894,7 +2894,7 @@
 542  		try = 5;
 543  		while (1) {	/* goto is at the root of all good programming style */
 544  			hex_inadport(p, &topvmd->tt_osad);
 545 -			topvmd->tt_osad.sin_family = AF_INET;
 546 +			FAMILY_FROM_SA(topvmd->tt_osad) = AF_FAMILY;
 547  			n = sizeof(topvmd->tt_osad);
 548  
 549  			if (connect(topvmd->tt_fd, (struct sockaddr*)&topvmd->tt_osad, n)
 550 @@ -2982,7 +2982,11 @@
 551  	char authfn[PVMTMPNAMLEN];	/* auth file name */
 552  	int authfd = -1;				/* auth fd to validate pvmd ident */
 553  	int i;
 554 +#ifdef INET6
 555 +	char buf[INET6_ADDRSTRLEN+2+20];					/* for converting sockaddr */
 556 +#else
 557  	char buf[16];					/* for converting sockaddr */
 558 +#endif
 559  	char *p;
 560  	struct pvmminfo minfo;
 561  	int outtid, outctx, outtag;
 562 @@ -3283,23 +3287,23 @@
 563  		hex_inadport(buf, &pvmourinet);
 564  	} else {
 565  		/* got name, now get addr */
 566 -		if (!(hostaddr = gethostbyname( namebuf ))) {
 567 -			pvmlogprintf( "pvmbeatask() can't gethostbyname() for %s\n",
 568 +		if (!(hostaddr = GETHOSTBYNAME( namebuf ))) {
 569 +			pvmlogprintf( "pvmbeatask() can't GETHOSTBYNAME() for %s\n",
 570  					namebuf );
 571  			hex_inadport(buf, &pvmourinet);
 572  		} else {
 573  			/* got addr, now save it */
 574  			BCOPY( hostaddr->h_addr_list[0],
 575  					(char*)&pvmourinet.sin_addr,
 576 -					sizeof(struct in_addr));
 577 +					sizeof(struct IN_ADDR));
 578  		}
 579  	}
 580  #else
 581  	hex_inadport(buf, &pvmourinet);
 582  #endif
 583  
 584 -	pvmourinet.sin_family = AF_INET;
 585 -	pvmourinet.sin_port = 0;
 586 +	FAMILY_FROM_SA(pvmourinet) = AF_FAMILY;
 587 +	PORT_FROM_SA(pvmourinet) = 0;
 588  
 589  	pvm_upkint(&pvmschedtid, 1, 1);
 590  #endif
 591 diff -ruN pvm3.old/src/lpvm.h pvm3/src/lpvm.h
 592 --- pvm3.old/src/lpvm.h	2004-01-14 19:50:56.000000000 +0100
 593 +++ pvm3/src/lpvm.h	2007-08-13 10:24:37.000000000 +0200
 594 @@ -111,6 +111,8 @@
 595  #endif
 596  extern	int pvmautoerr;				/* whether to auto print err msgs */
 597  
 598 +#include "pvmipv6.h"
 599 +
 600  extern	struct Pvmtracer pvmctrc;	/* child tracer info */
 601  extern	struct Pvmtracer pvmtrc;	/* task tracer info */
 602  
 603 @@ -196,8 +198,8 @@
 604  	int tt_tid;                     /* tid of peer or 0 if master of list */
 605  	int tt_state;
 606  	int tt_fd;                      /* fd of connection or -1 */
 607 -	struct sockaddr_in tt_sad;      /* address of our socket */
 608 -	struct sockaddr_in tt_osad;     /* (authd) address of peer socket */
 609 +	struct SOCKADDR_IN tt_sad;      /* address of our socket */
 610 +	struct SOCKADDR_IN tt_osad;     /* (authd) address of peer socket */
 611  	struct pmsg *tt_rxfrag;         /* not-assembled incm msg */
 612  	struct frag *tt_rxf;            /* partial incm frag */
 613  #ifndef NOUNIXDOM
 614 diff -ruN pvm3.old/src/lpvmmimd.c pvm3/src/lpvmmimd.c
 615 --- pvm3.old/src/lpvmmimd.c	2004-01-14 19:50:57.000000000 +0100
 616 +++ pvm3/src/lpvmmimd.c	2007-08-13 10:24:37.000000000 +0200
 617 @@ -291,7 +291,7 @@
 618  #endif
 619  
 620  char *getenv();
 621 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 622 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 623  
 624  extern struct encvec *enctovec();
 625  
 626 @@ -1223,7 +1223,7 @@
 627  {
 628  	char *p;
 629  	int dsock;					/* pvmd socket */
 630 -	struct sockaddr_in dsadr;	/* address of pvmd socket */
 631 +	struct SOCKADDR_IN dsadr;	/* address of pvmd socket */
 632  	int n;
 633  	int pvminfo[SIZEHINFO];		/* ntask, hostpart, ptid, MTU, NDF */
 634  	char nullmsg[TDFRAGHDR+TTMSGHDR];
 635 @@ -1234,14 +1234,14 @@
 636  		exit(2);
 637  	}
 638  	mpierrcode = 0;
 639 -	if ((dsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 640 +	if ((dsock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 641  		pvmlogperror("pvmhost() socket");
 642  		MPI_Finalize();
 643  		exit(3);
 644  	}
 645  	BZERO((char*)&dsadr, sizeof(dsadr));
 646  	hex_inadport(p, &dsadr);
 647 -	dsadr.sin_family = AF_INET;
 648 +	dsadr.sin_family = AF_FAMILY;
 649  	n = sizeof(dsadr);
 650  	while (connect(dsock, (struct sockaddr*)&dsadr, n) == -1)
 651  		if (errno != EINTR) {
 652 diff -ruN pvm3.old/src/lpvmshmem.c pvm3/src/lpvmshmem.c
 653 --- pvm3.old/src/lpvmshmem.c	2004-01-14 19:50:57.000000000 +0100
 654 +++ pvm3/src/lpvmshmem.c	2007-08-13 10:24:37.000000000 +0200
 655 @@ -503,7 +503,7 @@
 656  
 657  char *getenv();
 658  
 659 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 660 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 661  
 662  /* These prototypes stop compiler casting structs to ints... */
 663  struct pmsg *midtobuf(); /* Oops someone forgot this one KEV/GEF */
 664 @@ -584,7 +584,7 @@
 665  static int pvminboxsz = 0;				/* size of incoming message buffer */
 666  static int mypidtid = -1;				/* my position in pid-tid table */
 667  static int pvmdpid = 0;					/* pvmd's Unix proc ID */
 668 -static struct sockaddr_in pvmdsad;		/* address of pvmd socket */
 669 +static struct SOCKADDR_IN pvmdsad;		/* address of pvmd socket */
 670  static int pvmdsock = -1;				/* pvmd socket descriptor */
 671  
 672  static void (*pvmoldtermhdlr)() = 0;
 673 @@ -638,7 +638,7 @@
 674  	}
 675  
 676  	hex_inadport(p, &pvmdsad);
 677 -	pvmdsad.sin_family = AF_INET;
 678 +	pvmdsad.sin_family = AF_FAMILY;
 679  }
 680  
 681  
 682 @@ -654,7 +654,7 @@
 683  	static char dummy[TDFRAGHDR];
 684  
 685  	if (pvmdsock == -1) {
 686 -		if ((pvmdsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 687 +		if ((pvmdsock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 688  			pvmlogperror("prodpvmd() socket");
 689  			return;
 690  		}
 691 @@ -2698,7 +2698,7 @@
 692  
 693  	char *txcp = 0;				/* point to remainder of txfp */
 694  	int txtogo = 0;				/* len of remainder of txfp */
 695 -	struct sockaddr_in sad;
 696 +	struct SOCKADDR_IN sad;
 697  	int s;
 698  	struct msgid *sendmsg = (struct msgid *) NULL;
 699  	char errtxt[64];
 700 diff -ruN pvm3.old/src/mppmsg.c pvm3/src/mppmsg.c
 701 --- pvm3.old/src/mppmsg.c	2004-01-14 19:50:58.000000000 +0100
 702 +++ pvm3/src/mppmsg.c	2007-08-13 10:24:37.000000000 +0200
 703 @@ -63,7 +63,7 @@
 704  
 705  /* --- external declarations */
 706  
 707 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 708 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 709  
 710  extern int errno;
 711  extern int pvmdebmask;           /* from pvmd.c */
 712 @@ -830,7 +830,7 @@
 713  {
 714  	char *p;
 715  	int dsock;					/* pvmd socket */
 716 -	struct sockaddr_in dsadr;	/* address of pvmd socket */
 717 +	struct SOCKADDR_IN dsadr;	/* address of pvmd socket */
 718  	int n;
 719  	int i;
 720  	int cc;
 721 @@ -851,14 +851,14 @@
 722  		pvm_mpp_message_stop();
 723  		exit(2);
 724  	}
 725 -	if ((dsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
 726 +	if ((dsock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
 727  		pvmlogperror("pvmhost() socket");
 728  		pvm_mpp_message_stop();
 729  		exit(3);
 730  	}
 731  	BZERO((char*)&dsadr, sizeof(dsadr));
 732  	hex_inadport(p, &dsadr);
 733 -	dsadr.sin_family = AF_INET;
 734 +	dsadr.sin_family = AF_FAMILY;
 735  	n = sizeof(dsadr);
 736  	while (connect(dsock, (struct sockaddr*)&dsadr, n) == -1)
 737  		if (errno != EINTR) {
 738 diff -ruN pvm3.old/src/OS2/src/rexec.c pvm3/src/OS2/src/rexec.c
 739 --- pvm3.old/src/OS2/src/rexec.c	1997-08-28 23:30:49.000000000 +0200
 740 +++ pvm3/src/OS2/src/rexec.c	2007-08-13 10:24:37.000000000 +0200
 741 @@ -55,12 +55,12 @@
 742  	int *fd2p;
 743  {
 744  	int s, timo = 1, s3;
 745 -	struct sockaddr_in sin, sin2, from;
 746 +	struct SOCKADDR_IN sin, sin2, from;
 747  	char c;
 748  	u_short port;
 749  	struct hostent *hp;
 750  	static char savename[256];
 751 -	hp = gethostbyname(*ahost);
 752 +	hp = GETHOSTBYNAME(*ahost);
 753  	if (hp == 0) {
 754  		fprintf(stderr, "%s: unknown host\n", *ahost);
 755  		return (-1);
 756 @@ -72,7 +72,7 @@
 757  	ruserpass(*ahost, &name, &pass);
 758  /* stdlog("rexec: %s %s %s %s\n",*ahost,name,pass,cmd); */
 759  retry:
 760 -	s = socket(AF_INET, SOCK_STREAM, 0);
 761 +	s = socket(PF_FAMILY, SOCK_STREAM, 0);
 762  	if (s < 0) {
 763  		perror("rexec: socket");
 764  		return (-1);
 765 @@ -94,7 +94,7 @@
 766  		char num[8];
 767  		int s2, sin2len;
 768  		
 769 -		s2 = socket(AF_INET, SOCK_STREAM, 0);
 770 +		s2 = socket(PF_FAMILY, SOCK_STREAM, 0);
 771  		if (s2 < 0) {
 772  			(void) close(s);
 773  			return (-1);
 774 diff -ruN pvm3.old/src/OS2/src/ruserpas.c pvm3/src/OS2/src/ruserpas.c
 775 --- pvm3.old/src/OS2/src/ruserpas.c	1997-08-28 23:30:50.000000000 +0200
 776 +++ pvm3/src/OS2/src/ruserpas.c	2007-08-13 10:24:37.000000000 +0200
 777 @@ -48,11 +48,11 @@
 778  
 779  	strncpy(name, host, sizeof(name) - 1);
 780  
 781 -	if (hp = gethostbyname (name))
 782 +	if (hp = GETHOSTBYNAME (name))
 783  		strncpy(name,hp->h_name, sizeof(name) - 1);
 784  	renv(name, aname, apass);
 785  	if (*aname == 0 || *apass == 0)
 786 -		rnetrc(name,aname,apass); /*rnetrc would call gethostbyname */
 787 +		rnetrc(name,aname,apass); /*rnetrc would call GETHOSTBYNAME */
 788  	if (*aname == 0) {
 789  		*aname = getlogin();
 790  		if (*aname == NULL) {
 791 @@ -191,7 +191,7 @@
 792  	case MACHINE:
 793  		if (token() != ID)
 794  			continue;
 795 -		if(hp = gethostbyname (tokval))
 796 +		if(hp = GETHOSTBYNAME (tokval))
 797  		{
 798  			if (strcmp(host, hp->h_name))
 799  				continue;
 800 diff -ruN pvm3.old/src/pvmcruft.c pvm3/src/pvmcruft.c
 801 --- pvm3.old/src/pvmcruft.c	2004-03-10 18:01:27.000000000 +0100
 802 +++ pvm3/src/pvmcruft.c	2007-08-13 10:24:37.000000000 +0200
 803 @@ -673,17 +673,40 @@
 804  /*	hex_inadport()
 805  *
 806  *	Takes a string of format 00000000:0000 and returns a sockaddr_in.
 807 +*	Alternatively, takes a string of format [2a03:800:40ec::10]:8a43 and returns a SOCKADDR_IN
 808  */
 809  
 810  void
 811  hex_inadport(s, sad)
 812  	char *s;
 813 -	struct sockaddr_in *sad;
 814 +	struct SOCKADDR_IN *sad;
 815  {
 816 +#ifdef INET6
 817 +	char hostname[INET6_ADDRSTRLEN];
 818 +	char *aux;
 819 +	strncpy(hostname,s+1,INET6_ADDRSTRLEN);  // Shift the initial	'['
 820 +	aux = strchr(hostname,']');
 821 +	*aux = '\0';                      	 // Drop the final	']'             
 822 +	s = (s = CINDEX(s, ']')) ? s + 2 : "";  // Get the port beyond ']:'
 823 +	FAMILY_FROM_SA(*sad)=AF_FAMILY;
 824 +        inet_pton(AF_FAMILY,hostname,&ADDR_FROM_SA(*sad));
 825 +	PORT_FROM_SA(*sad) = htons((unsigned short)pvmxtoi(s));
 826 +#else
 827  	sad->sin_addr.s_addr = htonl((unsigned)pvmxtoi(s));
 828  	s = (s = CINDEX(s, ':')) ? s + 1 : "";
 829  	sad->sin_port = htons((unsigned short)pvmxtoi(s));
 830 +#endif
 831 +}
 832 +
 833 +
 834 +#ifdef INET6
 835 +const char * inet6_ntoa(const struct in6_addr in)
 836 +{
 837 +    static char buff[INET6_ADDRSTRLEN];
 838 +
 839 +    return (const char *)inet_ntop(AF_INET6, &in, buff, INET6_ADDRSTRLEN);
 840  }
 841 +#endif
 842  
 843  
 844  /*	inadport_decimal()
 845 @@ -693,11 +716,14 @@
 846  
 847  char *
 848  inadport_decimal(sad)
 849 -	struct sockaddr_in *sad;
 850 +	struct SOCKADDR_IN *sad;
 851  {
 852 +#ifdef INET6
 853 +	static char buf[INET6_ADDRSTRLEN+2+20];
 854 +	sprintf(buf, "[%s]:%d",SA_NTOA(*sad),(int)ntohs(PORT_FROM_SA(*sad)));
 855 +#else
 856  	static char buf[32];
 857  	int a;
 858 -
 859  	a = ntohl(0xffffffff & sad->sin_addr.s_addr);
 860  	sprintf(buf, "%d.%d.%d.%d:%d",
 861  			0xff & (a >> 24),
 862 @@ -705,6 +731,7 @@
 863  			0xff & (a >> 8),
 864  			0xff & a,
 865  			0xffff & (int)ntohs(sad->sin_port));
 866 +#endif
 867  	return buf;
 868  }
 869  
 870 @@ -714,15 +741,21 @@
 871  *	Returns printable string corr. to sockaddr_in with addr in hex.
 872  */
 873  
 874 +
 875  char *
 876  inadport_hex(sad)
 877 -	struct sockaddr_in *sad;
 878 +	struct SOCKADDR_IN *sad;
 879  {
 880 +#ifdef INET6
 881 +	static char buf[INET6_ADDRSTRLEN+2+20];
 882 +	sprintf(buf, "[%s]:%04x", SA_NTOA(*sad), 0xffff & ntohs(PORT_FROM_SA(*sad)));
 883 +#else
 884  	static char buf[16];
 885  	int a;
 886  
 887  	a = ntohl(0xffffffff & sad->sin_addr.s_addr);
 888  	sprintf(buf, "%08x:%04x", a, 0xffff & (int)ntohs(sad->sin_port));
 889 +#endif
 890  	return buf;
 891  }
 892  
 893 diff -ruN pvm3.old/src/pvmd.c pvm3/src/pvmd.c
 894 --- pvm3.old/src/pvmd.c	2004-09-08 21:35:36.000000000 +0200
 895 +++ pvm3/src/pvmd.c	2007-08-13 10:24:37.000000000 +0200
 896 @@ -749,6 +749,8 @@
 897  #include <pvmtev.h>
 898  #include "global.h"
 899  
 900 +#include "pvmipv6.h"
 901 +
 902  #ifdef IMA_CRAY
 903  #define MAXPATHLEN PATH_MAX+1
 904  #endif
 905 @@ -810,7 +812,7 @@
 906  char *pvmgetroot();
 907  void reap();
 908  void i_dump();
 909 -void hex_inadport __ProtoGlarp__ (( char *, struct sockaddr_in * ));
 910 +void hex_inadport __ProtoGlarp__ (( char *, struct SOCKADDR_IN * ));
 911  void mesg_rewind __ProtoGlarp__ (( struct pmsg * ));
 912  void locl_spawn();
 913  /* void make_valid(char *n); sls */
 914 @@ -1805,7 +1807,7 @@
 915  #else
 916  				int oslen;
 917  #endif
 918 -				struct sockaddr_in osad;
 919 +				struct SOCKADDR_IN osad;
 920  				struct timeval t;
 921  				char buf[DDFRAGHDR];
 922  
 923 @@ -2391,7 +2393,7 @@
 924  int
 925  netinput()
 926  {
 927 -	struct sockaddr_in osad;		/* sender's ip addr */
 928 +	struct SOCKADDR_IN osad;		/* sender's ip addr */
 929  #ifdef SOCKLENISUINT
 930  #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2) \
 931  		|| defined(IMA_AIX56K64) || defined(IMA_LINUXALPHA)
 932 @@ -2481,8 +2483,8 @@
 933  	* XXX removing these lines is a hack and reduces security between
 934  	* XXX pvmds somewhat, but it's the easiest fix for Linux right now.
 935  	*/
 936 -	|| (osad.sin_addr.s_addr != hp->hd_sad.sin_addr.s_addr)
 937 -	|| (osad.sin_port != hp->hd_sad.sin_port)
 938 +	    || (!ADDR_EQUALS(ADDR_FROM_SA(osad),ADDR_FROM_SA(hp->hd_sad)))
 939 +	|| (PORT_FROM_SA(osad) != PORT_FROM_SA(hp->hd_sad))
 940  /* #endif */
 941  	) {
 942  		pvmlogprintf("netinput() bogus pkt from %s\n",
 943 @@ -4820,7 +4822,7 @@
 944  {
 945  	struct hostd *hp = hosts->ht_hosts[hosts->ht_local];
 946  	struct hostd *hp0 = hosts->ht_hosts[0];
 947 -	struct sockaddr_in sin;
 948 +	struct SOCKADDR_IN sin;
 949  	char buf[128];
 950  	char *sfn;
 951  #ifndef WIN32
 952 @@ -4857,7 +4859,7 @@
 953  	* make pvmd-pvmd socket
 954  	*/
 955  
 956 -	if ((netsock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
 957 +	if ((netsock = socket(PF_FAMILY, SOCK_DGRAM, 0)) == -1) {
 958  		pvmlogperror("mksocs() socket netsock");
 959  		return 1;
 960  	}
 961 @@ -4866,7 +4868,7 @@
 962  
 963  	tmpp = (p) ? atoi(p) : 0;
 964  
 965 -	hp->hd_sad.sin_port = htons(tmpp);
 966 +	PORT_FROM_SA(hp->hd_sad) = htons(tmpp);
 967  
 968  	do
 969  	{
 970 @@ -4876,14 +4878,14 @@
 971  		{
 972  			if (p) {
 973  				tmpp++;
 974 -				hp->hd_sad.sin_port = htons(tmpp);
 975 +				PORT_FROM_SA(hp->hd_sad) = htons(tmpp);
 976  			} else {
 977  				pvmlogperror("mksocs() bind netsock");
 978  				return 1;
 979  			}
 980  		}
 981  	}
 982 -	while ( cc == -1 && p && hp->hd_sad.sin_port < 65535 );
 983 +	while ( cc == -1 && p && PORT_FROM_SA(hp->hd_sad) < 65535 );
 984  
 985  	if ( cc == -1 ) {
 986  		pvmlogperror("mksocs() bind netsock");
 987 @@ -4900,12 +4902,12 @@
 988  	* make pvmd-pvmd' socket
 989  	*/
 990  
 991 -	if ((ppnetsock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
 992 +	if ((ppnetsock = socket(PF_FAMILY, SOCK_DGRAM, 0)) == -1) {
 993  		pvmlogperror("mksocs() socket ppnetsock");
 994  		return 1;
 995  	}
 996  
 997 -	hp0->hd_sad.sin_port = 0;
 998 +	PORT_FROM_SA(hp0->hd_sad) = 0;
 999  	oslen = sizeof(hp0->hd_sad);
1000  	if (bind(ppnetsock, (struct sockaddr*)&hp0->hd_sad, oslen) == -1) {
1001  		pvmlogperror("mksocs() bind ppnetsock");
1002 @@ -4922,7 +4924,7 @@
1003  	*/
1004  
1005  #ifdef NOUNIXDOM
1006 -	if ((loclsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
1007 +	if ((loclsock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
1008  		pvmlogperror("mksocs() socket loclsock");
1009  		return 1;
1010  	}
1011 @@ -4939,24 +4941,24 @@
1012  
1013  #ifdef IMA_BEOLIN
1014  	/* allow connection from another node */
1015 -	sin.sin_family = AF_INET;
1016 +	sin.sin_family = AF_FAMILY;
1017  	if (gethostname(buf, sizeof(buf)-1) == -1) {
1018  		pvmlogerror("mksocs() can't gethostname()\n");
1019  		return 1;
1020  	} else {
1021  		/* got name, now get addr */
1022 -		if (!(hostaddr = gethostbyname( buf ))) {
1023 -			pvmlogprintf( "mksocs() can't gethostbyname() for %s\n", buf );
1024 +		if (!(hostaddr = GETHOSTBYNAME( buf ))) {
1025 +			pvmlogprintf( "mksocs() can't GETHOSTBYNAME() for %s\n", buf );
1026  			return 1;
1027  		} else {
1028  			/* got addr, now save it */
1029  			BCOPY( hostaddr->h_addr_list[0], (char*)&sin.sin_addr,
1030 -					sizeof(struct in_addr));
1031 +					sizeof(struct IN_ADDR));
1032  		}
1033  	}
1034  	sin.sin_port = 0;
1035  #else
1036 -	sin.sin_family = AF_INET;
1037 +	sin.sin_family = AF_FAMILY;
1038  	sin.sin_addr.s_addr = htonl(0x7f000001);
1039  	sin.sin_port = 0;
1040  #endif
1041 @@ -5370,17 +5372,17 @@
1042  		pvmlogperror(s);
1043  	PVM_FREE(s);
1044  
1045 -	if (!(he = gethostbyname(hp->hd_aname ? hp->hd_aname : hp->hd_name))) {
1046 -		pvmlogprintf("master_config() %s: can't gethostbyname\n", hn);
1047 +	if (!(he = GETHOSTBYNAME(hp->hd_aname ? hp->hd_aname : hp->hd_name))) {
1048 +		pvmlogprintf("master_config() %s: can't GETHOSTBYNAME\n", hn);
1049  		pvmbailout(0);
1050  	}
1051  
1052 -	BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
1053 -		sizeof(struct in_addr));
1054 +	BCOPY(he->h_addr_list[0], (char*)&ADDR_FROM_SA(hp->hd_sad),
1055 +		sizeof(struct IN_ADDR));
1056  
1057  	hp = hosts->ht_hosts[0];
1058 -	BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
1059 -		sizeof(struct in_addr));
1060 +	BCOPY(he->h_addr_list[0], (char*)&ADDR_FROM_SA(hp->hd_sad),
1061 +		sizeof(struct IN_ADDR));
1062  
1063  	if (pvmdebmask & (PDMHOST|PDMSTARTUP)) {
1064  		pvmlogerror("master_config() host table:\n");
1065 diff -ruN pvm3.old/src/pvmipv6.h pvm3/src/pvmipv6.h
1066 --- pvm3.old/src/pvmipv6.h	1970-01-01 01:00:00.000000000 +0100
1067 +++ pvm3/src/pvmipv6.h	2007-08-13 10:24:37.000000000 +0200
1068 @@ -0,0 +1,48 @@
1069 +
1070 +#ifndef __pvmipv6_
1071 +#define __pvmipv6_
1072 +
1073 +#ifdef INET6
1074 +#define IN_ADDR in6_addr
1075 +#define SOCKADDR_IN sockaddr_in6
1076 +#define MAXIPSTRLEN INET6_ADDRSTRLEN   /* 46 */
1077 +#define PF_FAMILY PF_INET6
1078 +#define AF_FAMILY AF_INET6
1079 +#define ADDR_IS_LOOPBACK(s) \
1080 +    (memcmp(&(s), &in6addr_loopback, sizeof(&in6addr_loopback)) == 0)
1081 +#define SA_NTOA(s)                                      \
1082 +    inet6_ntoa((s).sin6_addr)
1083 +#define ADDR_FROM_SA(s)                                 \
1084 +    ((s).sin6_addr)
1085 +#define PORT_FROM_SA(s)                                 \
1086 +    ((s).sin6_port)
1087 +#define FAMILY_FROM_SA(s)                               \
1088 +    ((s).sin6_family)
1089 +#define ADDR_EQUALS(s1,s2)                                     \
1090 +    (memcmp(&(s1), &(s2), sizeof(struct IN_ADDR)) == 0)
1091 +#define GETHOSTBYNAME(name)                             \
1092 +    gethostbyname2(name, AF_INET6)
1093 +
1094 +
1095 +#else
1096 +#define IN_ADDR in_addr
1097 +#define SOCKADDR_IN sockaddr_in
1098 +#define MAXIPSTRLEN INET_ADDRSTRLEN   /* 16 */
1099 +#define PF_FAMILY PF_INET
1100 +#define AF_FAMILY AF_INET
1101 +#define ADDR_IS_LOOPBACK(s) \
1102 +   ((s).s_addr == htonl(0x7f000001))
1103 +#define SA_NTOA(s)                                      \
1104 +    inet_ntoa((s).sin_addr)
1105 +#define ADDR_FROM_SA(s)                                 \
1106 +    ((s).sin_addr)
1107 +#define PORT_FROM_SA(s)                                 \
1108 +    ((s).sin_port)
1109 +#define FAMILY_FROM_SA(s)                               \
1110 +    ((s).sin_family)
1111 +#define ADDR_EQUALS(s1,s2)                                     \
1112 +    (memcmp(&(s1), &(s2), sizeof(struct IN_ADDR)) == 0)
1113 +#define GETHOSTBYNAME(name)                             \
1114 +    gethostbyname(name)
1115 +#endif
1116 +#endif /* not defined __pvmipv6_ */
1117 diff -ruN pvm3.old/src/SP2MPI/pvmdmimd.c pvm3/src/SP2MPI/pvmdmimd.c
1118 --- pvm3.old/src/SP2MPI/pvmdmimd.c	2002-02-22 00:19:41.000000000 +0100
1119 +++ pvm3/src/SP2MPI/pvmdmimd.c	2007-08-13 10:24:37.000000000 +0200
1120 @@ -852,13 +852,13 @@
1121  mksock()
1122  {	
1123  	struct hostd *hp = hosts->ht_hosts[hosts->ht_local];
1124 -	struct sockaddr_in sin;
1125 +	struct SOCKADDR_IN sin;
1126  	char buf[128];
1127  	char *p;
1128  	int cc;
1129  	int sock;
1130  
1131 -	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
1132 +	if ((sock = socket(PF_FAMILY, SOCK_STREAM, 0)) == -1) {
1133  		pvmlogperror("mksock() socket");
1134  		return -1;
1135  	}
1136 diff -ruN pvm3.old/src/task.h pvm3/src/task.h
1137 --- pvm3.old/src/task.h	2000-06-16 18:27:33.000000000 +0200
1138 +++ pvm3/src/task.h	2007-08-13 10:24:37.000000000 +0200
1139 @@ -106,6 +106,7 @@
1140   *
1141   */
1142  
1143 +#include "pvmipv6.h"
1144  
1145  /* descriptor for a pvm task */
1146  
1147 @@ -122,7 +123,7 @@
1148  	int t_flag;					/* status */
1149  	int t_pid;					/* unix pid */
1150  	int t_sock;					/* t-d tcp socket */
1151 -	struct sockaddr_in t_sad;	/* addr of sock */
1152 +	struct SOCKADDR_IN t_sad;	/* addr of sock */
1153  	int t_salen;				/* addr length */
1154  	struct waitc *t_wait;		/* wait channel */
1155  	struct pkt *t_txq;			/* to task */

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-08-16 11:18:23, 34.8 KB) [[attachment:pvm3-3.3.5-v6-13082007.diff]]
  • [get | view] (2007-08-16 11:16:40, 34.8 KB) [[attachment:pvm3-3.3.5-v6-13082007.diff.txt]]
  • [get | view] (2007-08-16 11:17:49, 34.3 KB) [[attachment:pvm3-3.4.4-v6-23042005.diff]]
  • [get | view] (2007-08-16 11:16:09, 34.3 KB) [[attachment:pvm3-3.4.4-v6-23042005.diff.txt]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.