ip_ndp.h (45916cd2) | ip_ndp.h (c793af95) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 24 unchanged lines hidden (view full) --- 33 * Neighbor Discovery Protocol (NDP). 34 */ 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40#ifdef _KERNEL | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 24 unchanged lines hidden (view full) --- 33 * Neighbor Discovery Protocol (NDP). 34 */ 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40#ifdef _KERNEL |
41/* 42 * ndp_g_lock protects neighbor cache tables access and 43 * insertion/removal of cache entries into/from these tables. 44 * nce_lock protects nce_pcnt, nce_rcnt, nce_qd_mp nce_state, 45 * nce_res_mp, nce_refcnt and nce_last. 46 * nce_refcnt is incremented for every ire pointing to this nce and 47 * every time ndp_lookup() finds an nce. 48 * Should there be a need to obtain nce_lock and ndp_g_lock, ndp_g_lock is 49 * acquired first. 50 * To avoid becoming exclusive when deleting NCEs, ndp_walk() routine holds 51 * the ndp_g_lock (i.e global lock) and marks NCEs to be deleted with 52 * NCE_F_CONDEMNED. When all active users of such NCEs are gone the walk 53 * routine passes a list for deletion to nce_ire_delete_list(). 54 */ 55kmutex_t ndp_g_lock; /* Lock protecting nighbor cache hash table */ | 41#define NCE_TABLE_SIZE 256 |
56/* NDP Cache Entry */ 57typedef struct nce_s { 58 struct nce_s *nce_next; /* Hash chain next pointer */ 59 struct nce_s **nce_ptpn; /* Pointer to previous next */ 60 struct ill_s *nce_ill; /* Associated ill */ 61 uint16_t nce_flags; /* See below */ 62 uint16_t nce_state; /* See reachability states in if.h */ 63 int16_t nce_pcnt; /* Probe counter */ --- 13 unchanged lines hidden (view full) --- 77 mblk_t *nce_mp; /* mblk we are in, last to be freed */ 78 uint64_t nce_last; /* Time last reachable in msec */ 79 uint32_t nce_refcnt; /* nce active usage count */ 80 kmutex_t nce_lock; /* See comments on top for what */ 81 /* this field protects */ 82 int nce_unsolicit_count; /* Unsolicited Adv count */ 83 struct nce_s *nce_fastpath; /* for fastpath list */ 84 timeout_id_t nce_timeout_id; | 42/* NDP Cache Entry */ 43typedef struct nce_s { 44 struct nce_s *nce_next; /* Hash chain next pointer */ 45 struct nce_s **nce_ptpn; /* Pointer to previous next */ 46 struct ill_s *nce_ill; /* Associated ill */ 47 uint16_t nce_flags; /* See below */ 48 uint16_t nce_state; /* See reachability states in if.h */ 49 int16_t nce_pcnt; /* Probe counter */ --- 13 unchanged lines hidden (view full) --- 63 mblk_t *nce_mp; /* mblk we are in, last to be freed */ 64 uint64_t nce_last; /* Time last reachable in msec */ 65 uint32_t nce_refcnt; /* nce active usage count */ 66 kmutex_t nce_lock; /* See comments on top for what */ 67 /* this field protects */ 68 int nce_unsolicit_count; /* Unsolicited Adv count */ 69 struct nce_s *nce_fastpath; /* for fastpath list */ 70 timeout_id_t nce_timeout_id; |
71 uchar_t nce_ipversion; /* IPv4(ARP)/IPv6(NDP) version */ |
|
85#ifdef NCE_DEBUG 86 th_trace_t *nce_trace[IP_TR_HASH_MAX]; 87 boolean_t nce_trace_disable; /* True when alloc fails */ 88#endif 89} nce_t; 90 | 72#ifdef NCE_DEBUG 73 th_trace_t *nce_trace[IP_TR_HASH_MAX]; 74 boolean_t nce_trace_disable; /* True when alloc fails */ 75#endif 76} nce_t; 77 |
78/* 79 * The ndp_g_t structure contains protocol specific information needed 80 * to synchronize and manage neighbor cache entries for IPv4 and IPv6. 81 * There are 2 such structures, ndp4 and ndp6. 82 * ndp6 contains the data structures needed for IPv6 Neighbor Discovery. 83 * ndp4 has IPv4 link layer info in its nce_t structures 84 * Note that the nce_t is not currently used as the arp cache itself; 85 * it is used for the following purposes: 86 * - queue packets in nce_qd_mp while waiting for arp resolution to complete 87 * - nce_{res, fp}_mp are used to track DL_UNITDATA request/responses. 88 * - track state of ARP resolution in the nce_state; 89 * 90 * Locking notes: 91 * ndp_g_lock protects neighbor cache tables access and 92 * insertion/removal of cache entries into/from these tables. 93 * nce_lock protects nce_pcnt, nce_rcnt, nce_qd_mp nce_state, 94 * nce_res_mp, nce_refcnt and nce_last. 95 * nce_refcnt is incremented for every ire pointing to this nce and 96 * every time ndp_lookup() finds an nce. 97 * Should there be a need to obtain nce_lock and ndp_g_lock, ndp_g_lock is 98 * acquired first. 99 * To avoid becoming exclusive when deleting NCEs, ndp_walk() routine holds 100 * the ndp_g_lock (i.e global lock) and marks NCEs to be deleted with 101 * NCE_F_CONDEMNED. When all active users of such NCEs are gone the walk 102 * routine passes a list for deletion to nce_ire_delete_list(). 103 */ 104typedef struct ndp_g_s { 105 kmutex_t ndp_g_lock; /* Lock protecting cache hash table */ 106 nce_t *nce_mask_entries; /* mask not all ones */ 107 nce_t *nce_hash_tbl[NCE_TABLE_SIZE]; 108 int ndp_g_walker; /* # of active thread walking hash list */ 109 boolean_t ndp_g_walker_cleanup; /* true implies defer deletion. */ 110} ndp_g_t; 111 112extern ndp_g_t ndp4, ndp6; 113 |
|
91/* nce_flags */ 92#define NCE_F_PERMANENT 0x1 93#define NCE_F_MAPPING 0x2 94#define NCE_F_ISROUTER 0x4 95#define NCE_F_PROXY 0x8 96#define NCE_F_NONUD 0x10 97#define NCE_F_ANYCAST 0x20 98#define NCE_F_CONDEMNED 0x40 --- 150 unchanged lines hidden (view full) --- 249extern void ndp_cache_reclaim(nce_t *, char *); 250extern void ndp_delete(nce_t *); 251extern void ndp_delete_per_ill(nce_t *, uchar_t *); 252extern void ndp_fastpath_flush(nce_t *, char *); 253extern boolean_t ndp_fastpath_update(nce_t *, void *); 254extern nd_opt_hdr_t *ndp_get_option(nd_opt_hdr_t *, int, int); 255extern void ndp_inactive(nce_t *); 256extern void ndp_input(ill_t *, mblk_t *); | 114/* nce_flags */ 115#define NCE_F_PERMANENT 0x1 116#define NCE_F_MAPPING 0x2 117#define NCE_F_ISROUTER 0x4 118#define NCE_F_PROXY 0x8 119#define NCE_F_NONUD 0x10 120#define NCE_F_ANYCAST 0x20 121#define NCE_F_CONDEMNED 0x40 --- 150 unchanged lines hidden (view full) --- 272extern void ndp_cache_reclaim(nce_t *, char *); 273extern void ndp_delete(nce_t *); 274extern void ndp_delete_per_ill(nce_t *, uchar_t *); 275extern void ndp_fastpath_flush(nce_t *, char *); 276extern boolean_t ndp_fastpath_update(nce_t *, void *); 277extern nd_opt_hdr_t *ndp_get_option(nd_opt_hdr_t *, int, int); 278extern void ndp_inactive(nce_t *); 279extern void ndp_input(ill_t *, mblk_t *); |
257extern nce_t *ndp_lookup(ill_t *, const in6_addr_t *, boolean_t); 258extern int ndp_lookup_then_add(ill_t *, uchar_t *, const in6_addr_t *, 259 const in6_addr_t *, const in6_addr_t *, uint32_t, uint16_t, 260 uint16_t, nce_t **); | 280extern nce_t *ndp_lookup_v6(ill_t *, const in6_addr_t *, boolean_t); 281extern nce_t *ndp_lookup_v4(ill_t *, const in_addr_t *, boolean_t); 282extern int ndp_lookup_then_add(ill_t *, uchar_t *, const void *, 283 const void *, const void *, uint32_t, uint16_t, 284 uint16_t, nce_t **, mblk_t *, mblk_t *); |
261extern int ndp_mcastreq(ill_t *, const in6_addr_t *, uint32_t, uint32_t, 262 mblk_t *); 263extern int ndp_noresolver(ill_t *, const in6_addr_t *); 264extern void ndp_process(nce_t *, uchar_t *, uint32_t, boolean_t); 265extern int ndp_query(ill_t *, lif_nd_req_t *); 266extern int ndp_report(queue_t *, mblk_t *, caddr_t, cred_t *); 267extern int ndp_resolver(ill_t *, const in6_addr_t *, mblk_t *, zoneid_t); 268extern int ndp_sioc_update(ill_t *, lif_nd_req_t *); 269extern boolean_t ndp_verify_optlen(nd_opt_hdr_t *, int); 270extern void ndp_timer(void *); 271extern void ndp_walk(ill_t *, pfi_t, void *); | 285extern int ndp_mcastreq(ill_t *, const in6_addr_t *, uint32_t, uint32_t, 286 mblk_t *); 287extern int ndp_noresolver(ill_t *, const in6_addr_t *); 288extern void ndp_process(nce_t *, uchar_t *, uint32_t, boolean_t); 289extern int ndp_query(ill_t *, lif_nd_req_t *); 290extern int ndp_report(queue_t *, mblk_t *, caddr_t, cred_t *); 291extern int ndp_resolver(ill_t *, const in6_addr_t *, mblk_t *, zoneid_t); 292extern int ndp_sioc_update(ill_t *, lif_nd_req_t *); 293extern boolean_t ndp_verify_optlen(nd_opt_hdr_t *, int); 294extern void ndp_timer(void *); 295extern void ndp_walk(ill_t *, pfi_t, void *); |
272extern void ndp_walk_impl(ill_t *, pfi_t, void *, boolean_t); 273extern int ndp_add(ill_t *, uchar_t *, const in6_addr_t *, 274 const in6_addr_t *, const in6_addr_t *, 275 uint32_t, uint16_t, uint16_t, nce_t **); | 296extern void ndp_walk_common(ndp_g_t *, ill_t *, pfi_t, 297 void *, boolean_t); 298extern int ndp_add(ill_t *, uchar_t *, const void *, 299 const void *, const void *, 300 uint32_t, uint16_t, uint16_t, nce_t **, mblk_t *, mblk_t *); |
276extern void nce_resolv_failed(nce_t *); | 301extern void nce_resolv_failed(nce_t *); |
302extern void arp_resolv_failed(nce_t *); |
|
277extern void nce_fastpath_list_add(nce_t *); 278extern void nce_fastpath_list_delete(nce_t *); 279extern void nce_fastpath_list_dispatch(ill_t *, 280 boolean_t (*)(nce_t *, void *), void *); | 303extern void nce_fastpath_list_add(nce_t *); 304extern void nce_fastpath_list_delete(nce_t *); 305extern void nce_fastpath_list_dispatch(ill_t *, 306 boolean_t (*)(nce_t *, void *), void *); |
307extern void nce_queue_mp_common(nce_t *, mblk_t *, boolean_t); 308extern void ndp_flush_qd_mp(nce_t *); 309extern nce_t *nce_reinit(nce_t *); 310 |
|
281#ifdef NCE_DEBUG 282extern void nce_trace_inactive(nce_t *); 283extern void nce_trace_ref(nce_t *); 284extern void nce_untrace_ref(nce_t *); 285extern int nce_thread_exit(nce_t *, caddr_t); 286#endif 287 288#endif /* _KERNEL */ 289 290#ifdef __cplusplus 291} 292#endif 293 294#endif /* _INET_IP_NDP_H */ | 311#ifdef NCE_DEBUG 312extern void nce_trace_inactive(nce_t *); 313extern void nce_trace_ref(nce_t *); 314extern void nce_untrace_ref(nce_t *); 315extern int nce_thread_exit(nce_t *, caddr_t); 316#endif 317 318#endif /* _KERNEL */ 319 320#ifdef __cplusplus 321} 322#endif 323 324#endif /* _INET_IP_NDP_H */ |