if_disc.c (128019) | if_disc.c (130933) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93 |
30 * $FreeBSD: head/sys/net/if_disc.c 128019 2004-04-07 20:46:16Z imp $ | 30 * $FreeBSD: head/sys/net/if_disc.c 130933 2004-06-22 20:13:25Z brooks $ |
31 */ 32 33/* 34 * Discard interface driver for protocol testing and timing. 35 * (Based on the loopback.) 36 */ 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/malloc.h> 42#include <sys/module.h> 43#include <sys/mbuf.h> 44#include <sys/socket.h> 45#include <sys/sockio.h> 46 47#include <net/if.h> | 31 */ 32 33/* 34 * Discard interface driver for protocol testing and timing. 35 * (Based on the loopback.) 36 */ 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/malloc.h> 42#include <sys/module.h> 43#include <sys/mbuf.h> 44#include <sys/socket.h> 45#include <sys/sockio.h> 46 47#include <net/if.h> |
48#include <net/if_clone.h> |
|
48#include <net/if_types.h> 49#include <net/route.h> 50#include <net/bpf.h> 51 52#include "opt_inet.h" 53#include "opt_inet6.h" 54 55#ifdef TINY_DSMTU --- 14 unchanged lines hidden (view full) --- 70static void discrtrequest(int, struct rtentry *, struct rt_addrinfo *); 71static int discioctl(struct ifnet *, u_long, caddr_t); 72static int disc_clone_create(struct if_clone *, int); 73static void disc_clone_destroy(struct ifnet *); 74 75static struct mtx disc_mtx; 76static MALLOC_DEFINE(M_DISC, DISCNAME, "Discard interface"); 77static LIST_HEAD(, disc_softc) disc_softc_list; | 49#include <net/if_types.h> 50#include <net/route.h> 51#include <net/bpf.h> 52 53#include "opt_inet.h" 54#include "opt_inet6.h" 55 56#ifdef TINY_DSMTU --- 14 unchanged lines hidden (view full) --- 71static void discrtrequest(int, struct rtentry *, struct rt_addrinfo *); 72static int discioctl(struct ifnet *, u_long, caddr_t); 73static int disc_clone_create(struct if_clone *, int); 74static void disc_clone_destroy(struct ifnet *); 75 76static struct mtx disc_mtx; 77static MALLOC_DEFINE(M_DISC, DISCNAME, "Discard interface"); 78static LIST_HEAD(, disc_softc) disc_softc_list; |
78static struct if_clone disc_cloner = IF_CLONE_INITIALIZER(DISCNAME, 79 disc_clone_create, disc_clone_destroy, 0, IF_MAXUNIT); | |
80 | 79 |
80IFC_SIMPLE_DECLARE(disc, 0); 81 |
|
81static int 82disc_clone_create(struct if_clone *ifc, int unit) 83{ 84 struct ifnet *ifp; 85 struct disc_softc *sc; 86 87 sc = malloc(sizeof(struct disc_softc), M_DISC, M_WAITOK); 88 bzero(sc, sizeof(struct disc_softc)); --- 171 unchanged lines hidden --- | 82static int 83disc_clone_create(struct if_clone *ifc, int unit) 84{ 85 struct ifnet *ifp; 86 struct disc_softc *sc; 87 88 sc = malloc(sizeof(struct disc_softc), M_DISC, M_WAITOK); 89 bzero(sc, sizeof(struct disc_softc)); --- 171 unchanged lines hidden --- |