Source-Changes-HG archive

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

[src/trunk]: src/sys update outgoing ifp, only if tunnel mode ipsec is used. ...



details:   https://anonhg.NetBSD.org/src/rev/b5a7a9660344
branches:  trunk
changeset: 517904:b5a7a9660344
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Nov 21 06:28:08 2001 +0000

description:
update outgoing ifp, only if tunnel mode ipsec is used.  this is to
honor IP_MULTICAST_IF setsockopt on ipsec-over-multicast.  sync with kame

diffstat:

 sys/netinet/ip_output.c |  9 +++++----
 sys/netinet6/ipsec.c    |  7 +++++--
 sys/netinet6/ipsec.h    |  3 ++-
 3 files changed, 12 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r 47b6f103b426 -r b5a7a9660344 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Wed Nov 21 06:11:35 2001 +0000
+++ b/sys/netinet/ip_output.c   Wed Nov 21 06:28:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.89 2001/11/13 00:32:39 lukem Exp $     */
+/*     $NetBSD: ip_output.c,v 1.90 2001/11/21 06:28:08 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.89 2001/11/13 00:32:39 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.90 2001/11/21 06:28:08 itojun Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_ipsec.h"
@@ -536,7 +536,6 @@
                }
                goto bad;
        }
-    }
 
        /* be sure to update variables that are affected by ipsec4_output() */
        ip = mtod(m, struct ip *);
@@ -556,8 +555,10 @@
                }
        } else {
                /* nobody uses ia beyond here */
-               ifp = ro->ro_rt->rt_ifp;
+               if (state.encap)
+                       ifp = ro->ro_rt->rt_ifp;
        }
+    }
 
 skip_ipsec:
 #endif /*IPSEC*/
diff -r 47b6f103b426 -r b5a7a9660344 sys/netinet6/ipsec.c
--- a/sys/netinet6/ipsec.c      Wed Nov 21 06:11:35 2001 +0000
+++ b/sys/netinet6/ipsec.c      Wed Nov 21 06:28:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.c,v 1.42 2001/11/13 00:57:03 lukem Exp $ */
+/*     $NetBSD: ipsec.c,v 1.43 2001/11/21 06:28:09 itojun Exp $        */
 /*     $KAME: ipsec.c,v 1.125 2001/09/12 23:01:16 sakane Exp $ */
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.42 2001/11/13 00:57:03 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.43 2001/11/21 06:28:09 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -2628,6 +2628,7 @@
                panic("state->ro == NULL in ipsec4_output");
        if (!state->dst)
                panic("state->dst == NULL in ipsec4_output");
+       state->encap = 0;
 
        KEYDEBUG(KEYDEBUG_IPSEC_DATA,
                printf("ipsec4_output: applyed SP\n");
@@ -2765,6 +2766,8 @@
                                state->dst = (struct sockaddr *)state->ro->ro_rt->rt_gateway;
                                dst4 = (struct sockaddr_in *)state->dst;
                        }
+
+                       state->encap++;
                } else
                        splx(s);
 
diff -r 47b6f103b426 -r b5a7a9660344 sys/netinet6/ipsec.h
--- a/sys/netinet6/ipsec.h      Wed Nov 21 06:11:35 2001 +0000
+++ b/sys/netinet6/ipsec.h      Wed Nov 21 06:28:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.h,v 1.23 2001/10/16 06:24:45 itojun Exp $        */
+/*     $NetBSD: ipsec.h,v 1.24 2001/11/21 06:28:09 itojun Exp $        */
 /*     $KAME: ipsec.h,v 1.51 2001/08/05 04:52:58 itojun Exp $  */
 
 /*
@@ -290,6 +290,7 @@
        struct mbuf *m;
        struct route *ro;
        struct sockaddr *dst;
+       int encap;
 };
 
 struct ipsec_history {



Home | Main Index | Thread Index | Old Index