Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net tun: Report link state based on if the interface has...
details: https://anonhg.NetBSD.org/src/rev/a8368ace7485
branches: trunk
changeset: 955380:a8368ace7485
user: roy <roy%NetBSD.org@localhost>
date: Sun Sep 27 19:25:54 2020 +0000
description:
tun: Report link state based on if the interface has been opened or not
This mirrors tap(4).
diffstat:
sys/net/if_tun.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (50 lines):
diff -r 0de3dd0dd0fd -r a8368ace7485 sys/net/if_tun.c
--- a/sys/net/if_tun.c Sun Sep 27 19:17:03 2020 +0000
+++ b/sys/net/if_tun.c Sun Sep 27 19:25:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $ */
+/* $NetBSD: if_tun.c,v 1.161 2020/09/27 19:25:54 roy Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.161 2020/09/27 19:25:54 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -256,12 +256,12 @@
ifp->if_start = tunstart;
#endif
ifp->if_flags = IFF_POINTOPOINT;
- ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
ifp->if_type = IFT_TUNNEL;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_dlt = DLT_NULL;
IFQ_SET_READY(&ifp->if_snd);
if_attach(ifp);
+ ifp->if_link_state = LINK_STATE_DOWN;
if_alloc_sadl(ifp);
bpf_attach(ifp, DLT_NULL, sizeof(uint32_t));
}
@@ -347,6 +347,7 @@
ifp = &tp->tun_if;
tp->tun_flags |= TUN_OPEN;
TUNDEBUG("%s: open\n", ifp->if_xname);
+ if_link_state_change(ifp, LINK_STATE_UP);
mutex_exit(&tp->tun_lock);
@@ -411,6 +412,9 @@
}
}
}
+
+ if_link_state_change(ifp, LINK_STATE_DOWN);
+
out_nolock:
return 0;
}
Home |
Main Index |
Thread Index |
Old Index