Hi all,

I have some questions regarding accomplishing the strong model for
ingress IPv6 traffic with FreeBSD, as implemented in ip6_input.c.

Does it make sense to have a strong ES model in IPv6 *at all*?  I’ve
yet to find any wording in the RFC’s referring to this – although
nothing explicitly disallowing it.  Given that addresses that are
globally scoped are “global” I could understand why a stack might make
the choice to not do this, as the address may be considered attached
to the “system” rather than the interface.  However for separating
networks at a basic level this isn’t appropriate.  I realise that pF
is an option in this case, but arguably it’s an option in ipv4 too –
so why default ipv4 to strong model?

Also of note, the KAME code in NetBSD reference’s a sysctl
“net.inet6.ip6.sourcecheck” which is never used, but seems to indicate
an intention to implement something like this.  Was the intention to
implement the strong model for ingress IPv6 traffic with this switch?

This patch attempts to implement the strong model using the same
sysctl as in NetBSD, note that multicast listeners already handle
which interface they arrive at.  There’s some thought that probably
needs to go into using it in combination with ip_forwarding and other
sysctls, but it wasn’t too difficult given the interface address list
is already traversed upfront before the routeing table lookup.  Does
anybody know why this is, was something else intended here?

I’ve hammered my code with isic6/tcpsic6/udpsic6 for a few hours with
and without listening sockets and nothing caught fire.  I haven’t
tried using TAHI yet although given my rig it’s a bit more complicated
to setup.

Any guidance is greatly appreciated.

--
This patch is on release 8.2, although if necessary I can port it up
if this is unacceptably old now :).  It implements the
“net.inet6.ip6.sourcecheck” sysctl which when set to 1 will drop
packets if they’re not for addresses configured on the interface on
which they arrived.  This is intended to implement RFC 1122’s “Strong
end system model” for IPv6.
--

diff -r 8b21c9a98cbd src/sys/netinet6/ip6_input.c
--- a/src/sys/netinet6/ip6_input.c      Mon Apr 02 14:15:19 2012 +0100
+++ b/src/sys/netinet6/ip6_input.c      Tue May 01 14:32:30 2012 +0100
@@ -80,6 +80,7 @@
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
+#include <sys/sysctl.h>

 #include <net/if.h>
#include <net/if_types.h>
@@ -125,6 +126,11 @@
        .nh_policy = NETISR_POLICY_FLOW, };

+/* Take this variable name from NetBSD, but exposing it as a sysctl */
+static unsigned ip6_sourcecheck = 0; SYSCTL_DECL(_net_inet6);
+SYSCTL_UINT(_net_inet6, OID_AUTO, sourcecheck, CTLFLAG_RW,
+&ip6_sourcecheck, 0, "Check packets destination address is configured
+on the incoming interface RFC1122");
+
VNET_DECLARE(struct callout, in6_tmpaddrtimer_ch);
#define        V_in6_tmpaddrtimer_ch           VNET(in6_tmpaddrtimer_ch)

@@ -599,6 +605,10 @@
        if (lle != NULL)
                LLE_RUNLOCK(lle);

+       /*XXX AlexY if ip6_sourcecheck is set we immediately assume it's bad*/
+       if (0 != ip6_sourcecheck)
+               goto bad;
+
        dst = &rin6.ro_dst;
        dst->sin6_len = sizeof(struct sockaddr_in6);
        dst->sin6_family = AF_INET6;
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to