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/nd6.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 /*      $OpenBSD: nd6.h,v 1.95 2023/01/06 14:35:34 kn Exp $     */
    2 /*      $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $    */
    3 
    4 /*
    5  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of the project nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  */
   32 
   33 #ifndef _NETINET6_ND6_H_
   34 #define _NETINET6_ND6_H_
   35 
   36 #include <sys/task.h>
   37 
   38 #define ND6_LLINFO_PURGE        -3
   39 #define ND6_LLINFO_NOSTATE      -2
   40 #define ND6_LLINFO_INCOMPLETE   0
   41 #define ND6_LLINFO_REACHABLE    1
   42 #define ND6_LLINFO_STALE        2
   43 #define ND6_LLINFO_DELAY        3
   44 #define ND6_LLINFO_PROBE        4
   45 
   46 /*
   47  *  Locks used to protect struct members in this file:
   48  *      N       net lock
   49  */
   50 
   51 struct nd_ifinfo {
   52         u_int32_t reachable;            /* [N] Reachable Time */
   53         int recalctm;                   /* [N] BaseReachable recalc timer */
   54 };
   55 
   56 struct in6_nbrinfo {
   57         char ifname[IFNAMSIZ];  /* if name, e.g. "en0" */
   58         struct in6_addr addr;   /* IPv6 address of the neighbor */
   59         time_t  expire;         /* lifetime for NDP state transition */
   60         long    asked;          /* number of queries already sent for addr */
   61         int     isrouter;       /* if it acts as a router */
   62         int     state;          /* reachability state */
   63 };
   64 
   65 struct  in6_ndireq {
   66         char ifname[IFNAMSIZ];
   67         struct nd_ifinfo ndi;
   68 };
   69 
   70 /* protocol constants */
   71 #define MAX_RTR_SOLICITATION_DELAY      1       /*1sec*/
   72 #define RTR_SOLICITATION_INTERVAL       4       /*4sec*/
   73 #define MAX_RTR_SOLICITATIONS           3
   74 
   75 #define ND6_INFINITE_LIFETIME           0xffffffff
   76 
   77 #ifdef _KERNEL
   78 
   79 #include <sys/queue.h>
   80 
   81 struct  llinfo_nd6 {
   82         TAILQ_ENTRY(llinfo_nd6) ln_list;
   83         struct  rtentry *ln_rt;
   84         struct  mbuf *ln_hold;  /* last packet until resolved/timeout */
   85         long    ln_asked;       /* number of queries already sent for addr */
   86         int     ln_byhint;      /* # of times we made it reachable by UL hint */
   87         short   ln_state;       /* reachability state */
   88         short   ln_router;      /* 2^0: ND6 router bit */
   89 };
   90 
   91 #define ND6_LLINFO_PERMANENT(n) ((n)->ln_rt->rt_expire == 0)
   92 
   93 /* node constants */
   94 #define REACHABLE_TIME                  30000   /* msec */
   95 #define RETRANS_TIMER                   1000    /* msec */
   96 #define MIN_RANDOM_FACTOR               512     /* 1024 * 0.5 */
   97 #define MAX_RANDOM_FACTOR               1536    /* 1024 * 1.5 */
   98 #define ND_COMPUTE_RTIME(x) \
   99                 (((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \
  100                 ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
  101 
  102 extern int nd6_delay;
  103 extern int nd6_umaxtries;
  104 extern int nd6_mmaxtries;
  105 extern int nd6_maxnudhint;
  106 extern int nd6_gctimer;
  107 extern int nd6_debug;
  108 
  109 #define nd6log(x)       do { if (nd6_debug) log x; } while (0)
  110 
  111 struct nd_opts {
  112         struct nd_opt_hdr *nd_opts_src_lladdr;
  113         struct nd_opt_hdr *nd_opts_tgt_lladdr;
  114 };
  115 
  116 void nd6_init(void);
  117 void nd6_ifattach(struct ifnet *);
  118 void nd6_ifdetach(struct ifnet *);
  119 int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *);
  120 int nd6_options(void *, int, struct nd_opts *);
  121 struct  rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *,
  122     u_int);
  123 void nd6_llinfo_settimer(const struct llinfo_nd6 *, unsigned int);
  124 void nd6_purge(struct ifnet *);
  125 void nd6_nud_hint(struct rtentry *);
  126 void nd6_rtrequest(struct ifnet *, int, struct rtentry *);
  127 int nd6_ioctl(u_long, caddr_t, struct ifnet *);
  128 void nd6_cache_lladdr(struct ifnet *, const struct in6_addr *, char *,
  129     int, int, int);
  130 int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
  131          struct sockaddr *, u_char *);
  132 int nd6_need_cache(struct ifnet *);
  133 
  134 void nd6_na_input(struct mbuf *, int, int);
  135 void nd6_na_output(struct ifnet *, const struct in6_addr *,
  136         const struct in6_addr *, u_long, int, struct sockaddr *);
  137 void nd6_ns_input(struct mbuf *, int, int);
  138 void nd6_ns_output(struct ifnet *, const struct in6_addr *,
  139         const struct in6_addr *, const struct llinfo_nd6 *, int);
  140 caddr_t nd6_ifptomac(struct ifnet *);
  141 void nd6_dad_start(struct ifaddr *);
  142 void nd6_dad_stop(struct ifaddr *);
  143 
  144 void nd6_rtr_cache(struct mbuf *, int, int, int);
  145 
  146 int rt6_flush(struct in6_addr *, struct ifnet *);
  147 
  148 void nd6_expire_timer_update(struct in6_ifaddr *);
  149 #endif /* _KERNEL */
  150 
  151 #endif /* _NETINET6_ND6_H_ */

Cache object: 440fa6c09268ccd3c578fcd043e390cb


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