summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/nd6.h
diff options
context:
space:
mode:
authoritojun <itojun@FreeBSD.org>2000-07-04 16:35:15 +0000
committeritojun <itojun@FreeBSD.org>2000-07-04 16:35:15 +0000
commit5f4e854de19331a53788d6100bbcd42845056bc1 (patch)
tree3ff8c876a5868b103fb8713055d83e29a3fa38d5 /sys/netinet6/nd6.h
parentbdc16885232d771a99d7dfc247cd27a44cd061f9 (diff)
downloadFreeBSD-src-5f4e854de19331a53788d6100bbcd42845056bc1.zip
FreeBSD-src-5f4e854de19331a53788d6100bbcd42845056bc1.tar.gz
sync with kame tree as of july00. tons of bug fixes/improvements.
API changes: - additional IPv6 ioctls - IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8). (also syntax change)
Diffstat (limited to 'sys/netinet6/nd6.h')
-rw-r--r--sys/netinet6/nd6.h323
1 files changed, 180 insertions, 143 deletions
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 756f495..be1264d 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -1,3 +1,6 @@
+/* $FreeBSD$ */
+/* $KAME: nd6.h,v 1.23 2000/06/04 12:54:57 itojun Exp $ */
+
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
@@ -25,12 +28,15 @@
* 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.
- *
- * $FreeBSD$
*/
#ifndef _NETINET6_ND6_H_
-#define _NETINET6_ND6_H_
+#define _NETINET6_ND6_H_
+
+/* see net/route.h, or net/if_inarp.h */
+#ifndef RTF_ANNOUNCE
+#define RTF_ANNOUNCE RTF_PROTO2
+#endif
#include <sys/queue.h>
@@ -43,128 +49,147 @@ struct llinfo_nd6 {
u_long ln_expire; /* lifetime for NDP state transition */
short ln_state; /* reachability state */
short ln_router; /* 2^0: ND6 router bit */
+ int ln_byhint; /* # of times we made it reachable by UL hint */
};
-#define ND6_LLINFO_NOSTATE -2
-#define ND6_LLINFO_WAITDELETE -1
-#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_LLINFO_NOSTATE -2
+#define ND6_LLINFO_WAITDELETE -1
+#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)
struct nd_ifinfo {
- 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 */
- int recalctm; /* BaseReacable re-calculation timer */
- u_int8_t chlim; /* CurHopLimit */
- u_int8_t receivedra;
+ 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;
};
+#define ND6_IFF_PERFORMNUD 0x1
+
struct in6_nbrinfo {
- char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct in6_addr addr; /* IPv6 address of the neighbor */
+ char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct in6_addr addr; /* IPv6 address of the neighbor */
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 */
};
-#define DRLSTSIZ 10
-#define PRLSTSIZ 10
+#define DRLSTSIZ 10
+#define PRLSTSIZ 10
struct in6_drlist {
- char ifname[IFNAMSIZ];
+ char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
- u_short if_index;
+ u_short if_index;
} defrouter[DRLSTSIZ];
};
struct in6_prlist {
- char ifname[IFNAMSIZ];
+ char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
- struct prf_ra raflags;
+ 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 */
+ u_short if_index;
+ u_short advrtrs; /* number of advertisement routers */
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
} prefix[PRLSTSIZ];
};
struct in6_ndireq {
- char ifname[IFNAMSIZ];
- struct nd_ifinfo ndi;
+ char ifname[IFNAMSIZ];
+ struct nd_ifinfo ndi;
};
+struct in6_ndifreq {
+ char ifname[IFNAMSIZ];
+ u_long ifindex;
+};
+
+
/* protocol constants */
-#define MAX_RTR_SOLICITATION_DELAY 1 /*1sec*/
-#define RTR_SOLICITATION_INTERVAL 4 /*4sec*/
-#define MAX_RTR_SOLICITATIONS 3
+#define MAX_RTR_SOLICITATION_DELAY 1 /*1sec*/
+#define RTR_SOLICITATION_INTERVAL 4 /*4sec*/
+#define MAX_RTR_SOLICITATIONS 3
-#define ND6_INFINITE_LIFETIME 0xffffffff
+#define ND6_INFINITE_LIFETIME 0xffffffff
#ifdef _KERNEL
/* node constants */
-#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 */
-#define ND_COMPUTE_RTIME(x) \
+#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 */
+#define ND_COMPUTE_RTIME(x) \
(((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \
((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
+TAILQ_HEAD(nd_drhead, nd_defrouter);
struct nd_defrouter {
- LIST_ENTRY(nd_defrouter) dr_entry;
+ TAILQ_ENTRY(nd_defrouter) dr_entry;
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
- struct ifnet *ifp;
+ u_long advint; /* Mobile IPv6 addition (milliseconds) */
+ u_long advint_expire; /* Mobile IPv6 addition */
+ int advints_lost; /* Mobile IPv6 addition */
+ struct ifnet *ifp;
};
struct nd_prefix {
- struct ifnet *ndpr_ifp;
+ struct ifnet *ndpr_ifp;
LIST_ENTRY(nd_prefix) ndpr_entry;
- struct sockaddr_in6 ndpr_prefix; /* prefix */
- struct in6_addr ndpr_mask; /* netmask derived from the prefix */
- struct in6_addr ndpr_addr; /* address that is derived from the prefix */
- u_int32_t ndpr_vltime; /* advertised valid lifetime */
- u_int32_t ndpr_pltime; /* advertised preferred lifetime */
- time_t ndpr_expire; /* expiration time of the prefix */
- time_t ndpr_preferred; /* preferred time of the prefix */
- struct prf_ra ndpr_flags;
+ struct sockaddr_in6 ndpr_prefix; /* prefix */
+ struct in6_addr ndpr_mask; /* netmask derived from the prefix */
+ struct in6_addr ndpr_addr; /* address that is derived from the prefix */
+ u_int32_t ndpr_vltime; /* advertised valid lifetime */
+ u_int32_t ndpr_pltime; /* advertised preferred lifetime */
+ time_t ndpr_expire; /* expiration time of the prefix */
+ time_t ndpr_preferred; /* preferred time of the prefix */
+ struct prf_ra ndpr_flags;
/* list of routers that advertise the prefix: */
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
u_char ndpr_plen;
struct ndpr_stateflags {
/* if this prefix can be regarded as on-link */
- u_char onlink : 1;
+ u_char onlink : 1;
} ndpr_stateflags;
};
-#define ndpr_raf ndpr_flags
-#define ndpr_raf_onlink ndpr_flags.onlink
-#define ndpr_raf_auto ndpr_flags.autonomous
+#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
-#define ndpr_statef_onlink ndpr_stateflags.onlink
-#define ndpr_statef_addmark ndpr_stateflags.addmark
+#define ndpr_statef_onlink ndpr_stateflags.onlink
+#define ndpr_statef_addmark ndpr_stateflags.addmark
/*
* We keep expired prefix for certain amount of time, for validation purposes.
* 1800s = MaxRtrAdvInterval
*/
-#define NDPR_KEEP_EXPIRED (1800 * 2)
+#define NDPR_KEEP_EXPIRED (1800 * 2)
/*
* Message format for use in obtaining information about prefixes
@@ -174,124 +199,136 @@ struct inet6_ndpr_msghdr {
u_short inpm_msglen; /* to skip over non-understood messages */
u_char inpm_version; /* future binary compatability */
u_char inpm_type; /* message type */
- struct in6_addr inpm_prefix;
+ struct in6_addr inpm_prefix;
u_long prm_vltim;
u_long prm_pltime;
u_long prm_expire;
u_long prm_preferred;
- struct in6_prflags prm_flags;
+ struct in6_prflags prm_flags;
u_short prm_index; /* index for associated ifp */
u_char prm_plen; /* length of prefix in bits */
};
-#define prm_raf_onlink prm_flags.prf_ra.onlink
-#define prm_raf_auto prm_flags.prf_ra.autonomous
+#define prm_raf_onlink prm_flags.prf_ra.onlink
+#define prm_raf_auto prm_flags.prf_ra.autonomous
-#define prm_statef_onlink prm_flags.prf_state.onlink
+#define prm_statef_onlink prm_flags.prf_state.onlink
-#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
-#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
+#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
+#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
-#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
-#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
+#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
+#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
struct nd_pfxrouter {
LIST_ENTRY(nd_pfxrouter) pfr_entry;
- struct nd_defrouter *router;
+#define pfr_next pfr_entry.le_next
+ struct nd_defrouter *router;
};
-LIST_HEAD(nd_drhead, nd_defrouter);
LIST_HEAD(nd_prhead, nd_prefix);
/* nd6.c */
-extern int nd6_prune;
-extern int nd6_delay;
-extern int nd6_umaxtries;
-extern int nd6_mmaxtries;
-extern int nd6_useloopback;
-extern int nd6_proxyall;
-extern struct llinfo_nd6 llinfo_nd6;
-extern struct nd_ifinfo *nd_ifinfo;
-extern struct nd_drhead nd_defrouter;
-extern struct nd_prhead nd_prefix;
+extern int nd6_prune;
+extern int nd6_delay;
+extern int nd6_umaxtries;
+extern int nd6_mmaxtries;
+extern int nd6_useloopback;
+extern int nd6_maxnudhint;
+extern struct llinfo_nd6 llinfo_nd6;
+extern struct nd_ifinfo *nd_ifinfo;
+extern struct nd_drhead nd_defrouter;
+extern struct nd_prhead nd_prefix;
+
+/* nd6_rtr.c */
+extern int nd6_defifindex;
union nd_opts {
- struct nd_opt_hdr *nd_opt_array[9];
+ struct nd_opt_hdr *nd_opt_array[9]; /*max = home agent info*/
struct {
- struct nd_opt_hdr *zero;
- struct nd_opt_hdr *src_lladdr;
- struct nd_opt_hdr *tgt_lladdr;
- struct nd_opt_prefix_info *pi_beg;/* multiple opts, start */
- 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 */
+ struct nd_opt_hdr *zero;
+ struct nd_opt_hdr *src_lladdr;
+ struct nd_opt_hdr *tgt_lladdr;
+ struct nd_opt_prefix_info *pi_beg;/* multiple opts, start */
+ struct nd_opt_rd_hdr *rh;
+ struct nd_opt_mtu *mtu;
+ struct nd_opt_hdr *six;
+ struct nd_opt_advint *adv;
+ struct nd_opt_hai *hai;
+ 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 */
} nd_opt_each;
};
-#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
+#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_adv nd_opt_each.adv
+#define nd_opts_hai nd_opt_each.hai
+#define nd_opts_search nd_opt_each.search
+#define nd_opts_last nd_opt_each.last
+#define nd_opts_done nd_opt_each.done
/* XXX: need nd6_var.h?? */
/* nd6.c */
-void nd6_init __P((void));
-void nd6_ifattach __P((struct ifnet *));
-int nd6_is_addr_neighbor __P((struct in6_addr *, 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 *));
+void nd6_init __P((void));
+void nd6_ifattach __P((struct ifnet *));
+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 *));
struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));
-void nd6_setmtu __P((struct ifnet *));
-void nd6_timer __P((void *));
-void nd6_free __P((struct rtentry *));
-void nd6_nud_hint __P((struct rtentry *, struct in6_addr *));
-int nd6_resolve __P((struct ifnet *, struct rtentry *,
- struct mbuf *, struct sockaddr *, u_char *));
-void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *));
-void nd6_p2p_rtrequest __P((int, struct rtentry *, struct sockaddr *));
-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));
+void nd6_setmtu __P((struct ifnet *));
+void nd6_timer __P((void *));
+void nd6_purge __P((struct ifnet *));
+void nd6_free __P((struct rtentry *));
+void nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int));
+int nd6_resolve __P((struct ifnet *, struct rtentry *,
+ struct mbuf *, struct sockaddr *, u_char *));
+void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+void nd6_p2p_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+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));
/* for test */
-int nd6_output __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *,
- struct rtentry *));
-int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
- struct sockaddr *, u_char *));
+int nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *,
+ struct sockaddr_in6 *, struct rtentry *));
+int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
+ struct sockaddr *, u_char *));
/* nd6_nbr.c */
-void nd6_na_input __P((struct mbuf *, int, int));
-void nd6_na_output __P((struct ifnet *, struct in6_addr *,
- struct in6_addr *, u_long, int));
-void nd6_ns_input __P((struct mbuf *, int, int));
-void nd6_ns_output __P((struct ifnet *, struct in6_addr *,
- struct in6_addr *, struct llinfo_nd6 *, int));
-caddr_t nd6_ifptomac __P((struct ifnet *));
-void nd6_dad_start __P((struct ifaddr *, int *));
-void nd6_dad_duplicated __P((struct ifaddr *));
+void nd6_na_input __P((struct mbuf *, int, int));
+void nd6_na_output __P((struct ifnet *, struct in6_addr *,
+ struct in6_addr *, u_long, int, struct sockaddr *));
+void nd6_ns_input __P((struct mbuf *, int, int));
+void nd6_ns_output __P((struct ifnet *, struct in6_addr *,
+ struct in6_addr *, struct llinfo_nd6 *, int));
+caddr_t nd6_ifptomac __P((struct ifnet *));
+void nd6_dad_start __P((struct ifaddr *, int *));
+void nd6_dad_duplicated __P((struct ifaddr *));
/* nd6_rtr.c */
-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 *));
-void defrouter_delreq __P((struct nd_defrouter *, int));
-void defrtrlist_del __P((struct nd_defrouter *));
-void prelist_remove __P((struct nd_prefix *));
-int prelist_update __P((struct nd_prefix *, struct nd_defrouter *,
- struct mbuf *));
-struct nd_defrouter *defrouter_lookup __P((struct in6_addr *,
- struct ifnet *));
-int in6_ifdel __P((struct ifnet *, struct in6_addr *));
-int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr));
-void rt6_flush __P((struct in6_addr *, struct ifnet *));
+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 *));
+void defrouter_delreq __P((struct nd_defrouter *, int));
+void defrouter_select __P((void));
+void defrtrlist_del __P((struct nd_defrouter *));
+void prelist_remove __P((struct nd_prefix *));
+int prelist_update __P((struct nd_prefix *, struct nd_defrouter *,
+ struct mbuf *));
+void pfxlist_onlink_check __P((void));
+struct nd_defrouter *defrouter_lookup __P((struct in6_addr *,
+ struct ifnet *));
+int in6_ifdel __P((struct ifnet *, struct in6_addr *));
+int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr));
+void rt6_flush __P((struct in6_addr *, struct ifnet *));
+int nd6_setdefaultiface __P((int));
#endif /* _KERNEL */
OpenPOWER on IntegriCloud