8.0 still allow creating ipv6 udp socket in jail without ipv6 ip

From: Mykola Dzham <freebsd_at_levsha.org.ua>
Date: Sat, 25 Jul 2009 19:32:07 +0300
Hi!
After r188146 creating tcp ipv6 socket in jail without ipv6 ip is not
allowed, but udp socket is allowed.
I use this code to test:

#include <netinet/in.h>
#include <sys/socket.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>

int main(int argc, char **argv)
{
	int	 sockfd;
	struct sockaddr_in servaddr;
	char sendline[] ="test";

	bzero(&servaddr, sizeof(servaddr));
	if( (sockfd = socket(AF_INET6, SOCK_DGRAM, 0))<0){
		fprintf(stderr, "socket(): %s\n", strerror(errno));
		return(1);
	}
	servaddr.sin_family = AF_INET;
	servaddr.sin_port = htons(12345);
	int r=inet_pton(AF_INET, "10.10.10.10", &servaddr.sin_addr);
	if(r<0){
		fprintf(stderr, "inet_pton(): %s\n", strerror(errno));
		return(1);
	}else if(r==0){
		fprintf(stderr, "call inet_pton() with incorrect address\n");
		return(1);
	}

	if( sendto(sockfd, sendline, strlen(sendline), 0, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0 ){
		fprintf(stderr, "socket(): %s\n", strerror(errno));
		return(1);
	}
	return(0);
}

Runing on FreeBSD 8.0-BETA2 #10: Mon Jul 20 13:56:01 EEST 2009 :
$ ./send                                             #
sendto(): Invalid argument

Runing on FreeBSD 7.1-PRERELEASE #0 r183080: Wed Sep 17 17:54:25 UTC 2008:
$ ./send                                           #
socket(): Protocol not supported

ktrace results for 8.0-BETA2 and 7.1-PRERELEASE attached

-- 
Mykola Dzham, LEFT-(UANIC|RIPE)
JID: levsha_at_jabber.net.ua

Received on Sat Jul 25 2009 - 14:31:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC