lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.01.1010280000260.7820@obet.zrqbmnf.qr>
Date:	Thu, 28 Oct 2010 00:01:57 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...ozas.de>
To:	netdev@...r.kernel.org
cc:	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: IPV6 raw socket denies bind(2)

[Doublepost: linux-netdev does not exist. Sigh. "netdev" is totally 
nonstandard to all the other linux-* list names. :-?]

Hi,


I was trying out raw sockets and stumbled into a case whereby I cannot 
call bind(2) on a AF_INET6, SOCK_RAW socket. Apparently, I am triggering 
this particular code path that means absolutely nothing to me:

# ./rawtest

kernel pseudo callgraph:
static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int 
addr_len)
addr >= SIN6_LEN_RFC2133
addr_type != IPV6_ADDR_MAPPED
sk->sk_state == TCP_CLOSED
addr_type != IPV6_ADDR_ANY
!(addr_type & IPV6_ADDR_LINKLOCAL)
!(addr_type & IPV6_ADDR_MULTICAST)
dev == NULL
ipv6_chk_addr does not have any addresses to loop through (wtf? checked 
with printk.)
=> going -EADDRNOTAVAIL

At this point I have no idea why ipv6_chk_addr does not run through 
its loop. No devices in the hash bucket or something. Happens in 
2.6.36. I hope somebody can shed some light here.

---Userspace testcase---
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <netinet/udp.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <arpa/inet.h>
#include <stdlib.h>

int main(void)
{
	struct sockaddr_in6 src = {};
	int sk;

	sk = socket(AF_INET6, SOCK_RAW, IPPROTO_UDP);
	memset(&src, 0, sizeof(src));
	inet_pton(AF_INET6, "::1", &src);
	src.sin6_family = AF_INET6;

	if (bind(sk, (void *)&src, sizeof(src)) < 0) {
		perror("bind");
		abort();
	}
	return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ