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/netinet6/ip6_mroute.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (C) 1998 WIDE Project.
    3  * 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
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. Neither the name of the project nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   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  *      $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $
   30  * $FreeBSD: releng/10.3/sys/netinet6/ip6_mroute.h 261218 2014-01-28 00:30:17Z ae $
   31  */
   32 
   33 /*      BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp      */
   34 
   35 /*
   36  * Definitions for IP multicast forwarding.
   37  *
   38  * Written by David Waitzman, BBN Labs, August 1988.
   39  * Modified by Steve Deering, Stanford, February 1989.
   40  * Modified by Ajit Thyagarajan, PARC, August 1993.
   41  * Modified by Ajit Thyagarajan, PARC, August 1994.
   42  * Modified by Ahmed Helmy, USC, September 1996.
   43  *
   44  * MROUTING Revision: 1.2
   45  */
   46 
   47 #ifndef _NETINET6_IP6_MROUTE_H_
   48 #define _NETINET6_IP6_MROUTE_H_
   49 
   50 /*
   51  * Multicast Routing set/getsockopt commands.
   52  */
   53 #ifdef _KERNEL
   54 #define MRT6_OINIT              100     /* initialize forwarder (omrt6msg) */
   55 #endif
   56 #define MRT6_DONE               101     /* shut down forwarder */
   57 #define MRT6_ADD_MIF            102     /* add multicast interface */
   58 #define MRT6_DEL_MIF            103     /* delete multicast interface */
   59 #define MRT6_ADD_MFC            104     /* insert forwarding cache entry */
   60 #define MRT6_DEL_MFC            105     /* delete forwarding cache entry */
   61 #define MRT6_PIM                107     /* enable pim code */
   62 #define MRT6_INIT               108     /* initialize forwarder (mrt6msg) */
   63 
   64 #if BSD >= 199103
   65 #define GET_TIME(t)     microtime(&t)
   66 #elif defined(sun)
   67 #define GET_TIME(t)     uniqtime(&t)
   68 #else
   69 #define GET_TIME(t)     ((t) = time)
   70 #endif
   71 
   72 /*
   73  * Types and macros for handling bitmaps with one bit per multicast interface.
   74  */
   75 typedef u_short mifi_t;         /* type of a mif index */
   76 #define MAXMIFS         64
   77 
   78 #ifndef IF_SETSIZE
   79 #define IF_SETSIZE      256
   80 #endif
   81 
   82 typedef u_int32_t       if_mask;
   83 #define NIFBITS (sizeof(if_mask) * NBBY)        /* bits per mask */
   84 
   85 #ifndef howmany
   86 #define howmany(x, y)   (((x) + ((y) - 1)) / (y))
   87 #endif
   88 
   89 typedef struct if_set {
   90         if_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
   91 } if_set;
   92 
   93 #define IF_SET(n, p)    ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
   94 #define IF_CLR(n, p)    ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
   95 #define IF_ISSET(n, p)  ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
   96 #define IF_COPY(f, t)   bcopy(f, t, sizeof(*(f)))
   97 #define IF_ZERO(p)      bzero(p, sizeof(*(p)))
   98 
   99 /*
  100  * Argument structure for MRT6_ADD_IF.
  101  */
  102 struct mif6ctl {
  103         mifi_t      mif6c_mifi;         /* the index of the mif to be added  */
  104         u_char      mif6c_flags;        /* MIFF_ flags defined below         */
  105         u_short     mif6c_pifi;         /* the index of the physical IF */
  106 };
  107 
  108 #define MIFF_REGISTER   0x1     /* mif represents a register end-point */
  109 
  110 /*
  111  * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
  112  */
  113 struct mf6cctl {
  114         struct sockaddr_in6 mf6cc_origin;       /* IPv6 origin of mcasts */
  115         struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
  116         mifi_t          mf6cc_parent;   /* incoming ifindex */
  117         struct if_set   mf6cc_ifset;    /* set of forwarding ifs */
  118 };
  119 
  120 /*
  121  * The kernel's multicast routing statistics.
  122  */
  123 struct mrt6stat {
  124         uint64_t mrt6s_mfc_lookups;     /* # forw. cache hash table hits   */
  125         uint64_t mrt6s_mfc_misses;      /* # forw. cache hash table misses */
  126         uint64_t mrt6s_upcalls;         /* # calls to multicast routing daemon */
  127         uint64_t mrt6s_no_route;        /* no route for packet's origin    */
  128         uint64_t mrt6s_bad_tunnel;      /* malformed tunnel options        */
  129         uint64_t mrt6s_cant_tunnel;     /* no room for tunnel options      */
  130         uint64_t mrt6s_wrong_if;        /* arrived on wrong interface      */
  131         uint64_t mrt6s_upq_ovflw;       /* upcall Q overflow               */
  132         uint64_t mrt6s_cache_cleanups;  /* # entries with no upcalls       */
  133         uint64_t mrt6s_drop_sel;        /* pkts dropped selectively        */
  134         uint64_t mrt6s_q_overflow;      /* pkts dropped - Q overflow       */
  135         uint64_t mrt6s_pkt2large;       /* pkts dropped - size > BKT SIZE  */
  136         uint64_t mrt6s_upq_sockfull;    /* upcalls dropped - socket full   */
  137 };
  138 
  139 #ifdef MRT6_OINIT
  140 /*
  141  * Struct used to communicate from kernel to multicast router
  142  * note the convenient similarity to an IPv6 header.
  143  * XXX old version, superseded by mrt6msg.
  144  */
  145 struct omrt6msg {
  146         u_long      unused1;
  147         u_char      im6_msgtype;                /* what type of message     */
  148         u_char      im6_mbz;                    /* must be zero             */
  149         u_char      im6_mif;                    /* mif rec'd on             */
  150         u_char      unused2;
  151         struct in6_addr  im6_src, im6_dst;
  152 };
  153 #endif
  154 
  155 /*
  156  * Structure used to communicate from kernel to multicast router.
  157  * We'll overlay the structure onto an MLD header (not an IPv6 header
  158  * like igmpmsg{} used for IPv4 implementation). This is because this
  159  * structure will be passed via an IPv6 raw socket, on which an application
  160  * will only receive the payload i.e. the data after the IPv6 header and all
  161  * the extension headers. (see Section 3 of RFC3542)
  162  */
  163 struct mrt6msg {
  164 #define MRT6MSG_NOCACHE         1
  165 #define MRT6MSG_WRONGMIF        2
  166 #define MRT6MSG_WHOLEPKT        3               /* used for user level encap*/
  167         u_char      im6_mbz;                    /* must be zero             */
  168         u_char      im6_msgtype;                /* what type of message     */
  169         u_int16_t   im6_mif;                    /* mif rec'd on             */
  170         u_int32_t   im6_pad;                    /* padding for 64bit arch   */
  171         struct in6_addr  im6_src, im6_dst;
  172 };
  173 
  174 /*
  175  * Argument structure used by multicast routing daemon to get src-grp
  176  * packet counts
  177  */
  178 struct sioc_sg_req6 {
  179         struct sockaddr_in6 src;
  180         struct sockaddr_in6 grp;
  181         u_quad_t pktcnt;
  182         u_quad_t bytecnt;
  183         u_quad_t wrong_if;
  184 };
  185 
  186 /*
  187  * Argument structure used by mrouted to get mif pkt counts
  188  */
  189 struct sioc_mif_req6 {
  190         mifi_t mifi;            /* mif number                           */
  191         u_quad_t icount;        /* Input packet count on mif            */
  192         u_quad_t ocount;        /* Output packet count on mif           */
  193         u_quad_t ibytes;        /* Input byte count on mif              */
  194         u_quad_t obytes;        /* Output byte count on mif             */
  195 };
  196 
  197 #if defined(_KERNEL) || defined(KERNEL)
  198 /*
  199  * The kernel's multicast-interface structure.
  200  */
  201 struct mif6 {
  202         u_char          m6_flags;       /* MIFF_ flags defined above         */
  203         u_int           m6_rate_limit;  /* max rate                          */
  204         struct in6_addr m6_lcl_addr;    /* local interface address           */
  205         struct ifnet    *m6_ifp;        /* pointer to interface              */
  206         u_quad_t        m6_pkt_in;      /* # pkts in on interface            */
  207         u_quad_t        m6_pkt_out;     /* # pkts out on interface           */
  208         u_quad_t        m6_bytes_in;    /* # bytes in on interface           */
  209         u_quad_t        m6_bytes_out;   /* # bytes out on interface          */
  210 #ifdef notyet
  211         u_int           m6_rsvp_on;     /* RSVP listening on this vif */
  212         struct socket   *m6_rsvpd;      /* RSVP daemon socket */
  213 #endif
  214 };
  215 
  216 /*
  217  * The kernel's multicast forwarding cache entry structure
  218  */
  219 struct mf6c {
  220         struct sockaddr_in6  mf6c_origin;       /* IPv6 origin of mcasts     */
  221         struct sockaddr_in6  mf6c_mcastgrp;     /* multicast group associated*/
  222         mifi_t           mf6c_parent;           /* incoming IF               */
  223         struct if_set    mf6c_ifset;            /* set of outgoing IFs */
  224 
  225         u_quad_t        mf6c_pkt_cnt;           /* pkt count for src-grp     */
  226         u_quad_t        mf6c_byte_cnt;          /* byte count for src-grp    */
  227         u_quad_t        mf6c_wrong_if;          /* wrong if for src-grp      */
  228         int             mf6c_expire;            /* time to clean entry up    */
  229         struct timeval  mf6c_last_assert;       /* last time I sent an assert*/
  230         struct rtdetq  *mf6c_stall;             /* pkts waiting for route */
  231         struct mf6c    *mf6c_next;              /* hash table linkage */
  232 };
  233 
  234 #define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
  235 
  236 /*
  237  * Argument structure used for pkt info. while upcall is made
  238  */
  239 #ifndef _NETINET_IP_MROUTE_H_
  240 struct rtdetq {         /* XXX: rtdetq is also defined in ip_mroute.h */
  241     struct mbuf         *m;             /* A copy of the packet             */
  242     struct ifnet        *ifp;           /* Interface pkt came in on         */
  243 #ifdef UPCALL_TIMING
  244     struct timeval      t;              /* Timestamp */
  245 #endif /* UPCALL_TIMING */
  246     struct rtdetq       *next;
  247 };
  248 #endif /* _NETINET_IP_MROUTE_H_ */
  249 
  250 #define MF6CTBLSIZ      256
  251 #if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0          /* from sys:route.h */
  252 #define MF6CHASHMOD(h)  ((h) & (MF6CTBLSIZ - 1))
  253 #else
  254 #define MF6CHASHMOD(h)  ((h) % MF6CTBLSIZ)
  255 #endif
  256 
  257 #define MAX_UPQ6        4               /* max. no of pkts in upcall Q */
  258 
  259 extern int      (*ip6_mrouter_set)(struct socket *so, struct sockopt *sopt);
  260 extern int      (*ip6_mrouter_get)(struct socket *so, struct sockopt *sopt);
  261 extern int      (*ip6_mrouter_done)(void);
  262 extern int      (*mrt6_ioctl)(u_long, caddr_t);
  263 #endif /* _KERNEL */
  264 
  265 #endif /* !_NETINET6_IP6_MROUTE_H_ */

Cache object: 12c955b677ff020dd026098b84c52247


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