sync code with last improvements from OpenBSD
This commit is contained in:
parent
5903cbe575
commit
62d64fa864
841 changed files with 83929 additions and 40755 deletions
13
sys/net/if.c
13
sys/net/if.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if.c,v 1.708 2023/09/16 09:33:27 mpi Exp $ */
|
||||
/* $OpenBSD: if.c,v 1.709 2023/10/27 20:56:47 jan Exp $ */
|
||||
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -3243,6 +3243,17 @@ ifsetlro(struct ifnet *ifp, int on)
|
|||
struct ifreq ifrq;
|
||||
int error = 0;
|
||||
int s = splnet();
|
||||
struct if_parent parent;
|
||||
|
||||
memset(&parent, 0, sizeof(parent));
|
||||
if ((*ifp->if_ioctl)(ifp, SIOCGIFPARENT, (caddr_t)&parent) != -1) {
|
||||
struct ifnet *ifp0 = if_unit(parent.ifp_parent);
|
||||
|
||||
if (ifp0 != NULL) {
|
||||
ifsetlro(ifp0, on);
|
||||
if_put(ifp0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISSET(ifp->if_capabilities, IFCAP_LRO)) {
|
||||
error = ENOTSUP;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_bpe.c,v 1.19 2021/11/08 04:54:44 dlg Exp $ */
|
||||
/* $OpenBSD: if_bpe.c,v 1.20 2023/10/27 20:56:47 jan Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 David Gwynne <dlg@openbsd.org>
|
||||
*
|
||||
|
@ -631,6 +631,8 @@ bpe_set_parent(struct bpe_softc *sc, const struct if_parent *p)
|
|||
goto put;
|
||||
}
|
||||
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
/* commit */
|
||||
sc->sc_key.k_if = ifp0->if_index;
|
||||
etherbridge_flush(&sc->sc_eb, IFBF_FLUSHALL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_gre.c,v 1.174 2023/05/13 13:35:17 bluhm Exp $ */
|
||||
/* $OpenBSD: if_gre.c,v 1.175 2023/10/27 20:56:47 jan Exp $ */
|
||||
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -3544,6 +3544,8 @@ nvgre_set_parent(struct nvgre_softc *sc, const char *parent)
|
|||
return (EPROTONOSUPPORT);
|
||||
}
|
||||
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
/* commit */
|
||||
sc->sc_ifp0 = ifp0->if_index;
|
||||
if_put(ifp0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_pflow.c,v 1.99 2023/04/13 02:19:05 jsg Exp $ */
|
||||
/* $OpenBSD: if_pflow.c,v 1.100 2023/11/09 08:53:20 mvs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
|
||||
|
@ -71,7 +71,6 @@ void pflow_output_process(void *);
|
|||
int pflow_clone_create(struct if_clone *, int);
|
||||
int pflow_clone_destroy(struct ifnet *);
|
||||
int pflow_set(struct pflow_softc *, struct pflowreq *);
|
||||
void pflow_init_timeouts(struct pflow_softc *);
|
||||
int pflow_calc_mtu(struct pflow_softc *, int, int);
|
||||
void pflow_setmtu(struct pflow_softc *, int);
|
||||
int pflowvalidsockaddr(const struct sockaddr *, int);
|
||||
|
@ -255,7 +254,11 @@ pflow_clone_create(struct if_clone *ifc, int unit)
|
|||
ifp->if_flags &= ~IFF_RUNNING; /* not running, need receiver */
|
||||
mq_init(&pflowif->sc_outputqueue, 8192, IPL_SOFTNET);
|
||||
pflow_setmtu(pflowif, ETHERMTU);
|
||||
pflow_init_timeouts(pflowif);
|
||||
|
||||
timeout_set_proc(&pflowif->sc_tmo, pflow_timeout, pflowif);
|
||||
timeout_set_proc(&pflowif->sc_tmo6, pflow_timeout6, pflowif);
|
||||
timeout_set_proc(&pflowif->sc_tmo_tmpl, pflow_timeout_tmpl, pflowif);
|
||||
|
||||
if_counters_alloc(ifp);
|
||||
if_attach(ifp);
|
||||
if_alloc_sadl(ifp);
|
||||
|
@ -282,12 +285,10 @@ pflow_clone_destroy(struct ifnet *ifp)
|
|||
SLIST_REMOVE(&pflowif_list, sc, pflow_softc, sc_next);
|
||||
NET_UNLOCK();
|
||||
|
||||
if (timeout_initialized(&sc->sc_tmo))
|
||||
timeout_del(&sc->sc_tmo);
|
||||
if (timeout_initialized(&sc->sc_tmo6))
|
||||
timeout_del(&sc->sc_tmo6);
|
||||
if (timeout_initialized(&sc->sc_tmo_tmpl))
|
||||
timeout_del(&sc->sc_tmo_tmpl);
|
||||
timeout_del(&sc->sc_tmo);
|
||||
timeout_del(&sc->sc_tmo6);
|
||||
timeout_del(&sc->sc_tmo_tmpl);
|
||||
|
||||
pflow_flush(sc);
|
||||
task_del(net_tq(ifp->if_index), &sc->sc_outputtask);
|
||||
taskq_barrier(net_tq(ifp->if_index));
|
||||
|
@ -465,7 +466,18 @@ pflow_set(struct pflow_softc *sc, struct pflowreq *pflowr)
|
|||
sc->sc_version = pflowr->version;
|
||||
|
||||
pflow_setmtu(sc, ETHERMTU);
|
||||
pflow_init_timeouts(sc);
|
||||
|
||||
switch (sc->sc_version) {
|
||||
case PFLOW_PROTO_5:
|
||||
timeout_del(&sc->sc_tmo6);
|
||||
timeout_del(&sc->sc_tmo_tmpl);
|
||||
break;
|
||||
case PFLOW_PROTO_10:
|
||||
timeout_add_sec(&sc->sc_tmo_tmpl, PFLOW_TMPL_TIMEOUT);
|
||||
break;
|
||||
default: /* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -560,34 +572,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
pflow_init_timeouts(struct pflow_softc *sc)
|
||||
{
|
||||
switch (sc->sc_version) {
|
||||
case PFLOW_PROTO_5:
|
||||
if (timeout_initialized(&sc->sc_tmo6))
|
||||
timeout_del(&sc->sc_tmo6);
|
||||
if (timeout_initialized(&sc->sc_tmo_tmpl))
|
||||
timeout_del(&sc->sc_tmo_tmpl);
|
||||
if (!timeout_initialized(&sc->sc_tmo))
|
||||
timeout_set_proc(&sc->sc_tmo, pflow_timeout, sc);
|
||||
break;
|
||||
case PFLOW_PROTO_10:
|
||||
if (!timeout_initialized(&sc->sc_tmo_tmpl))
|
||||
timeout_set_proc(&sc->sc_tmo_tmpl, pflow_timeout_tmpl,
|
||||
sc);
|
||||
if (!timeout_initialized(&sc->sc_tmo))
|
||||
timeout_set_proc(&sc->sc_tmo, pflow_timeout, sc);
|
||||
if (!timeout_initialized(&sc->sc_tmo6))
|
||||
timeout_set_proc(&sc->sc_tmo6, pflow_timeout6, sc);
|
||||
|
||||
timeout_add_sec(&sc->sc_tmo_tmpl, PFLOW_TMPL_TIMEOUT);
|
||||
break;
|
||||
default: /* NOTREACHED */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
pflow_calc_mtu(struct pflow_softc *sc, int mtu, int hdrsz)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_vlan.c,v 1.215 2023/05/16 14:32:54 jan Exp $ */
|
||||
/* $OpenBSD: if_vlan.c,v 1.216 2023/10/27 20:56:47 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
|
@ -937,6 +937,9 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent)
|
|||
if (error != 0)
|
||||
goto put;
|
||||
|
||||
if (ether_brport_isset(ifp))
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
/* commit */
|
||||
sc->sc_ifidx0 = ifp0->if_index;
|
||||
if (!ISSET(sc->sc_flags, IFVF_LLADDR))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_vxlan.c,v 1.93 2023/08/03 09:49:08 mvs Exp $ */
|
||||
/* $OpenBSD: if_vxlan.c,v 1.94 2023/10/27 20:56:48 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
|
||||
|
@ -1582,6 +1582,8 @@ vxlan_set_parent(struct vxlan_softc *sc, const struct if_parent *p)
|
|||
goto put;
|
||||
}
|
||||
|
||||
ifsetlro(ifp0, 0);
|
||||
|
||||
/* commit */
|
||||
sc->sc_if_index0 = ifp0->if_index;
|
||||
etherbridge_flush(&sc->sc_eb, IFBF_FLUSHALL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_wg.c,v 1.31 2023/09/26 15:16:44 sthen Exp $ */
|
||||
/* $OpenBSD: if_wg.c,v 1.32 2023/10/23 10:22:05 mvs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
|
@ -509,6 +509,14 @@ wg_peer_destroy(struct wg_peer *peer)
|
|||
|
||||
NET_LOCK();
|
||||
while (!ifq_empty(&sc->sc_if.if_snd)) {
|
||||
/*
|
||||
* XXX: `if_snd' of stopped interface could still
|
||||
* contain packets
|
||||
*/
|
||||
if (!ISSET(sc->sc_if.if_flags, IFF_RUNNING)) {
|
||||
ifq_purge(&sc->sc_if.if_snd);
|
||||
continue;
|
||||
}
|
||||
NET_UNLOCK();
|
||||
tsleep_nsec(sc, PWAIT, "wg_ifq", 1000);
|
||||
NET_LOCK();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue