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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 27 Oct 2010 19:54:54 -0400
From:	Brian Haley <brian.haley@...com>
To:	Jan Engelhardt <jengelh@...ozas.de>
CC:	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: IPV6 raw socket denies bind(2)

On 10/27/2010 06:01 PM, Jan Engelhardt wrote:
> 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;
> }

You're trashing the sockaddr, try this patch:

< 	inet_pton(AF_INET6, "::1", &src);
---
> 	inet_pton(AF_INET6, "::1", &src.sin6_addr);

-Brian
--
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