The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net/bridge.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1998-2002 Luigi Rizzo
    3  *
    4  * Work partly supported by: Cisco Systems, Inc. - NSITE lab, RTP, NC
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: releng/6.4/sys/net/bridge.h 147256 2005-06-10 16:49:24Z brooks $
   28  */
   29 
   30 extern int do_bridge;
   31 
   32 /*
   33  * We need additional per-interface info for the bridge, which is
   34  * stored in a struct bdg_softc. The ifp2sc[] array provides a pointer
   35  * to this struct using the if_index as a mapping key.
   36  * bdg_softc has a backpointer to the struct ifnet, the bridge
   37  * flags, and a cluster (bridging occurs only between port of the
   38  * same cluster).
   39  */
   40 
   41 struct cluster_softc;   /* opaque here, defined in bridge.c */
   42 
   43 struct bdg_softc {
   44     struct ifnet *ifp ;
   45     int flags ;
   46 #define IFF_BDG_PROMISC 0x0001  /* set promisc mode on this if. */
   47 #define IFF_MUTE        0x0002  /* mute this if for bridging.   */
   48 #define IFF_USED        0x0004  /* use this if for bridging.    */
   49     struct cluster_softc *cluster;
   50 } ;
   51 
   52 extern struct bdg_softc *ifp2sc;
   53 
   54 #define BDG_USED(ifp) (ifp2sc[ifp->if_index].flags & IFF_USED)
   55 /*
   56  * BDG_ACTIVE(ifp) does all checks to see if bridging is enabled, loaded,
   57  * and used on a given interface.
   58  */
   59 #define BDG_ACTIVE(ifp) (do_bridge && BDG_LOADED && BDG_USED(ifp))
   60 
   61 /*
   62  * The following constants are not legal ifnet pointers, and are used
   63  * as return values from the classifier, bridge_dst_lookup().
   64  * The same values are used as index in the statistics arrays,
   65  * with BDG_FORWARD replacing specifically forwarded packets.
   66  *
   67  * These constants are here because they are used in 'netstat'
   68  * to show bridge statistics.
   69  */
   70 #define BDG_BCAST       ( (struct ifnet *)1 )
   71 #define BDG_MCAST       ( (struct ifnet *)2 )
   72 #define BDG_LOCAL       ( (struct ifnet *)3 )
   73 #define BDG_DROP        ( (struct ifnet *)4 )
   74 #define BDG_UNKNOWN     ( (struct ifnet *)5 )
   75 #define BDG_IN          ( (struct ifnet *)7 )
   76 #define BDG_OUT         ( (struct ifnet *)8 )
   77 #define BDG_FORWARD     ( (struct ifnet *)9 )
   78 
   79 /*
   80  * Statistics are passed up with the sysctl interface, "netstat -p bdg"
   81  * reads them. PF_BDG defines the 'bridge' protocol family.
   82  */
   83 
   84 #define PF_BDG 3 /* XXX superhack */
   85 
   86 #define STAT_MAX (int)BDG_FORWARD
   87 struct bdg_port_stat {
   88     char name[16];
   89     u_long collisions;
   90     u_long p_in[STAT_MAX+1];
   91 } ;
   92 
   93 /* XXX this should be made dynamic */
   94 #define BDG_MAX_PORTS 128
   95 struct bdg_stats {
   96     struct bdg_port_stat s[BDG_MAX_PORTS];
   97 } ;
   98 
   99 
  100 #define BDG_STAT(ifp, type) bdg_stats.s[ifp->if_index].p_in[(uintptr_t)type]++ 
  101  
  102 #ifdef _KERNEL
  103 typedef struct mbuf *bridge_in_t(struct ifnet *, struct mbuf *);
  104 /* bdg_forward frees the mbuf if necessary, returning null */
  105 typedef struct mbuf *bdg_forward_t(struct mbuf *, struct ifnet *);
  106 typedef void bdgtakeifaces_t(void);
  107 extern  bridge_in_t *bridge_in_ptr;
  108 extern  bdg_forward_t *bdg_forward_ptr;
  109 extern  bdgtakeifaces_t *bdgtakeifaces_ptr;
  110 
  111 #define BDG_LOADED      (bdgtakeifaces_ptr != NULL)
  112 #endif /* KERNEL */

Cache object: e3a504e8fb8d38dfc8cca1c57c2e73a0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.