Source-Changes-HG archive

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

[src/trunk]: src/sys/net ipsecif: Set the link state UP if we have a tunnel, ...



details:   https://anonhg.NetBSD.org/src/rev/b9d28b946c5a
branches:  trunk
changeset: 1015118:b9d28b946c5a
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Oct 14 18:48:05 2020 +0000

description:
ipsecif: Set the link state UP if we have a tunnel, otherwise DOWN.

diffstat:

 sys/net/if_ipsec.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r 3d9bf533ea9f -r b9d28b946c5a sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c        Wed Oct 14 18:32:04 2020 +0000
+++ b/sys/net/if_ipsec.c        Wed Oct 14 18:48:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.c,v 1.29 2020/03/13 02:43:31 knakahara Exp $  */
+/*     $NetBSD: if_ipsec.c,v 1.30 2020/10/14 18:48:05 roy Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.29 2020/03/13 02:43:31 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.30 2020/10/14 18:48:05 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -336,7 +336,7 @@
        sc->ipsec_if.if_flags  = IFF_POINTOPOINT | IFF_MULTICAST;
        /* set ipsec(4) specific default flags. */
        sc->ipsec_if.if_flags  |= IFF_FWD_IPV6;
-       sc->ipsec_if.if_extflags = IFEF_NO_LINK_STATE_CHANGE | IFEF_MPSAFE;
+       sc->ipsec_if.if_extflags = IFEF_MPSAFE;
        sc->ipsec_if.if_ioctl  = if_ipsec_ioctl;
        sc->ipsec_if.if_output = if_ipsec_output;
        sc->ipsec_if.if_type   = IFT_IPSEC;
@@ -344,6 +344,7 @@
        sc->ipsec_if.if_softc  = sc;
        IFQ_SET_READY(&sc->ipsec_if.if_snd);
        if_initialize(&sc->ipsec_if);
+       sc->ipsec_if.if_link_state = LINK_STATE_DOWN;
        if_alloc_sadl(&sc->ipsec_if);
        bpf_attach(&sc->ipsec_if, DLT_NULL, sizeof(u_int));
        if_register(&sc->ipsec_if);
@@ -774,12 +775,14 @@
                error = if_ipsec_set_tunnel(&sc->ipsec_if, src, dst);
                if (error)
                        goto bad;
+               if_link_state_change(&sc->ipsec_if, LINK_STATE_UP);
                curlwp_bindx(bound);
                break;
 
        case SIOCDIFPHYADDR:
                bound = curlwp_bind();
                if_ipsec_delete_tunnel(&sc->ipsec_if);
+               if_link_state_change(&sc->ipsec_if, LINK_STATE_DOWN);
                curlwp_bindx(bound);
                break;
 



Home | Main Index | Thread Index | Old Index