Hello -

My ISP offers a 6rd border relay.  A while ago, I wrote up a hackish
way to use it with OpenBSD over at
http://undeadly.org/cgi?action=article&sid=20130828151241

I wanted to get 6rd working properly though.  I found a u6rd daemon at
http://www.scythe.jp/lab/u6rd/.  It has OpenBSD marked as broken due to
"Incoming 6rd packets go to ip4_input() instead of rip_input()."

I tried it out anyway.

# ./u6rd -u _u6rd tun0 2602:100::/32 68.114.165.1 24.247.20.162
u6rd: setsockopt(IP_HDRINCL): Protocol not available

bluhm@ provided a quick-hack diff for me to try, which is provided
below.  It got me further; it starts up and I can see inbound packets.

# ./u6rd -dF -u _u6rd tun0 2602:100::/32 68.114.165.1 24.247.20.162 
u6rd: u6rd/1.7.1 started
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72
in  2602:100:18f7:14a2::1 2607:f790:ffff:ff12:fffe::118 68.114.165.1 n=58 s=72

So I need to attach an IP somewhere.  Both the FreeBSD and NetBSD in the
u6rd manpage say I need an IPv6 address on tun0.

   NetBSD 5.1
     # ifconfig tun0 create
     # ifconfig tun0 inet6 2001:db8:cb00:7101::1/32
     # ndp -i tun0 -- -nud

If I attempt this on OpenBSD, I get:

# ifconfig tun0 inet6 2602:100:18f7:14a2::1/32
ifconfig: SIOCIFAFATTACH: Invalid argument
ifconfig: SIOCAIFADDR: Invalid argument
 
This is as far as I currently have gotten.  I am not sure if anyone else
is interested in getting 6rd to work on OpenBSD, so I am just posting my
progress here.

Here is the quick-hack diff from bluhm@:

Index: netinet/in_proto.c
===================================================================
RCS file: /cvs/src/sys/netinet/in_proto.c,v
retrieving revision 1.66
diff -u -p -r1.66 in_proto.c
--- netinet/in_proto.c  4 Sep 2015 08:43:39 -0000       1.66
+++ netinet/in_proto.c  16 Sep 2015 13:25:24 -0000
@@ -211,7 +211,7 @@ struct protosw inetsw[] = {
 },
 #ifdef INET6
 { SOCK_RAW,    &inetdomain,    IPPROTO_IPV6,   PR_ATOMIC|PR_ADDR,
-  in_gif_input,        rip_output,      0,             0,
+  in_gif_input,        rip_output,      0,             rip_ctloutput,
   rip_usrreq,  /*XXX*/
   0,           0,              0,              0,
 },
Index: netinet/ip_ipip.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_ipip.c,v
retrieving revision 1.67
diff -u -p -r1.67 ip_ipip.c
--- netinet/ip_ipip.c   11 Sep 2015 07:42:35 -0000      1.67
+++ netinet/ip_ipip.c   16 Sep 2015 13:25:24 -0000
@@ -120,7 +120,7 @@ ip4_input(struct mbuf *m, ...)
        if (!ipip_allow && (m->m_flags & (M_AUTH|M_CONF)) == 0) {
                DPRINTF(("ip4_input(): dropped due to policy\n"));
                ipipstat.ipips_pdrops++;
-               m_freem(m);
+               rip_input(m);
                return;
        }
 

Reply via email to