Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet check AF_INET6 socketes when IPv4 "too big" mess...



details:   https://anonhg.NetBSD.org/src/rev/6bb3fa086106
branches:  trunk
changeset: 533487:6bb3fa086106
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jul 01 20:51:25 2002 +0000

description:
check AF_INET6 socketes when IPv4 "too big" messages arrive.
PR 17448

diffstat:

 sys/netinet/tcp_subr.c |  35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diffs (72 lines):

diff -r 7f61d3fdc4d8 -r 6bb3fa086106 sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Mon Jul 01 20:31:32 2002 +0000
+++ b/sys/netinet/tcp_subr.c    Mon Jul 01 20:51:25 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.131 2002/06/09 16:33:44 itojun Exp $    */
+/*     $NetBSD: tcp_subr.c,v 1.132 2002/07/01 20:51:25 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.131 2002/06/09 16:33:44 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.132 2002/07/01 20:51:25 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1410,6 +1410,9 @@
        void (*notify) __P((struct inpcb *, int)) = tcp_notify;
        int errno;
        int nmatch;
+#ifdef INET6
+       struct in6_addr src6, dst6;
+#endif
 
        if (sa->sa_family != AF_INET ||
            sa->sa_len != sizeof(struct sockaddr_in))
@@ -1430,9 +1433,22 @@
                 * Boundary check is made in icmp_input(), with ICMP_ADVLENMIN.
                 */
                th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
-               if (in_pcblookup_connect(&tcbtable,
-                                        ip->ip_dst, th->th_dport,
-                                        ip->ip_src, th->th_sport) == NULL)
+#ifdef INET6
+               memset(&src6, 0, sizeof(src6));
+               memset(&dst6, 0, sizeof(dst6));
+               src6.s6_addr16[5] = dst6.s6_addr16[5] = 0xffff;
+               memcpy(&src6.s6_addr32[3], &ip->ip_src, sizeof(struct in_addr));
+               memcpy(&dst6.s6_addr32[3], &ip->ip_dst, sizeof(struct in_addr));
+#endif
+               if (in_pcblookup_connect(&tcbtable, ip->ip_dst, th->th_dport,
+                   ip->ip_src, th->th_sport) != NULL)
+                       ;
+#ifdef INET6
+               else if (in6_pcblookup_connect(&tcb6, &dst6,
+                   th->th_dport, &src6, th->th_sport, 0) != NULL)
+                       ;
+#endif
+               else
                        return NULL;
 
                /*
@@ -1512,8 +1528,17 @@
 tcp_mtudisc_callback(faddr)
        struct in_addr faddr;
 {
+#ifdef INET6
+       struct in6_addr in6;
+#endif
 
        in_pcbnotifyall(&tcbtable, faddr, EMSGSIZE, tcp_mtudisc);
+#ifdef INET6
+       memset(&in6, 0, sizeof(in6));
+       in6.s6_addr16[5] = 0xffff;
+       memcpy(&in6.s6_addr32[3], &faddr, sizeof(struct in_addr));
+       tcp6_mtudisc_callback(&in6);
+#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index