Source-Changes-HG archive

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

[src/trunk]: src/sys sync with recent KAME.



details:   https://anonhg.NetBSD.org/src/rev/5aaa1dce16ac
branches:  trunk
changeset: 475080:5aaa1dce16ac
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jul 31 18:41:15 1999 +0000

description:
sync with recent KAME.
- loosen ipsec restriction on packet diredtion.
- revise icmp6 redirect handling on IsRouter bit.
- tcp/udp notification processing (link-local address case)
- cosmetic fixes (better code share across *BSD).

diffstat:

 sys/netinet/ip_ecn.c       |    4 +-
 sys/netinet/ip_ecn.h       |    8 +-
 sys/netinet/tcp_debug.h    |    6 +-
 sys/netinet/tcp_subr.c     |   31 +-
 sys/netinet/tcp_var.h      |    6 +-
 sys/netinet6/ah.h          |    8 +-
 sys/netinet6/ah_core.c     |   12 +-
 sys/netinet6/esp.h         |   12 +-
 sys/netinet6/icmp6.c       |   26 +-
 sys/netinet6/icmp6.h       |    9 +-
 sys/netinet6/in6_gif.c     |    4 +-
 sys/netinet6/in6_pcb.c     |    4 +-
 sys/netinet6/in6_proto.c   |    4 +-
 sys/netinet6/ip6_input.c   |    4 +-
 sys/netinet6/ip6_output.c  |    4 +-
 sys/netinet6/ipcomp.h      |    8 +-
 sys/netinet6/ipsec.c       |   19 +-
 sys/netinet6/ipsec.h       |   12 +-
 sys/netinet6/mld6.c        |    4 +-
 sys/netinet6/nd6.c         |   33 +-
 sys/netinet6/nd6.h         |    4 +-
 sys/netinet6/nd6_nbr.c     |    6 +-
 sys/netinet6/nd6_rtr.c     |    6 +-
 sys/netinet6/raw_ip6.c     |    4 +-
 sys/netinet6/udp6_usrreq.c |   25 +-
 sys/netkey/key.c           |  556 ++++++++++++++++++++++++++++++++++++++++++++-
 sys/netkey/key_var.h       |    6 +-
 sys/netkey/keysock.c       |   13 +-
 28 files changed, 745 insertions(+), 93 deletions(-)

diffs (truncated from 2146 to 300 lines):

diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet/ip_ecn.c
--- a/sys/netinet/ip_ecn.c      Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet/ip_ecn.c      Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_ecn.c,v 1.5 1999/07/30 10:35:34 itojun Exp $        */
+/*     $NetBSD: ip_ecn.c,v 1.6 1999/07/31 18:41:15 itojun Exp $        */
 
 /*
  * Copyright (C) 1999 WIDE Project.
@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * KAME Id: ip_ecn.c,v 1.1.4.1 1999/05/07 15:59:14 itojun Exp
+ * KAME Id: ip_ecn.c,v 1.1.4.2 1999/07/30 10:20:02 itojun Exp
  */
 /*
  * ECN consideration on tunnel ingress/egress operation.
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet/ip_ecn.h
--- a/sys/netinet/ip_ecn.h      Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet/ip_ecn.h      Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_ecn.h,v 1.5 1999/07/09 23:41:17 thorpej Exp $       */
+/*     $NetBSD: ip_ecn.h,v 1.6 1999/07/31 18:41:15 itojun Exp $        */
 
 /*
  * Copyright (C) 1999 WIDE Project.
@@ -35,9 +35,11 @@
  * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt
  */
 
-#if defined(_KERNEL) && !defined(_LKM)             
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
+#if defined(_KERNEL) && !defined(_LKM)
 #include "opt_inet.h"
-#endif                                             
+#endif
+#endif
 
 #define ECN_ALLOWED    1       /* ECN allowed */
 #define ECN_FORBIDDEN  0       /* ECN forbidden */
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet/tcp_debug.h
--- a/sys/netinet/tcp_debug.h   Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet/tcp_debug.h   Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_debug.h,v 1.8 1999/07/09 23:41:17 thorpej Exp $    */
+/*     $NetBSD: tcp_debug.h,v 1.9 1999/07/31 18:41:15 itojun Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -38,9 +38,9 @@
 #ifndef _NETINET_TCP_DEBUG_H_
 #define _NETINET_TCP_DEBUG_H_
 
-#if defined(_KERNEL) && !defined(_LKM)             
+#if defined(_KERNEL) && !defined(_LKM)
 #include "opt_inet.h"
-#endif                                             
+#endif
 
 struct tcp_debug {
        n_time  td_time;
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet/tcp_subr.c    Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.74 1999/07/23 15:21:17 itojun Exp $     */
+/*     $NetBSD: tcp_subr.c,v 1.75 1999/07/31 18:41:15 itojun Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1054,6 +1054,7 @@
        void (*notify) __P((struct in6pcb *, int)) = tcp6_notify;
        int nmatch;
        extern struct in6_addr zeroin6_addr;    /* netinet6/in6_pcb.c */
+       struct sockaddr_in6 sa6;
 
        if (cmd == PRC_QUENCH)
                notify = tcp6_quench;
@@ -1062,21 +1063,23 @@
        else if (!PRC_IS_REDIRECT(cmd) &&
                 ((unsigned)cmd > PRC_NCMDS || inet6ctlerrmap[cmd] == 0))
                return;
+
+       /* translate addresses into internal form */
+       sa6 = *(struct sockaddr_in6 *)sa;
+       if (IN6_IS_ADDR_LINKLOCAL(&sa6.sin6_addr))
+               sa6.sin6_addr.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index);
+
        if (ip6) {
                /*
                 * XXX: We assume that when ip6 is non NULL,
                 * M and OFF are valid.
                 */
+               struct in6_addr s;
 
                /* translate addresses into internal form */
-               if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src)) {
-                       ip6->ip6_src.s6_addr16[1] =
-                               htons(m->m_pkthdr.rcvif->if_index);
-               }
-               if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) {
-                       ip6->ip6_dst.s6_addr16[1] =
-                               htons(m->m_pkthdr.rcvif->if_index);
-               }
+               memcpy(&s, &ip6->ip6_dst, sizeof(s));
+               if (IN6_IS_ADDR_LINKLOCAL(&s))
+                       s.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index);
 
                if (m->m_len < off + sizeof(th)) {
                        /*
@@ -1087,8 +1090,8 @@
                        thp = &th;
                } else
                        thp = (struct tcphdr *)(mtod(m, caddr_t) + off);
-               nmatch = in6_pcbnotify(&tcb6, sa, thp->th_dport, &ip6->ip6_src,
-                   thp->th_sport, cmd, notify);
+               nmatch = in6_pcbnotify(&tcb6, (struct sockaddr *)&sa6,
+                   thp->th_dport, &s, thp->th_sport, cmd, notify);
                if (nmatch == 0 && syn_cache_count &&
                    (inet6ctlerrmap[cmd] == EHOSTUNREACH ||
                     inet6ctlerrmap[cmd] == ENETUNREACH ||
@@ -1098,12 +1101,12 @@
                        sin6.sin6_len = sizeof(sin6);
                        sin6.sin6_family = AF_INET6;
                        sin6.sin6_port = thp->th_sport;
-                       sin6.sin6_addr = ip6->ip6_src;
+                       sin6.sin6_addr = s;
                        syn_cache_unreach((struct sockaddr *)&sin6, sa, thp);
                }
        } else {
-               (void) in6_pcbnotify(&tcb6, sa, 0, &zeroin6_addr,
-                                    0, cmd, notify);
+               (void) in6_pcbnotify(&tcb6, (struct sockaddr *)&sa6, 0,
+                                    &zeroin6_addr, 0, cmd, notify);
        }
 }
 #endif
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h     Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet/tcp_var.h     Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_var.h,v 1.64 1999/07/22 12:56:56 itojun Exp $      */
+/*     $NetBSD: tcp_var.h,v 1.65 1999/07/31 18:41:15 itojun Exp $      */
 
 /*
 %%% portions-copyright-nrl-98
@@ -117,9 +117,9 @@
 #ifndef _NETINET_TCP_VAR_H_
 #define _NETINET_TCP_VAR_H_
 
-#if defined(_KERNEL) && !defined(_LKM)             
+#if defined(_KERNEL) && !defined(_LKM)
 #include "opt_inet.h"
-#endif                                             
+#endif
 
 /*
  * Kernel variables for tcp.
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet6/ah.h
--- a/sys/netinet6/ah.h Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet6/ah.h Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ah.h,v 1.4 1999/07/09 23:41:17 thorpej Exp $   */
+/*     $NetBSD: ah.h,v 1.5 1999/07/31 18:41:16 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -36,9 +36,11 @@
 #ifndef _NETINET6_AH_H_
 #define _NETINET6_AH_H_
 
-#if defined(_KERNEL) && !defined(_LKM)             
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
+#if defined(_KERNEL) && !defined(_LKM)
 #include "opt_inet.h"
-#endif                                             
+#endif
+#endif
 
 #include <netkey/keydb.h>              /* for struct secas */
 
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet6/ah_core.c
--- a/sys/netinet6/ah_core.c    Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet6/ah_core.c    Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ah_core.c,v 1.7 1999/07/30 10:35:35 itojun Exp $       */
+/*     $NetBSD: ah_core.c,v 1.8 1999/07/31 18:41:16 itojun Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -35,8 +35,10 @@
 
 #if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
 #include "opt_inet.h"
+#ifdef __NetBSD__      /*XXX*/
 #include "opt_ipsec.h"
 #endif
+#endif
 
 /* Some of operating systems have standard crypto checksum library */
 #ifdef __NetBSD__
@@ -872,7 +874,11 @@
 
        p = mtod(m, u_char *);
 
+#ifdef __NetBSD__
        s = splsoftnet();       /*XXX crypt algorithms need splsoftnet() */
+#else
+       s = splnet();   /*XXX crypt algorithms need splsoftnet() */
+#endif
        (algo->init)(&algos, sa);
 
        advancewidth = 0;       /*safety*/
@@ -1086,7 +1092,11 @@
 
        p = mtod(m, u_char *);
 
+#ifdef __NetBSD__
        s = splsoftnet();       /*XXX crypt algorithms need splsoftnet() */
+#else
+       s = splnet();   /*XXX crypt algorithms need splsoftnet() */
+#endif
        (algo->init)(&algos, sa);
 
        advancewidth = 0;       /*safety*/
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet6/esp.h
--- a/sys/netinet6/esp.h        Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet6/esp.h        Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esp.h,v 1.3 1999/07/09 23:41:17 thorpej Exp $  */
+/*     $NetBSD: esp.h,v 1.4 1999/07/31 18:41:16 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -36,11 +36,13 @@
 #ifndef _NETINET6_ESP_H_
 #define _NETINET6_ESP_H_
 
-#include <netkey/keydb.h>              /* for struct secas */
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
+#if defined(_KERNEL) && !defined(_LKM)
+#include "opt_inet.h"
+#endif
+#endif
 
-#if defined(_KERNEL) && !defined(_LKM)             
-#include "opt_inet.h"
-#endif                                             
+#include <netkey/keydb.h>              /* for struct secas */
 
 struct esp {
        u_int32_t       esp_spi;        /* ESP */
diff -r 4e62f7506ffe -r 5aaa1dce16ac sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Sat Jul 31 17:20:22 1999 +0000
+++ b/sys/netinet6/icmp6.c      Sat Jul 31 18:41:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.9 1999/07/30 10:35:35 itojun Exp $ */
+/*     $NetBSD: icmp6.c,v 1.10 1999/07/31 18:41:16 itojun Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -66,8 +66,10 @@
 
 #if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
 #include "opt_inet.h"
+#ifdef __NetBSD__      /*XXX*/
 #include "opt_ipsec.h"
 #endif
+#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,6 +100,7 @@
 #endif
 #include <netinet6/nd6.h>
 #include <netinet6/in6_ifattach.h>
+#include <netinet6/ip6protosw.h>
 
 #ifdef IPSEC
 #include <netkey/key.h>
@@ -106,7 +109,7 @@
 
 #include "faith.h"
 
-extern struct protosw inet6sw[];
+extern struct ip6protosw inet6sw[];
 extern u_char ip6_protox[];
 
 struct icmp6stat icmp6stat;
@@ -129,8 +132,10 @@
                          struct ifnet **));
 static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *,
                                struct ifnet *, int));
+#ifdef __NetBSD__
 static struct rtentry *icmp6_mtudisc_clone __P((struct sockaddr *));
 static void icmp6_mtudisc_timeout __P((struct rtentry *, struct rttimer *));
+#endif
 
 #ifdef COMPAT_RFC1885



Home | Main Index | Thread Index | Old Index