summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-01-23 11:37:30 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-01-23 11:37:30 +0000
commit10d5036c590dfcd39b88dee569d1a0bc0e5f3259 (patch)
tree96749bb77c7258aed2b501fb0c420c79513f84b5 /sys/net
parent9fe6fad4fe28032c58a94b8bc3d8cf94e5171903 (diff)
Flag pseudo-interfaces as such in order to call add_net_randomness()
only once per packet. Fix a regression introduced when if_input() started to be called by every pseudo-driver. ok claudio@, dlg@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c7
-rw-r--r--sys/net/if.h7
-rw-r--r--sys/net/if_bridge.c3
-rw-r--r--sys/net/if_enc.c3
-rw-r--r--sys/net/if_etherip.c3
-rw-r--r--sys/net/if_gif.c3
-rw-r--r--sys/net/if_gre.c3
-rw-r--r--sys/net/if_loop.c3
-rw-r--r--sys/net/if_mpe.c3
-rw-r--r--sys/net/if_mpw.c3
-rw-r--r--sys/net/if_pair.c3
-rw-r--r--sys/net/if_pflog.c3
-rw-r--r--sys/net/if_pflow.c3
-rw-r--r--sys/net/if_pfsync.c3
-rw-r--r--sys/net/if_vlan.c4
15 files changed, 34 insertions, 20 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index a75cc07baf7..b01f9a539d5 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.477 2017/01/23 07:27:21 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.478 2017/01/23 11:37:29 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -817,7 +817,8 @@ if_input_process(void *xifidx)
if (ml_empty(&ml))
goto out;
- add_net_randomness(ml_len(&ml));
+ if (!ISSET(ifp->if_xflags, IFXF_CLONED))
+ add_net_randomness(ml_len(&ml));
s = splnet();
while ((m = ml_dequeue(&ml)) != NULL) {
@@ -1775,7 +1776,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
break;
case SIOCGIFXFLAGS:
- ifr->ifr_flags = ifp->if_xflags & ~IFXF_MPSAFE;
+ ifr->ifr_flags = ifp->if_xflags & ~(IFXF_MPSAFE|IFXF_CLONED);
break;
case SIOCGIFMETRIC:
diff --git a/sys/net/if.h b/sys/net/if.h
index 3d2ec55574b..cbc25aaecb5 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.183 2017/01/23 07:27:21 dlg Exp $ */
+/* $OpenBSD: if.h,v 1.184 2017/01/23 11:37:29 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -206,14 +206,15 @@ struct if_status_description {
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
-#define IFXF_MPSAFE 0x1 /* if_start is mpsafe */
+#define IFXF_MPSAFE 0x1 /* if_start is mpsafe */
+#define IFXF_CLONED 0x2 /* pseudo interface */
#define IFXF_INET6_NOPRIVACY 0x4 /* don't autoconf privacy */
#define IFXF_MPLS 0x8 /* supports MPLS */
#define IFXF_WOL 0x10 /* wake on lan enabled */
#define IFXF_AUTOCONF6 0x20 /* v6 autoconf enabled */
#define IFXF_CANTCHANGE \
- (IFXF_MPSAFE)
+ (IFXF_MPSAFE|IFXF_CLONED)
/*
* Some convenience macros used for setting ifi_baudrate.
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 58c77cc5e95..b1db190edec 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.291 2017/01/11 08:47:48 mpi Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.292 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -181,6 +181,7 @@ bridge_clone_create(struct if_clone *ifc, int unit)
ifp->if_mtu = ETHERMTU;
ifp->if_ioctl = bridge_ioctl;
ifp->if_output = bridge_dummy_output;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_start = NULL;
ifp->if_type = IFT_BRIDGE;
ifp->if_hdrlen = ETHER_HDR_LEN;
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index 15e9a8a597a..1f749fc3a16 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_enc.c,v 1.66 2017/01/20 00:51:56 mpi Exp $ */
+/* $OpenBSD: if_enc.c,v 1.67 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2010 Reyk Floeter <reyk@vantronix.net>
@@ -86,6 +86,7 @@ enc_clone_create(struct if_clone *ifc, int unit)
ifp = &sc->sc_if;
ifp->if_softc = sc;
ifp->if_type = IFT_ENC;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_start = enc_start;
ifp->if_output = enc_output;
ifp->if_ioctl = enc_ioctl;
diff --git a/sys/net/if_etherip.c b/sys/net/if_etherip.c
index 7ff8c76f726..c803a247bb8 100644
--- a/sys/net/if_etherip.c
+++ b/sys/net/if_etherip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_etherip.c,v 1.11 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_etherip.c,v 1.12 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@@ -118,6 +118,7 @@ etherip_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = sc;
ifp->if_ioctl = etherip_ioctl;
ifp->if_start = etherip_start;
+ ifp->if_xflags = IFXF_CLONED;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_capabilities = IFCAP_VLAN_MTU;
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 97e5633b708..02910c041f0 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.88 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_gif.c,v 1.89 2017/01/23 11:37:29 mpi Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -115,6 +115,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
"%s%d", ifc->ifc_name, unit);
sc->gif_if.if_mtu = GIF_MTU;
sc->gif_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
+ sc->gif_if.if_xflags = IFXF_CLONED;
sc->gif_if.if_ioctl = gif_ioctl;
sc->gif_if.if_start = gif_start;
sc->gif_if.if_output = gif_output;
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index a7d6c660c65..008464f7a8b 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.82 2016/12/19 15:50:18 mpi Exp $ */
+/* $OpenBSD: if_gre.c,v 1.83 2017/01/23 11:37:29 mpi Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -136,6 +136,7 @@ gre_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_hdrlen = 24; /* IP + GRE */
sc->sc_if.if_mtu = GREMTU;
sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
+ sc->sc_if.if_xflags = IFXF_CLONED;
sc->sc_if.if_output = gre_output;
sc->sc_if.if_ioctl = gre_ioctl;
sc->sc_if.if_rtrequest = p2p_rtrequest;
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 5d98bc380e2..c14d7e2d840 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.78 2017/01/19 23:16:47 mpi Exp $ */
+/* $OpenBSD: if_loop.c,v 1.79 2017/01/23 11:37:29 mpi Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -174,6 +174,7 @@ loop_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = NULL;
ifp->if_mtu = LOMTU;
ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_rtrequest = lortrequest;
ifp->if_ioctl = loioctl;
ifp->if_output = looutput;
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index b16f395bcde..c7b38b3e6e4 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.56 2016/12/20 12:18:44 mpi Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.57 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -89,6 +89,7 @@ mpe_clone_create(struct if_clone *ifc, int unit)
ifp = &mpeif->sc_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "mpe%d", unit);
ifp->if_flags = IFF_POINTOPOINT;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_softc = mpeif;
ifp->if_mtu = MPE_MTU;
ifp->if_ioctl = mpeioctl;
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index a1364d6f3c1..cd51b2387e9 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.16 2016/12/20 12:18:44 mpi Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.17 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -92,6 +92,7 @@ mpw_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = sc;
ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_POINTOPOINT;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_ioctl = mpw_ioctl;
ifp->if_output = mpw_output;
ifp->if_start = mpw_start;
diff --git a/sys/net/if_pair.c b/sys/net/if_pair.c
index bae2ad4fb6e..36645299d2c 100644
--- a/sys/net/if_pair.c
+++ b/sys/net/if_pair.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pair.c,v 1.9 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_pair.c,v 1.10 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -120,6 +120,7 @@ pair_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = sc;
ifp->if_ioctl = pairioctl;
ifp->if_start = pairstart;
+ ifp->if_xflags = IFXF_CLONED;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_hardmtu = ETHER_MAX_HARDMTU_LEN;
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c
index ec032eb7f81..1a38758bea1 100644
--- a/sys/net/if_pflog.c
+++ b/sys/net/if_pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.c,v 1.76 2016/11/22 19:29:54 procter Exp $ */
+/* $OpenBSD: if_pflog.c,v 1.77 2017/01/23 11:37:29 mpi Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -150,6 +150,7 @@ pflog_clone_create(struct if_clone *ifc, int unit)
ifp->if_ioctl = pflogioctl;
ifp->if_output = pflogoutput;
ifp->if_start = pflogstart;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_type = IFT_PFLOG;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_hdrlen = PFLOG_HDRLEN;
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 50a2a2cd1da..c599beb8e74 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.69 2017/01/20 00:51:56 mpi Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.70 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -235,6 +235,7 @@ pflow_clone_create(struct if_clone *ifc, int unit)
ifp->if_ioctl = pflowioctl;
ifp->if_output = pflow_output;
ifp->if_start = NULL;
+ ifp->if_xflags = IFXF_CLONED;
ifp->if_type = IFT_PFLOW;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_hdrlen = PFLOW_HDRLEN;
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 8ca771d1700..54cbef445c1 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.241 2017/01/20 03:56:46 mpi Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.242 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -328,6 +328,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_hdrlen = sizeof(struct pfsync_header);
ifp->if_mtu = ETHERMTU;
+ ifp->if_xflags = IFXF_CLONED;
timeout_set_proc(&sc->sc_tmo, pfsync_timeout, sc);
timeout_set_proc(&sc->sc_bulk_tmo, pfsync_bulk_update, sc);
timeout_set_proc(&sc->sc_bulkfail_tmo, pfsync_bulk_fail, sc);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index fcf7ed49ca6..8ec731e89c3 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.168 2017/01/22 10:17:39 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.169 2017/01/23 11:37:29 mpi Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -174,7 +174,7 @@ vlan_clone_create(struct if_clone *ifc, int unit)
refcnt_init(&ifv->ifv_refcnt);
ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST;
- ifp->if_xflags = IFXF_MPSAFE;
+ ifp->if_xflags = IFXF_CLONED|IFXF_MPSAFE;
ifp->if_start = vlan_start;
ifp->if_ioctl = vlan_ioctl;
ifp->if_hardmtu = 0xffff;