[net.unix-wizards] rwhod fails on point to point links

salkind%nyu@sri-unix.UUCP (03/07/84)

From:  Lou Salkind <salkind@nyu>

Subject: rwhod fails on point to point links
Index:	etc/rwhod/rwhod.c 4.2BSD

Description:
	rwhod will not send datagram packets over point to point links.
Fix:
	The problem is that the SIOCGIFxxx calls clobber the ifr_name field.
	The easy solution is just to have rwhod.c to set this field again.
	Add the following strcpy line (around line 366) in rwhod.c:
	
		if (np->n_flags & IFF_POINTOPOINT) {
			strcpy(ifreq.ifr_name, ifr->ifr_name);
			if (ioctl(s, SIOCGIFDSTADDR, (char *)&ifreq) < 0) {

	Another reasonable thing to do is to change the kernel so that
	ifr_name doesn't get clobbered in the first place (I have done
	this).  To make this change, you will have to modify net/if.c:ifunit.
	Replace the line
		unit = *cp - '0', *cp = 0;
	with
		unit = *cp - '0';