[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <14731dd6a7f7fda9e6a1704ce1fbc5a7@chewa.net>
Date: Thu, 28 Oct 2010 10:25:03 +0200
From: Rémi Denis-Courmont <remi@...lab.net>
To: Jan Engelhardt <jengelh@...ozas.de>
Cc: netdev@...r.kernel.org
Subject: Re: IPV6 raw socket denies bind(2)
On Thu, 28 Oct 2010 00:01:57 +0200 (CEST), Jan Engelhardt
<jengelh@...ozas.de> wrote:
> #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);
That should be:
inet_pton(AF_INET6, "::1", &src.sin6_addr);
No wonder it does not work.
--
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis
--
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