2000-07-04 16:35:15 +00:00
|
|
|
/* $FreeBSD$ */
|
2002-04-19 04:46:24 +00:00
|
|
|
/* $KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $ */
|
2000-07-04 16:35:15 +00:00
|
|
|
|
2005-01-07 02:30:35 +00:00
|
|
|
/*-
|
1999-11-22 02:45:11 +00:00
|
|
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETINET6_ND6_H_
|
2000-07-04 16:35:15 +00:00
|
|
|
#define _NETINET6_ND6_H_
|
|
|
|
|
|
|
|
/* see net/route.h, or net/if_inarp.h */
|
|
|
|
#ifndef RTF_ANNOUNCE
|
|
|
|
#define RTF_ANNOUNCE RTF_PROTO2
|
|
|
|
#endif
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
#include <sys/queue.h>
|
2001-06-11 12:39:29 +00:00
|
|
|
#include <sys/callout.h>
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
struct llinfo_nd6 {
|
|
|
|
struct llinfo_nd6 *ln_next;
|
|
|
|
struct llinfo_nd6 *ln_prev;
|
|
|
|
struct rtentry *ln_rt;
|
|
|
|
struct mbuf *ln_hold; /* last packet until resolved/timeout */
|
|
|
|
long ln_asked; /* number of queries already sent for this addr */
|
|
|
|
u_long ln_expire; /* lifetime for NDP state transition */
|
|
|
|
short ln_state; /* reachability state */
|
|
|
|
short ln_router; /* 2^0: ND6 router bit */
|
2000-07-04 16:35:15 +00:00
|
|
|
int ln_byhint; /* # of times we made it reachable by UL hint */
|
2005-10-21 16:23:01 +00:00
|
|
|
|
|
|
|
long ln_ntick;
|
|
|
|
struct callout ln_timer_ch;
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ND6_LLINFO_NOSTATE -2
|
2001-06-11 12:39:29 +00:00
|
|
|
/*
|
|
|
|
* We don't need the WAITDELETE state any more, but we keep the definition
|
|
|
|
* in a comment line instead of removing it. This is necessary to avoid
|
|
|
|
* unintentionally reusing the value for another purpose, which might
|
|
|
|
* affect backward compatibility with old applications.
|
|
|
|
* (20000711 jinmei@kame.net)
|
|
|
|
*/
|
|
|
|
/* #define ND6_LLINFO_WAITDELETE -1 */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ND6_LLINFO_INCOMPLETE 0
|
|
|
|
#define ND6_LLINFO_REACHABLE 1
|
|
|
|
#define ND6_LLINFO_STALE 2
|
|
|
|
#define ND6_LLINFO_DELAY 3
|
|
|
|
#define ND6_LLINFO_PROBE 4
|
|
|
|
|
|
|
|
#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
|
2005-10-21 16:23:01 +00:00
|
|
|
#define ND6_LLINFO_PERMANENT(n) (((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
struct nd_ifinfo {
|
2000-07-04 16:35:15 +00:00
|
|
|
u_int32_t linkmtu; /* LinkMTU */
|
|
|
|
u_int32_t maxmtu; /* Upper bound of LinkMTU */
|
|
|
|
u_int32_t basereachable; /* BaseReachableTime */
|
|
|
|
u_int32_t reachable; /* Reachable Time */
|
|
|
|
u_int32_t retrans; /* Retrans Timer */
|
|
|
|
u_int32_t flags; /* Flags */
|
|
|
|
int recalctm; /* BaseReacable re-calculation timer */
|
|
|
|
u_int8_t chlim; /* CurHopLimit */
|
2003-10-17 15:46:31 +00:00
|
|
|
u_int8_t initialized; /* Flag to see the entry is initialized */
|
2002-04-19 04:46:24 +00:00
|
|
|
/* the following 3 members are for privacy extension for addrconf */
|
2001-06-11 12:39:29 +00:00
|
|
|
u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
|
|
|
|
u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
|
|
|
|
u_int8_t randomid[8]; /* current random ID */
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ND6_IFF_PERFORMNUD 0x1
|
2003-08-05 14:57:11 +00:00
|
|
|
#define ND6_IFF_ACCEPT_RTADV 0x2
|
2005-10-19 16:20:18 +00:00
|
|
|
#define ND6_IFF_PREFER_SOURCE 0x4 /* XXX: not related to ND. */
|
|
|
|
#define ND6_IFF_IFDISABLED 0x8 /* IPv6 operation is disabled due to
|
|
|
|
* DAD failure. (XXX: not ND-specific)
|
|
|
|
*/
|
2005-10-21 16:23:01 +00:00
|
|
|
#define ND6_IFF_DONT_SET_IFROUTE 0x10
|
2000-07-04 16:35:15 +00:00
|
|
|
|
2003-10-17 15:46:31 +00:00
|
|
|
#ifdef _KERNEL
|
|
|
|
#define ND_IFINFO(ifp) \
|
|
|
|
(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
|
|
|
|
#define IN6_LINKMTU(ifp) \
|
|
|
|
((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
|
|
|
|
? ND_IFINFO(ifp)->linkmtu \
|
|
|
|
: ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
|
|
|
|
? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
|
|
|
|
#endif
|
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_nbrinfo {
|
2000-07-04 16:35:15 +00:00
|
|
|
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
|
|
|
|
struct in6_addr addr; /* IPv6 address of the neighbor */
|
1999-11-22 02:45:11 +00:00
|
|
|
long asked; /* number of queries already sent for this addr */
|
|
|
|
int isrouter; /* if it acts as a router */
|
|
|
|
int state; /* reachability state */
|
|
|
|
int expire; /* lifetime for NDP state transition */
|
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define DRLSTSIZ 10
|
|
|
|
#define PRLSTSIZ 10
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_drlist {
|
2000-07-04 16:35:15 +00:00
|
|
|
char ifname[IFNAMSIZ];
|
1999-11-22 02:45:11 +00:00
|
|
|
struct {
|
|
|
|
struct in6_addr rtaddr;
|
|
|
|
u_char flags;
|
|
|
|
u_short rtlifetime;
|
|
|
|
u_long expire;
|
2000-07-04 16:35:15 +00:00
|
|
|
u_short if_index;
|
1999-11-22 02:45:11 +00:00
|
|
|
} defrouter[DRLSTSIZ];
|
|
|
|
};
|
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
struct in6_defrouter {
|
|
|
|
struct sockaddr_in6 rtaddr;
|
|
|
|
u_char flags;
|
|
|
|
u_short rtlifetime;
|
|
|
|
u_long expire;
|
|
|
|
u_short if_index;
|
2001-08-10 00:34:20 +00:00
|
|
|
};
|
2001-06-11 12:39:29 +00:00
|
|
|
|
2003-10-24 18:26:30 +00:00
|
|
|
#ifdef _KERNEL
|
|
|
|
struct in6_oprlist {
|
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
struct {
|
|
|
|
struct in6_addr prefix;
|
|
|
|
struct prf_ra raflags;
|
|
|
|
u_char prefixlen;
|
|
|
|
u_char origin;
|
|
|
|
u_long vltime;
|
|
|
|
u_long pltime;
|
|
|
|
u_long expire;
|
|
|
|
u_short if_index;
|
|
|
|
u_short advrtrs; /* number of advertisement routers */
|
|
|
|
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
|
|
|
|
} prefix[PRLSTSIZ];
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_prlist {
|
2000-07-04 16:35:15 +00:00
|
|
|
char ifname[IFNAMSIZ];
|
1999-11-22 02:45:11 +00:00
|
|
|
struct {
|
|
|
|
struct in6_addr prefix;
|
2000-07-04 16:35:15 +00:00
|
|
|
struct prf_ra raflags;
|
1999-11-22 02:45:11 +00:00
|
|
|
u_char prefixlen;
|
2000-07-04 16:35:15 +00:00
|
|
|
u_char origin;
|
2002-04-19 04:46:24 +00:00
|
|
|
u_int32_t vltime;
|
|
|
|
u_int32_t pltime;
|
|
|
|
time_t expire;
|
2000-07-04 16:35:15 +00:00
|
|
|
u_short if_index;
|
|
|
|
u_short advrtrs; /* number of advertisement routers */
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
|
|
|
|
} prefix[PRLSTSIZ];
|
|
|
|
};
|
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
struct in6_prefix {
|
|
|
|
struct sockaddr_in6 prefix;
|
|
|
|
struct prf_ra raflags;
|
|
|
|
u_char prefixlen;
|
|
|
|
u_char origin;
|
2003-10-24 18:26:30 +00:00
|
|
|
u_int32_t vltime;
|
|
|
|
u_int32_t pltime;
|
|
|
|
time_t expire;
|
2001-06-11 12:39:29 +00:00
|
|
|
u_int32_t flags;
|
|
|
|
int refcnt;
|
|
|
|
u_short if_index;
|
|
|
|
u_short advrtrs; /* number of advertisement routers */
|
|
|
|
/* struct sockaddr_in6 advrtr[] */
|
2001-08-10 00:34:20 +00:00
|
|
|
};
|
2001-06-11 12:39:29 +00:00
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
struct in6_ondireq {
|
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
struct {
|
|
|
|
u_int32_t linkmtu; /* LinkMTU */
|
|
|
|
u_int32_t maxmtu; /* Upper bound of LinkMTU */
|
|
|
|
u_int32_t basereachable; /* BaseReachableTime */
|
|
|
|
u_int32_t reachable; /* Reachable Time */
|
|
|
|
u_int32_t retrans; /* Retrans Timer */
|
|
|
|
u_int32_t flags; /* Flags */
|
|
|
|
int recalctm; /* BaseReacable re-calculation timer */
|
|
|
|
u_int8_t chlim; /* CurHopLimit */
|
|
|
|
u_int8_t receivedra;
|
|
|
|
} ndi;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_ndireq {
|
2000-07-04 16:35:15 +00:00
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
struct nd_ifinfo ndi;
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
struct in6_ndifreq {
|
|
|
|
char ifname[IFNAMSIZ];
|
|
|
|
u_long ifindex;
|
|
|
|
};
|
|
|
|
|
2001-06-11 12:39:29 +00:00
|
|
|
/* Prefix status */
|
|
|
|
#define NDPRF_ONLINK 0x1
|
|
|
|
#define NDPRF_DETACHED 0x2
|
2000-07-04 16:35:15 +00:00
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
/* protocol constants */
|
2002-04-19 04:46:24 +00:00
|
|
|
#define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */
|
|
|
|
#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define MAX_RTR_SOLICITATIONS 3
|
1999-11-22 02:45:11 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ND6_INFINITE_LIFETIME 0xffffffff
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
/* node constants */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define MAX_REACHABLE_TIME 3600000 /* msec */
|
|
|
|
#define REACHABLE_TIME 30000 /* msec */
|
|
|
|
#define RETRANS_TIMER 1000 /* msec */
|
|
|
|
#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */
|
|
|
|
#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */
|
2001-06-11 12:39:29 +00:00
|
|
|
#define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */
|
|
|
|
#define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */
|
|
|
|
#define TEMPADDR_REGEN_ADVANCE 5 /* sec */
|
|
|
|
#define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ND_COMPUTE_RTIME(x) \
|
2003-10-31 16:06:05 +00:00
|
|
|
(((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \
|
1999-11-22 02:45:11 +00:00
|
|
|
((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
TAILQ_HEAD(nd_drhead, nd_defrouter);
|
1999-11-22 02:45:11 +00:00
|
|
|
struct nd_defrouter {
|
2000-07-04 16:35:15 +00:00
|
|
|
TAILQ_ENTRY(nd_defrouter) dr_entry;
|
1999-11-22 02:45:11 +00:00
|
|
|
struct in6_addr rtaddr;
|
2002-04-19 04:46:24 +00:00
|
|
|
u_char flags; /* flags on RA message */
|
1999-11-22 02:45:11 +00:00
|
|
|
u_short rtlifetime;
|
|
|
|
u_long expire;
|
2000-07-04 16:35:15 +00:00
|
|
|
struct ifnet *ifp;
|
2005-10-21 16:23:01 +00:00
|
|
|
int installed; /* is installed into kernel routing table */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nd_prefixctl {
|
|
|
|
struct ifnet *ndpr_ifp;
|
|
|
|
|
|
|
|
/* prefix */
|
|
|
|
struct sockaddr_in6 ndpr_prefix;
|
|
|
|
u_char ndpr_plen;
|
|
|
|
|
|
|
|
u_int32_t ndpr_vltime; /* advertised valid lifetime */
|
|
|
|
u_int32_t ndpr_pltime; /* advertised preferred lifetime */
|
|
|
|
|
|
|
|
struct prf_ra ndpr_flags;
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2005-10-21 16:23:01 +00:00
|
|
|
|
1999-11-22 02:45:11 +00:00
|
|
|
struct nd_prefix {
|
2000-07-04 16:35:15 +00:00
|
|
|
struct ifnet *ndpr_ifp;
|
2000-05-26 02:09:24 +00:00
|
|
|
LIST_ENTRY(nd_prefix) ndpr_entry;
|
2000-07-04 16:35:15 +00:00
|
|
|
struct sockaddr_in6 ndpr_prefix; /* prefix */
|
|
|
|
struct in6_addr ndpr_mask; /* netmask derived from the prefix */
|
2005-10-21 16:23:01 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
u_int32_t ndpr_vltime; /* advertised valid lifetime */
|
|
|
|
u_int32_t ndpr_pltime; /* advertised preferred lifetime */
|
2005-10-21 16:23:01 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
time_t ndpr_expire; /* expiration time of the prefix */
|
|
|
|
time_t ndpr_preferred; /* preferred time of the prefix */
|
2005-10-21 16:23:01 +00:00
|
|
|
time_t ndpr_lastupdate; /* reception time of last advertisement */
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
struct prf_ra ndpr_flags;
|
2001-06-11 12:39:29 +00:00
|
|
|
u_int32_t ndpr_stateflags; /* actual state flags */
|
1999-11-22 02:45:11 +00:00
|
|
|
/* list of routers that advertise the prefix: */
|
2000-05-26 02:09:24 +00:00
|
|
|
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
|
1999-11-22 02:45:11 +00:00
|
|
|
u_char ndpr_plen;
|
2001-06-11 12:39:29 +00:00
|
|
|
int ndpr_refcnt; /* reference couter from addresses */
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define ndpr_next ndpr_entry.le_next
|
|
|
|
|
|
|
|
#define ndpr_raf ndpr_flags
|
|
|
|
#define ndpr_raf_onlink ndpr_flags.onlink
|
|
|
|
#define ndpr_raf_auto ndpr_flags.autonomous
|
2005-10-21 16:23:01 +00:00
|
|
|
#define ndpr_raf_router ndpr_flags.router
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Message format for use in obtaining information about prefixes
|
|
|
|
* from inet6 sysctl function
|
|
|
|
*/
|
|
|
|
struct inet6_ndpr_msghdr {
|
|
|
|
u_short inpm_msglen; /* to skip over non-understood messages */
|
2001-02-06 12:05:58 +00:00
|
|
|
u_char inpm_version; /* future binary compatibility */
|
1999-11-22 02:45:11 +00:00
|
|
|
u_char inpm_type; /* message type */
|
2000-07-04 16:35:15 +00:00
|
|
|
struct in6_addr inpm_prefix;
|
1999-11-22 02:45:11 +00:00
|
|
|
u_long prm_vltim;
|
|
|
|
u_long prm_pltime;
|
|
|
|
u_long prm_expire;
|
|
|
|
u_long prm_preferred;
|
2000-07-04 16:35:15 +00:00
|
|
|
struct in6_prflags prm_flags;
|
1999-11-22 02:45:11 +00:00
|
|
|
u_short prm_index; /* index for associated ifp */
|
|
|
|
u_char prm_plen; /* length of prefix in bits */
|
|
|
|
};
|
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define prm_raf_onlink prm_flags.prf_ra.onlink
|
|
|
|
#define prm_raf_auto prm_flags.prf_ra.autonomous
|
1999-11-22 02:45:11 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define prm_statef_onlink prm_flags.prf_state.onlink
|
1999-11-22 02:45:11 +00:00
|
|
|
|
2000-07-04 16:35:15 +00:00
|
|
|
#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
|
|
|
|
#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
struct nd_pfxrouter {
|
2000-05-26 02:09:24 +00:00
|
|
|
LIST_ENTRY(nd_pfxrouter) pfr_entry;
|
2000-07-04 16:35:15 +00:00
|
|
|
#define pfr_next pfr_entry.le_next
|
|
|
|
struct nd_defrouter *router;
|
1999-11-22 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
2000-05-26 02:09:24 +00:00
|
|
|
LIST_HEAD(nd_prhead, nd_prefix);
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
/* nd6.c */
|
2000-07-04 16:35:15 +00:00
|
|
|
extern int nd6_prune;
|
|
|
|
extern int nd6_delay;
|
|
|
|
extern int nd6_umaxtries;
|
|
|
|
extern int nd6_mmaxtries;
|
|
|
|
extern int nd6_useloopback;
|
|
|
|
extern int nd6_maxnudhint;
|
2001-06-11 12:39:29 +00:00
|
|
|
extern int nd6_gctimer;
|
2000-07-04 16:35:15 +00:00
|
|
|
extern struct llinfo_nd6 llinfo_nd6;
|
|
|
|
extern struct nd_drhead nd_defrouter;
|
|
|
|
extern struct nd_prhead nd_prefix;
|
2001-06-11 12:39:29 +00:00
|
|
|
extern int nd6_debug;
|
|
|
|
|
2003-10-09 16:13:47 +00:00
|
|
|
#define nd6log(x) do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
|
2001-06-11 12:39:29 +00:00
|
|
|
|
|
|
|
extern struct callout nd6_timer_ch;
|
2000-07-04 16:35:15 +00:00
|
|
|
|
|
|
|
/* nd6_rtr.c */
|
|
|
|
extern int nd6_defifindex;
|
2001-06-11 12:39:29 +00:00
|
|
|
extern int ip6_desync_factor; /* seconds */
|
|
|
|
extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */
|
|
|
|
extern u_int32_t ip6_temp_valid_lifetime; /* seconds */
|
|
|
|
extern int ip6_temp_regen_advance; /* seconds */
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
union nd_opts {
|
2003-10-26 15:06:06 +00:00
|
|
|
struct nd_opt_hdr *nd_opt_array[8]; /* max = target address list */
|
1999-11-22 02:45:11 +00:00
|
|
|
struct {
|
2000-07-04 16:35:15 +00:00
|
|
|
struct nd_opt_hdr *zero;
|
|
|
|
struct nd_opt_hdr *src_lladdr;
|
|
|
|
struct nd_opt_hdr *tgt_lladdr;
|
2002-04-19 04:46:24 +00:00
|
|
|
struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */
|
2000-07-04 16:35:15 +00:00
|
|
|
struct nd_opt_rd_hdr *rh;
|
|
|
|
struct nd_opt_mtu *mtu;
|
|
|
|
struct nd_opt_hdr *search; /* multiple opts */
|
|
|
|
struct nd_opt_hdr *last; /* multiple opts */
|
|
|
|
int done;
|
|
|
|
struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
|
1999-11-22 02:45:11 +00:00
|
|
|
} nd_opt_each;
|
|
|
|
};
|
2000-07-04 16:35:15 +00:00
|
|
|
#define nd_opts_src_lladdr nd_opt_each.src_lladdr
|
|
|
|
#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
|
|
|
|
#define nd_opts_pi nd_opt_each.pi_beg
|
|
|
|
#define nd_opts_pi_end nd_opt_each.pi_end
|
|
|
|
#define nd_opts_rh nd_opt_each.rh
|
|
|
|
#define nd_opts_mtu nd_opt_each.mtu
|
|
|
|
#define nd_opts_search nd_opt_each.search
|
|
|
|
#define nd_opts_last nd_opt_each.last
|
|
|
|
#define nd_opts_done nd_opt_each.done
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
/* XXX: need nd6_var.h?? */
|
|
|
|
/* nd6.c */
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_init __P((void));
|
2003-10-17 15:46:31 +00:00
|
|
|
struct nd_ifinfo *nd6_ifattach __P((struct ifnet *));
|
|
|
|
void nd6_ifdetach __P((struct nd_ifinfo *));
|
2000-07-04 16:35:15 +00:00
|
|
|
int nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *));
|
|
|
|
void nd6_option_init __P((void *, int, union nd_opts *));
|
|
|
|
struct nd_opt_hdr *nd6_option __P((union nd_opts *));
|
|
|
|
int nd6_options __P((union nd_opts *));
|
1999-11-22 02:45:11 +00:00
|
|
|
struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_setmtu __P((struct ifnet *));
|
2005-10-21 16:23:01 +00:00
|
|
|
void nd6_llinfo_settimer __P((struct llinfo_nd6 *, long));
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_timer __P((void *));
|
|
|
|
void nd6_purge __P((struct ifnet *));
|
|
|
|
void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int));
|
2003-10-09 16:13:47 +00:00
|
|
|
int nd6_resolve __P((struct ifnet *, struct rtentry *, struct mbuf *,
|
|
|
|
struct sockaddr *, u_char *));
|
2001-10-17 18:07:05 +00:00
|
|
|
void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
|
2000-07-04 16:35:15 +00:00
|
|
|
int nd6_ioctl __P((u_long, caddr_t, struct ifnet *));
|
|
|
|
struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *,
|
|
|
|
char *, int, int, int));
|
|
|
|
int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *,
|
2003-10-09 16:13:47 +00:00
|
|
|
struct sockaddr_in6 *, struct rtentry *));
|
2005-10-21 16:23:01 +00:00
|
|
|
int nd6_need_cache __P((struct ifnet *));
|
2000-07-04 16:35:15 +00:00
|
|
|
int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
|
2003-10-09 16:13:47 +00:00
|
|
|
struct sockaddr *, u_char *));
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
/* nd6_nbr.c */
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_na_input __P((struct mbuf *, int, int));
|
2001-06-11 12:39:29 +00:00
|
|
|
void nd6_na_output __P((struct ifnet *, const struct in6_addr *,
|
|
|
|
const struct in6_addr *, u_long, int, struct sockaddr *));
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_ns_input __P((struct mbuf *, int, int));
|
2001-06-11 12:39:29 +00:00
|
|
|
void nd6_ns_output __P((struct ifnet *, const struct in6_addr *,
|
|
|
|
const struct in6_addr *, struct llinfo_nd6 *, int));
|
2000-07-04 16:35:15 +00:00
|
|
|
caddr_t nd6_ifptomac __P((struct ifnet *));
|
2005-10-21 16:23:01 +00:00
|
|
|
void nd6_dad_start __P((struct ifaddr *, int));
|
2001-06-11 12:39:29 +00:00
|
|
|
void nd6_dad_stop __P((struct ifaddr *));
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_dad_duplicated __P((struct ifaddr *));
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
/* nd6_rtr.c */
|
2000-07-04 16:35:15 +00:00
|
|
|
void nd6_rs_input __P((struct mbuf *, int, int));
|
|
|
|
void nd6_ra_input __P((struct mbuf *, int, int));
|
|
|
|
void prelist_del __P((struct nd_prefix *));
|
|
|
|
void defrouter_addreq __P((struct nd_defrouter *));
|
2005-10-21 16:23:01 +00:00
|
|
|
void defrouter_reset __P((void));
|
2000-07-04 16:35:15 +00:00
|
|
|
void defrouter_select __P((void));
|
|
|
|
void defrtrlist_del __P((struct nd_defrouter *));
|
|
|
|
void prelist_remove __P((struct nd_prefix *));
|
2005-10-21 16:23:01 +00:00
|
|
|
int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *,
|
2003-10-09 16:13:47 +00:00
|
|
|
struct nd_prefix **));
|
2001-06-11 12:39:29 +00:00
|
|
|
int nd6_prefix_onlink __P((struct nd_prefix *));
|
|
|
|
int nd6_prefix_offlink __P((struct nd_prefix *));
|
2000-07-04 16:35:15 +00:00
|
|
|
void pfxlist_onlink_check __P((void));
|
2003-10-09 16:13:47 +00:00
|
|
|
struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *));
|
2005-10-21 16:23:01 +00:00
|
|
|
struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *));
|
2000-07-04 16:35:15 +00:00
|
|
|
void rt6_flush __P((struct in6_addr *, struct ifnet *));
|
|
|
|
int nd6_setdefaultiface __P((int));
|
2005-10-21 16:23:01 +00:00
|
|
|
int in6_tmpifadd __P((const struct in6_ifaddr *, int, int));
|
1999-11-22 02:45:11 +00:00
|
|
|
|
|
|
|
#endif /* _KERNEL */
|
|
|
|
|
|
|
|
#endif /* _NETINET6_ND6_H_ */
|