Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 May 2008 20:00:43 +1000
From:      Edwin Groothuis <edwin@mavetju.org>
To:        freebsd-net@freebsd.org
Subject:   IPPROTO_DIVERT and PF_INET6
Message-ID:  <20080503100043.GA68835@k7.mavetju>

next in thread | raw e-mail | index | archive | help
Greetings,

Before somebody shoots me down on it: I know that ipfw_divert() is
not suitable for IPv6 packets.

So, to the point. This code:

	struct sockaddr_in6     addr6;
        struct in6_addr ip6_any = IN6ADDR_ANY_INIT;

        sin = socket(PF_INET6, SOCK_RAW, IPPROTO_DIVERT);
        if (sin == -1)
                errx(1, "Unable to create sin socket.");
        if (sin > fdmax)
                fdmax = sin;

        addr6.sin6_family = AF_INET6;
        addr6.sin6_addr = ip6_any;
        addr6.sin6_port = htons(8669);

        if (bind(sin, (struct sockaddr *) &addr6, sizeof(addr6)) == -1)
                errx(1, "Unable to bind incoming divert socket: %s",
                    strerror(errno));

compiles and run fine, but it gives me this in the lsof output:

    nat6to4d  67887       root    3u    IPv6 0xc8b05000        0t0  HOPOPTS *:*

HOPOPTS is "0" according to /etc/protocols. Making everything IPv4,
it gives this:

    nat6to4d  67899       root    3u    IPv4 0xc865421c        0t0   DIVERT *:8669

which is what I expected. So why doesn't this get displayed for the
IPv6 sockets?

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080503100043.GA68835>