Subject: Re: COMPAT_SUNOS & socreate().
To: Darren Reed <darrenr@reed.wattle.id.au>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 08/25/2001 20:30:59
matthew green wrote:
> what sunos programs rely on this behaviour?

As I read the code, it permits UDP broadcasting by default for all programs
running under SunOS emulation, where NetBSD programs are expected to switch
broadcasting on via setsockopt(s, SO_BROADCAST, ...) first it seems.
I expect this to match what SunOS did. So, I expect that every SunOS program
using UDP&broadcasting might need this.

So, something like this might be good test:

int
main()
{
	int s;
	struct sockaddr_in sin;

	s = socket(AF_INET, SOCK_DGRAM, 0);
	
	sin.sin_len = sizeof(sin);
	sin.sin_family = PF_INET;
	sin.sin_port = hton(SOMEPORT);
	sin.sin_addr = inet_addr("192.168.0.255"); /* XXX some broadcast addr*/

	if (sento(s, "foobar", 6, 0, (void *) &sin, sizeof(sin)) < 0)
		printf("failed");
}

The sendto should return EACCESS on NetBSD for broadcast
addresses, but should succeed (or return other error) for programs
under SunOS emulation.

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!