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/5.1/sys/net/bridge.h 106939 2002-11-15 00:00:15Z sam $
   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     /* also ((struct arpcom *)ifp)->ac_enaddr is the eth. addr */
   46     int flags ;
   47 #define IFF_BDG_PROMISC 0x0001  /* set promisc mode on this if. */
   48 #define IFF_MUTE        0x0002  /* mute this if for bridging.   */
   49 #define IFF_USED        0x0004  /* use this if for bridging.    */
   50     struct cluster_softc *cluster;
   51 } ;
   52 
   53 extern struct bdg_softc *ifp2sc;
   54 
   55 #define BDG_USED(ifp) (ifp2sc[ifp->if_index].flags & IFF_USED)
   56 /*
   57  * BDG_ACTIVE(ifp) does all checks to see if bridging is enabled, loaded,
   58  * and used on a given interface.
   59  */
   60 #define BDG_ACTIVE(ifp) (do_bridge && BDG_LOADED && BDG_USED(ifp))
   61 
   62 /*
   63  * The following constants are not legal ifnet pointers, and are used
   64  * as return values from the classifier, bridge_dst_lookup().
   65  * The same values are used as index in the statistics arrays,
   66  * with BDG_FORWARD replacing specifically forwarded packets.
   67  *
   68  * These constants are here because they are used in 'netstat'
   69  * to show bridge statistics.
   70  */
   71 #define BDG_BCAST       ( (struct ifnet *)1 )
   72 #define BDG_MCAST       ( (struct ifnet *)2 )
   73 #define BDG_LOCAL       ( (struct ifnet *)3 )
   74 #define BDG_DROP        ( (struct ifnet *)4 )
   75 #define BDG_UNKNOWN     ( (struct ifnet *)5 )
   76 #define BDG_IN          ( (struct ifnet *)7 )
   77 #define BDG_OUT         ( (struct ifnet *)8 )
   78 #define BDG_FORWARD     ( (struct ifnet *)9 )
   79 
   80 /*
   81  * Statistics are passed up with the sysctl interface, "netstat -p bdg"
   82  * reads them. PF_BDG defines the 'bridge' protocol family.
   83  */
   84 
   85 #define PF_BDG 3 /* XXX superhack */
   86 
   87 #define STAT_MAX (int)BDG_FORWARD
   88 struct bdg_port_stat {
   89     char name[16];
   90     u_long collisions;
   91     u_long p_in[STAT_MAX+1];
   92 } ;
   93 
   94 /* XXX this should be made dynamic */
   95 #define BDG_MAX_PORTS 128
   96 struct bdg_stats {
   97     struct bdg_port_stat s[BDG_MAX_PORTS];
   98 } ;
   99 
  100 
  101 #define BDG_STAT(ifp, type) bdg_stats.s[ifp->if_index].p_in[(uintptr_t)type]++ 
  102  
  103 #ifdef _KERNEL
  104 typedef struct ifnet *bridge_in_t(struct ifnet *, struct ether_header *);
  105 /* bdg_forward frees the mbuf if necessary, returning null */
  106 typedef struct mbuf *bdg_forward_t(struct mbuf *, struct ifnet *);
  107 typedef void bdgtakeifaces_t(void);
  108 extern  bridge_in_t *bridge_in_ptr;
  109 extern  bdg_forward_t *bdg_forward_ptr;
  110 extern  bdgtakeifaces_t *bdgtakeifaces_ptr;
  111 
  112 #define BDG_LOADED      (bdgtakeifaces_ptr != NULL)
  113 #endif /* KERNEL */

Cache object: dcf5801094c4b258b94dae971ea2d102


[ 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.