IPv6 raw socket to send original udp

JINMEI Tatuya / 神明達哉 jinmei at isl.rdc.toshiba.co.jp
Tue May 16 12:13:45 UTC 2006


>>>>> On Mon, 08 May 2006 05:44:51 +0900 (JST), 
>>>>> Hideki Yamamoto <yamamoto436 at oki.com> said:

> I wonder if IPv6 raw socket can be used only for ICMPv6.

No, you can use any non built-in protocols on an IPv6 raw socket.  In
fact, IPv6 PIM daemons use IPv6 raw sockets for IPPROTO_PIM.  But...

> I would like to use IPv6 raw socket for original udp packet.

you cannot do this, and, even if it's a PIM packet (for example), I'm
afraid the socket does not meet your requirement: you cannot specify
an arbitrary source address for the packets, which I guess is one of
your goals.  With the IPv6 socket API you can only specify a node's
own address as the source address of outgoing packets sent from an
AF_INET6 socket.

This is a deliberate design choice of the API (RFC2292 or RFC3542).  I
don't know the original intent of IP_HDRINCL, that is, whether it
intentionally allows the specification of an arbitrary source
address, but at least one clear purpose of this option is to allow the
user to specify the value of some specific fields of the IP header.
Since RFC3542 (and RFC3493) provide dedicated API knobs for this
purpose, however, we don't need to provide an IPv6 version of
IP_HDRINCL.

So, if a program needs to specify an arbitrary source IPv6 address for
outgoing packets, it should use other "packet injection" interface
such as BPF.

					JINMEI, Tatuya
					Communication Platform Lab.
					Corporate R&D Center, Toshiba Corp.
					jinmei at isl.rdc.toshiba.co.jp


More information about the freebsd-pf mailing list