Module Name:    src
Committed By:   kre
Date:           Thu Feb  9 11:43:32 UTC 2017

Modified Files:
        src/sys/net: if_srt.c

Log Message:
PR kern/51280

This allows srt devices to work for IPv6.   srt still needs work
(particularly #ifdef INET6 but also general effeciency and similar.)


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/net/if_srt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_srt.c
diff -u src/sys/net/if_srt.c:1.24 src/sys/net/if_srt.c:1.25
--- src/sys/net/if_srt.c:1.24	Sat Jan 14 16:34:44 2017
+++ src/sys/net/if_srt.c	Thu Feb  9 11:43:32 2017
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.24 2017/01/14 16:34:44 maya Exp $ */
+/* $NetBSD: if_srt.c,v 1.25 2017/02/09 11:43:32 kre Exp $ */
 /* This file is in the public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.24 2017/01/14 16:34:44 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.25 2017/02/09 11:43:32 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -35,6 +35,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1
 #include <sys/device.h>
 #include <netinet/ip.h>
 #include <netinet/ip6.h>
+#include <netinet6/in6_var.h>
+#include <netinet6/nd6.h>
+#include <netinet6/scope6_var.h>
 #include <net/if_types.h>
 
 #include "if_srt.h"
@@ -236,6 +239,8 @@ srt_if_output(
 		return 0; /* XXX ENETDOWN? */
 	}
 	/* XXX is 0 the right last arg here? */
+	if (to->sa_family == AF_INET6)
+		return nd6_output(r->u.dstifp, r->u.dstifp, m, &r->dst.sin6, 0);
 	return if_output_lock(r->u.dstifp, r->u.dstifp, m, &r->dst.sa, 0);
 }
 
@@ -466,6 +471,8 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		scr->srcmask = dr->srcmask;
 		scr->u.dstifp = ifp;
 		memcpy(&scr->dst,&dr->dst,dr->dst.sa.sa_len);
+		if (dr->af == AF_INET6)
+			in6_setzoneid(&scr->dst.sin6.sin6_addr, ifp->if_index);
 		update_mtu(sc);
 		return 0;
 	case SRT_DELRT:

Reply via email to