📄 nd6.h
字号:
#define RETRANS_TIMER 1000 /* msec */#if 0/* Removed as they aren't being used after the change to ND_COMPUTE_RTIME * sar March 27 2005 */#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */#endif#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 *//* This piece of code was simplified to avoid boundary conditions * when performing mutliplies and divides with large numbers * * The original code was: * #define ND_COMPUTE_RTIME(x) \ * (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \ * ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) * Any remainder will be ignored in this and so we could end up with values * less than expected in the first half of the expression. For example if * x = 60000 we would have 512 * (60000>>10) = 512 * 58 = 29696 which is * less than x/2. * * The next code was: * #define ND_COMPUTE_RTIME(x) \ * (((MIN_RANDOM_FACTOR * ((x + 1023) >> 10)) + (random() & \ * ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) * This corrected the problem on the low side but could lead to other * rounding type errors. As we don't many any real use of scale of the * min and max random factor we can simplify this expression by removing * the 1024 scale factor. * */#define ND_COMPUTE_RTIME(x) ((((x + 1) / 2) + (random() % (x - 1))) / 1000)TAILQ_HEAD(nd_drhead, nd_defrouter);struct nd_defrouter { TAILQ_ENTRY(nd_defrouter) dr_entry; struct in6_addr rtaddr; u_char flags; /* flags on RA message */ u_short rtlifetime; u_long expire; u_long advint; /* Mobile IPv6 addition (milliseconds) */ u_long advint_expire; /* Mobile IPv6 addition */ int advints_lost; /* Mobile IPv6 addition */ struct ifnet *ifp; 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 */ u_char ndpr_flags;};struct nd_prefix { 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 */ 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 */ time_t ndpr_lastupdate; /* reception time of last advertisement */ u_char ndpr_flags; u_int32_t ndpr_stateflags; /* actual state flags */ /* list of routers that advertise the prefix: */ LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; u_char ndpr_plen; int ndpr_refcnt; /* reference couter from addresses */};#define ndpr_next ndpr_entry.le_next#define ndpr_raf ndpr_flags/* * We keep expired prefix for certain amount of time, for validation purposes. * 1800s = MaxRtrAdvInterval */#define NDPR_KEEP_EXPIRED (1800 * 2)/* * 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 */ u_char inpm_version; /* future binary compatibility */ u_char inpm_type; /* message type */ 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; 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_statef_onlink prm_flags.prf_state.onlink#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefdstruct nd_pfxrouter { LIST_ENTRY(nd_pfxrouter) pfr_entry;#define pfr_next pfr_entry.le_next struct nd_defrouter *router;};LIST_HEAD(nd_prhead, nd_prefix);#ifndef VIRTUAL_STACK/* 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_maxnudhint;extern int _nd6_maxqueuelen;extern int nd6_gctimer;extern int nd6_recalc_reachtm_interval;extern struct llinfo_nd6 _llinfo_nd6;extern struct nd_drhead _nd_defrouter; /* was nd6_defrouter */extern struct nd_prhead _nd_prefix; /* was nd6_prefix */extern int _nd6_debug;#endif#if 1 /* accordion -> moved from nd6.c */#define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */#define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */#endif#define nd6log(x) do { if (_nd6_debug) log x; } while (0)#ifndef VIRTUAL_STACKextern struct callout nd6_timer_ch;/* nd6_rtr.c */extern int nd6_defifindex;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 */#endif /* VIRTUAL_STACK */union nd_opts { struct nd_opt_hdr *nd_opt_array[13]; /* max = target address list */ 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 *six; struct nd_opt_advinterval *adv; struct nd_opt_homeagent_info *hai; struct nd_opt_hdr *src_addrlist; struct nd_opt_hdr *tgt_addrlist; 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_adv nd_opt_each.adv#define nd_opts_hai nd_opt_each.hai#define nd_opts_src_addrlist nd_opt_each.src_addrlist#define nd_opts_tgt_addrlist nd_opt_each.tgt_addrlist#define nd_opts_search nd_opt_each.search#define nd_opts_last nd_opt_each.last#define nd_opts_done nd_opt_each.doneTAILQ_HEAD(dadq_head, dadq);struct dadq { TAILQ_ENTRY(dadq) dad_list; struct ifaddr *dad_ifa; int dad_count; /* max NS to send */ int dad_ns_tcount; /* # of trials to send NS */ int dad_ns_ocount; /* NS sent so far */ int dad_ns_icount; int dad_na_icount; struct callout dad_timer_ch;};/* XXX: need nd6_var.h?? *//* nd6.c */void nd6_init __P((void));struct nd_ifinfo *nd6_ifattach __P((struct ifnet *));void nd6_ifdetach __P((struct nd_ifinfo *));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_llinfo_settimer __P((struct llinfo_nd6 *, long));void nd6_timer __P((void *));void nd6_purge __P((struct ifnet *));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 *));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 *, struct sockaddr_in6 *, struct rtentry *));int nd6_need_cache __P((struct ifnet *));int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *));void nd6_drain __P((void));int nd6_need_cache __P((struct ifnet *));int ip6EtherResolvRtn __P((struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, char *,FUNCPTR));/* NOTE: m2Ipv6IfLib.c requires nd6_free() */struct llinfo_nd6 *nd6_free __P((struct rtentry *, int)); /* nd6_nbr.c */void nd6_na_input __P((struct mbuf *, int, int));void nd6_na_output __P((struct ifnet *, const struct in6_addr *, const struct in6_addr *, u_long, int, struct sockaddr *));void nd6_ns_input __P((struct mbuf *, int, int));void nd6_ns_output __P((struct ifnet *, const struct in6_addr *, const 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_stop __P((struct ifaddr *));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_reset __P((void));void defrouter_select __P((void));void defrtrlist_del __P((struct nd_defrouter *));void prelist_remove __P((struct nd_prefix *));int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *, struct nd_prefix **));int nd6_prefix_onlink __P((struct nd_prefix *));int nd6_prefix_offlink __P((struct nd_prefix *));void pfxlist_onlink_check __P((void));struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *));struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *));void rt6_flush __P((struct in6_addr *, struct ifnet *));int nd6_setdefaultiface __P((int));int in6_tmpifadd __P((const struct in6_ifaddr *, int, int));#endif /* _WRS_KERNEL */#ifdef __cplusplus}#endif#endif /* INET6 */ #endif /* _NETINET6_ND6_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -