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 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 /* Copyright (c) 1990 Mentat Inc. */ 26 27 #ifndef _INET_IP_IF_H 28 #define _INET_IP_IF_H 29 30 #include <net/route.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #define PREFIX_INFINITY 0xffffffffUL 37 #define IP_MAX_HW_LEN 40 38 39 #define IP_LOOPBACK_MTU (8*1024) 40 41 /* DLPI SAPs are in host byte order for all systems */ 42 #define IP_DL_SAP 0x0800 43 #define IP6_DL_SAP 0x86dd 44 45 #ifdef _KERNEL 46 /* 47 * Interface flags actually represent the state/properties of 3 different 48 * abstractions of interfaces in IP. Interface flags are set using 49 * SIOCS[L]IFFLAGS ioctl. The three abstractions are : 50 * 51 * 1) Physical interface (phyint) : There is one phyint allocated common 52 * to both IPv4 and IPv6 physical interface instance. 53 * 54 * 2) Physical interface instance (ill) : This encompasses all the state 55 * that is common across all IP addresses assigned to a physical 56 * interface but different between the IPv4 and IPv6 instance. 57 * 58 * 3) Logical interface (ipif) : This has state about a single IP address. 59 * 60 * Values for the various states are derived from the same name space 61 * as applications querying the state using SIOCGIFFLAGS/SIOCGLIFFLAGS 62 * see only one state returned in lifr_flags which is a union of all 63 * the above states/properties. Thus deriving the values from the common 64 * name space makes implementation easier. All these values are stored in 65 * uint64_t and any other structure/code using these flags should use 66 * uint64_ts. 67 * 68 * As we maintain the interface flags in 3 different flags namely 69 * phyint_flags, ill_flags, ipif_flags we define the following flag values 70 * to be used within the kernel to reduce potential errors. The ones 71 * starting with PHYI_ are supposed to be used with phyint_flags, the ones 72 * starting with ILLF_ are supposed to be used with ill_flags and the ones 73 * starting with IPIF_ are supposed to be used with ipif_flags. If you see 74 * any code with a mismatch i.e phyint_flags & IPIF_UP - it is wrong. Only 75 * PHYI_XXX can be used with phyint_flags. 76 * 77 * NOTE : For EVERY FLAG in if.h, there should be a corresponding value 78 * defined HERE and this is the one that should be USED within IP. We 79 * use IFF_ flags within IP only when we examine lifr_flags. 80 */ 81 #define IFF_PHYINT_FLAGS (IFF_LOOPBACK|IFF_RUNNING|IFF_PROMISC| \ 82 IFF_ALLMULTI|IFF_INTELLIGENT|IFF_MULTI_BCAST|IFF_FAILED|IFF_STANDBY| \ 83 IFF_INACTIVE|IFF_OFFLINE|IFF_VIRTUAL|IFF_IPMP) 84 85 #define IFF_PHYINTINST_FLAGS (IFF_DEBUG|IFF_NOTRAILERS|IFF_NOARP| \ 86 IFF_MULTICAST|IFF_ROUTER|IFF_NONUD|IFF_NORTEXCH|IFF_IPV4|IFF_IPV6| \ 87 IFF_XRESOLV|IFF_COS_ENABLED) 88 89 #define IFF_LOGINT_FLAGS (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| \ 90 IFF_UNNUMBERED|IFF_DHCPRUNNING|IFF_PRIVATE|IFF_NOXMIT|IFF_NOLOCAL| \ 91 IFF_DEPRECATED|IFF_ADDRCONF|IFF_ANYCAST|IFF_NOFAILOVER| \ 92 IFF_PREFERRED|IFF_TEMPORARY|IFF_FIXEDMTU|IFF_DUPLICATE) 93 94 #define PHYI_LOOPBACK IFF_LOOPBACK /* is a loopback net */ 95 #define PHYI_RUNNING IFF_RUNNING /* resources allocated */ 96 #define PHYI_PROMISC IFF_PROMISC /* receive all packets */ 97 #define PHYI_ALLMULTI IFF_ALLMULTI /* receive all multi packets */ 98 #define PHYI_INTELLIGENT IFF_INTELLIGENT /* protocol code on board */ 99 #define PHYI_MULTI_BCAST IFF_MULTI_BCAST /* multicast using broadcast */ 100 #define PHYI_FAILED IFF_FAILED /* NIC has failed */ 101 #define PHYI_STANDBY IFF_STANDBY /* Standby NIC */ 102 #define PHYI_INACTIVE IFF_INACTIVE /* Standby active or not ? */ 103 #define PHYI_OFFLINE IFF_OFFLINE /* NIC has been offlined */ 104 #define PHYI_VIRTUAL IFF_VIRTUAL /* Will not send or recv pkts */ 105 #define PHYI_IPMP IFF_IPMP /* IPMP meta-interface */ 106 107 #define ILLF_DEBUG IFF_DEBUG /* turn on debugging */ 108 #define ILLF_NOTRAILERS IFF_NOTRAILERS /* avoid use of trailers */ 109 #define ILLF_NOARP IFF_NOARP /* no ARP for this interface */ 110 #define ILLF_MULTICAST IFF_MULTICAST /* supports multicast */ 111 #define ILLF_ROUTER IFF_ROUTER /* router on this interface */ 112 #define ILLF_NONUD IFF_NONUD /* No NUD on this interface */ 113 #define ILLF_NORTEXCH IFF_NORTEXCH /* No routing info exchange */ 114 #define ILLF_IPV4 IFF_IPV4 /* IPv4 interface */ 115 #define ILLF_IPV6 IFF_IPV6 /* IPv6 interface */ 116 #define ILLF_XRESOLV IFF_XRESOLV /* IPv6 external resolver */ 117 #define ILLF_COS_ENABLED IFF_COS_ENABLED /* Is CoS marking supported */ 118 119 #define IPIF_UP IFF_UP /* interface is up */ 120 #define IPIF_BROADCAST IFF_BROADCAST /* broadcast address valid */ 121 #define IPIF_POINTOPOINT IFF_POINTOPOINT /* point-to-point link */ 122 #define IPIF_UNNUMBERED IFF_UNNUMBERED /* non-unique address */ 123 #define IPIF_DHCPRUNNING IFF_DHCPRUNNING /* DHCP controlled interface */ 124 #define IPIF_PRIVATE IFF_PRIVATE /* do not advertise */ 125 #define IPIF_NOXMIT IFF_NOXMIT /* Do not transmit packets */ 126 #define IPIF_NOLOCAL IFF_NOLOCAL /* Just on-link subnet */ 127 #define IPIF_DEPRECATED IFF_DEPRECATED /* address deprecated */ 128 #define IPIF_ADDRCONF IFF_ADDRCONF /* stateless addrconf */ 129 #define IPIF_ANYCAST IFF_ANYCAST /* Anycast address */ 130 #define IPIF_NOFAILOVER IFF_NOFAILOVER /* No failover on NIC failure */ 131 #define IPIF_PREFERRED IFF_PREFERRED /* Prefer as source address */ 132 #define IPIF_TEMPORARY IFF_TEMPORARY /* RFC3041 */ 133 #define IPIF_FIXEDMTU IFF_FIXEDMTU /* set with SIOCSLIFMTU */ 134 #define IPIF_DUPLICATE IFF_DUPLICATE /* address is in use */ 135 136 #ifdef DEBUG 137 #define ILL_MAC_PERIM_HELD(ill) ill_mac_perim_held(ill) 138 #else 139 #define ILL_MAC_PERIM_HELD(ill) 140 #endif 141 142 /* for ipif_resolver_up */ 143 enum ip_resolver_action { 144 Res_act_initial, /* initial address establishment */ 145 Res_act_rebind, /* IPMP address rebind (new hwaddr) */ 146 Res_act_defend, /* address defense */ 147 Res_act_none /* do nothing */ 148 }; 149 150 extern mblk_t *ill_arp_alloc(ill_t *, const uchar_t *, caddr_t); 151 extern mblk_t *ipif_area_alloc(ipif_t *, uint_t); 152 extern mblk_t *ipif_ared_alloc(ipif_t *); 153 extern mblk_t *ill_ared_alloc(ill_t *, ipaddr_t); 154 extern mblk_t *ill_arie_alloc(ill_t *, const char *, const void *); 155 extern boolean_t ill_dlpi_pending(ill_t *, t_uscalar_t); 156 extern void ill_dlpi_done(ill_t *, t_uscalar_t); 157 extern void ill_dlpi_send(ill_t *, mblk_t *); 158 extern void ill_dlpi_send_deferred(ill_t *); 159 extern void ill_capability_done(ill_t *); 160 161 extern mblk_t *ill_dlur_gen(uchar_t *, uint_t, t_uscalar_t, t_scalar_t); 162 /* NOTE: Keep unmodified ill_lookup_on_ifindex for ipp for now */ 163 extern ill_t *ill_lookup_on_ifindex_global_instance(uint_t, boolean_t, 164 queue_t *, mblk_t *, ipsq_func_t, int *); 165 extern ill_t *ill_lookup_on_ifindex(uint_t, boolean_t, queue_t *, mblk_t *, 166 ipsq_func_t, int *, ip_stack_t *); 167 extern ill_t *ill_lookup_on_name(char *, boolean_t, 168 boolean_t, queue_t *, mblk_t *, ipsq_func_t, int *, boolean_t *, 169 ip_stack_t *); 170 extern uint_t ill_get_next_ifindex(uint_t, boolean_t, ip_stack_t *); 171 extern uint_t ill_get_ifindex_by_name(char *, ip_stack_t *); 172 extern void ill_grp_cache_delete(ire_t *, char *); 173 extern void ill_ipif_cache_delete(ire_t *, char *); 174 extern void ill_stq_cache_delete(ire_t *, char *); 175 extern void ill_delete(ill_t *); 176 extern void ill_delete_tail(ill_t *); 177 extern int ill_dl_phys(ill_t *, ipif_t *, mblk_t *, queue_t *); 178 extern int ill_dls_info(struct sockaddr_dl *, const ipif_t *); 179 extern void ill_fastpath_ack(ill_t *, mblk_t *); 180 extern void ill_fastpath_nack(ill_t *); 181 extern int ill_fastpath_probe(ill_t *, mblk_t *); 182 extern void ill_fastpath_flush(ill_t *); 183 extern int ill_forward_set(ill_t *, boolean_t); 184 extern void ill_frag_prune(ill_t *, uint_t); 185 extern void ill_frag_free_pkts(ill_t *, ipfb_t *, ipf_t *, int); 186 extern time_t ill_frag_timeout(ill_t *, time_t); 187 extern int ill_init(queue_t *, ill_t *); 188 extern void ill_refresh_bcast(ill_t *); 189 extern void ill_restart_dad(ill_t *, boolean_t); 190 extern boolean_t ill_setdefaulttoken(ill_t *); 191 extern int ill_set_phys_addr(ill_t *, mblk_t *); 192 extern int ill_replumb(ill_t *, mblk_t *); 193 extern void ill_set_ndmp(ill_t *, mblk_t *, uint_t, uint_t); 194 195 extern mblk_t *ill_pending_mp_get(ill_t *, conn_t **, uint_t); 196 extern boolean_t ill_pending_mp_add(ill_t *, conn_t *, mblk_t *); 197 extern boolean_t ill_is_freeable(ill_t *ill); 198 extern void ill_refhold(ill_t *); 199 extern void ill_refhold_locked(ill_t *); 200 extern int ill_check_and_refhold(ill_t *); 201 extern void ill_refrele(ill_t *); 202 extern boolean_t ill_waiter_inc(ill_t *); 203 extern void ill_waiter_dcr(ill_t *); 204 extern void ill_trace_ref(ill_t *); 205 extern void ill_untrace_ref(ill_t *); 206 extern boolean_t ill_down_start(queue_t *, mblk_t *); 207 extern ill_t *ill_lookup_group_v6(const in6_addr_t *, zoneid_t, 208 ip_stack_t *); 209 210 extern void ill_capability_ack(ill_t *, mblk_t *); 211 extern void ill_capability_probe(ill_t *); 212 extern void ill_capability_reset(ill_t *, boolean_t); 213 extern void ill_taskq_dispatch(ip_stack_t *); 214 215 extern void ill_mtu_change(ire_t *, char *); 216 extern int ill_up_ipifs(ill_t *, queue_t *, mblk_t *); 217 extern uint_t ill_appaddr_cnt(const ill_t *); 218 extern uint_t ill_ptpaddr_cnt(const ill_t *); 219 220 extern void ip_loopback_cleanup(ip_stack_t *); 221 extern void ipif_get_name(const ipif_t *, char *, int); 222 extern ipif_t *ipif_getby_indexes(uint_t, uint_t, boolean_t, ip_stack_t *); 223 extern void ipif_init(ip_stack_t *); 224 extern ipif_t *ipif_lookup_addr(ipaddr_t, ill_t *, zoneid_t, queue_t *, 225 mblk_t *, ipsq_func_t, int *, ip_stack_t *); 226 extern boolean_t ip_addr_exists(ipaddr_t, zoneid_t, ip_stack_t *); 227 extern ipif_t *ipif_lookup_addr_v6(const in6_addr_t *, ill_t *, zoneid_t, 228 queue_t *, mblk_t *, ipsq_func_t, int *, ip_stack_t *); 229 extern boolean_t ip_addr_exists_v6(const in6_addr_t *, zoneid_t, 230 ip_stack_t *); 231 extern ipif_t *ipif_lookup_addr_exact_v6(const in6_addr_t *, ill_t *, 232 ip_stack_t *); 233 extern zoneid_t ipif_lookup_addr_zoneid(ipaddr_t, ill_t *, ip_stack_t *); 234 extern zoneid_t ipif_lookup_addr_zoneid_v6(const in6_addr_t *, ill_t *, 235 ip_stack_t *); 236 extern ipif_t *ipif_lookup_group(ipaddr_t, zoneid_t, ip_stack_t *); 237 extern ipif_t *ipif_lookup_group_v6(const in6_addr_t *, zoneid_t, 238 ip_stack_t *); 239 extern ipif_t *ipif_lookup_interface(ipaddr_t, ipaddr_t, 240 queue_t *, mblk_t *, ipsq_func_t, int *, ip_stack_t *); 241 extern ipif_t *ipif_lookup_multicast(ip_stack_t *, zoneid_t, boolean_t); 242 extern ipif_t *ipif_lookup_remote(ill_t *, ipaddr_t, zoneid_t); 243 extern ipif_t *ipif_lookup_onlink_addr(ipaddr_t, zoneid_t, ip_stack_t *); 244 extern ipif_t *ipif_lookup_seqid(ill_t *, uint_t); 245 extern boolean_t ipif_lookup_zoneid(ill_t *, zoneid_t, int, ipif_t **); 246 extern ipif_t *ipif_select_source(ill_t *, ipaddr_t, zoneid_t); 247 extern boolean_t ipif_usesrc_avail(ill_t *, zoneid_t); 248 extern void ipif_refhold(ipif_t *); 249 extern void ipif_refhold_locked(ipif_t *); 250 extern void ipif_refrele(ipif_t *); 251 extern void ipif_all_down_tail(ipsq_t *, queue_t *, mblk_t *, void *); 252 extern void ipif_resolver_down(ipif_t *); 253 extern int ipif_resolver_up(ipif_t *, enum ip_resolver_action); 254 extern int ipif_arp_setup_multicast(ipif_t *, mblk_t **); 255 extern int ipif_down(ipif_t *, queue_t *, mblk_t *); 256 extern void ipif_down_tail(ipif_t *); 257 extern void ipif_multicast_down(ipif_t *); 258 extern void ipif_multicast_up(ipif_t *); 259 extern void ipif_ndp_down(ipif_t *); 260 extern int ipif_ndp_up(ipif_t *, boolean_t); 261 extern int ipif_ndp_setup_multicast(ipif_t *, struct nce_s **); 262 extern int ipif_up_done(ipif_t *); 263 extern int ipif_up_done_v6(ipif_t *); 264 extern void ipif_up_notify(ipif_t *); 265 extern void ipif_update_other_ipifs_v6(ipif_t *); 266 extern void ipif_recreate_interface_routes_v6(ipif_t *, ipif_t *); 267 extern void ill_update_source_selection(ill_t *); 268 extern ipif_t *ipif_select_source_v6(ill_t *, const in6_addr_t *, boolean_t, 269 uint32_t, zoneid_t); 270 extern boolean_t ipif_cant_setlinklocal(ipif_t *); 271 extern int ipif_setlinklocal(ipif_t *); 272 extern void ipif_set_tun_llink(ill_t *, struct iftun_req *); 273 extern ipif_t *ipif_lookup_on_ifindex(uint_t, boolean_t, zoneid_t, queue_t *, 274 mblk_t *, ipsq_func_t, int *, ip_stack_t *); 275 extern ipif_t *ipif_get_next_ipif(ipif_t *curr, ill_t *ill); 276 extern void ipif_ill_refrele_tail(ill_t *ill); 277 extern void ipif_mask_reply(ipif_t *); 278 extern int ipif_up(ipif_t *, queue_t *, mblk_t *); 279 280 extern void ipsq_current_start(ipsq_t *, ipif_t *, int); 281 extern void ipsq_current_finish(ipsq_t *); 282 extern void ipsq_enq(ipsq_t *, queue_t *, mblk_t *, ipsq_func_t, int, 283 ill_t *); 284 extern boolean_t ipsq_enter(ill_t *, boolean_t, int); 285 extern ipsq_t *ipsq_try_enter(ipif_t *, ill_t *, queue_t *, mblk_t *, 286 ipsq_func_t, int, boolean_t); 287 extern void ipsq_exit(ipsq_t *); 288 extern boolean_t ill_mac_perim_held(ill_t *); 289 extern mblk_t *ipsq_pending_mp_get(ipsq_t *, conn_t **); 290 extern boolean_t ipsq_pending_mp_add(conn_t *, ipif_t *, queue_t *, 291 mblk_t *, int); 292 extern void qwriter_ip(ill_t *, queue_t *, mblk_t *, ipsq_func_t, int, 293 boolean_t); 294 295 typedef int ip_extract_func_t(queue_t *, mblk_t *, const ip_ioctl_cmd_t *, 296 cmd_info_t *, ipsq_func_t); 297 298 extern ip_extract_func_t ip_extract_arpreq, ip_extract_lifreq; 299 extern ip_extract_func_t ip_extract_tunreq; 300 301 extern int ip_addr_availability_check(ipif_t *); 302 extern void ip_ll_subnet_defaults(ill_t *, mblk_t *); 303 304 extern int ip_rt_add(ipaddr_t, ipaddr_t, ipaddr_t, ipaddr_t, int, 305 ipif_t *, ire_t **, boolean_t, queue_t *, mblk_t *, ipsq_func_t, 306 struct rtsa_s *, ip_stack_t *); 307 extern int ip_rt_add_v6(const in6_addr_t *, const in6_addr_t *, 308 const in6_addr_t *, const in6_addr_t *, int, ipif_t *, ire_t **, 309 queue_t *, mblk_t *, ipsq_func_t, struct rtsa_s *, ip_stack_t *ipst); 310 extern int ip_rt_delete(ipaddr_t, ipaddr_t, ipaddr_t, uint_t, int, 311 ipif_t *, boolean_t, queue_t *, mblk_t *, ipsq_func_t, ip_stack_t *); 312 extern int ip_rt_delete_v6(const in6_addr_t *, const in6_addr_t *, 313 const in6_addr_t *, uint_t, int, ipif_t *, queue_t *, mblk_t *, 314 ipsq_func_t, ip_stack_t *); 315 extern int ip_siocdelndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *, 316 ip_ioctl_cmd_t *, void *); 317 extern int ip_siocqueryndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *, 318 ip_ioctl_cmd_t *, void *); 319 extern int ip_siocsetndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *, 320 ip_ioctl_cmd_t *, void *); 321 322 extern int ip_siocaddrt(ipif_t *, sin_t *, queue_t *, mblk_t *, 323 ip_ioctl_cmd_t *, void *); 324 extern int ip_siocdelrt(ipif_t *, sin_t *, queue_t *, mblk_t *, 325 ip_ioctl_cmd_t *, void *); 326 327 extern int ip_sioctl_addr(ipif_t *, sin_t *, queue_t *, mblk_t *, 328 ip_ioctl_cmd_t *, void *); 329 extern int ip_sioctl_addr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 330 ip_ioctl_cmd_t *, void *); 331 extern int ip_sioctl_get_addr(ipif_t *, sin_t *, queue_t *, mblk_t *, 332 ip_ioctl_cmd_t *, void *); 333 334 extern int ip_sioctl_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *, 335 ip_ioctl_cmd_t *, void *); 336 extern int ip_sioctl_dstaddr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 337 ip_ioctl_cmd_t *, void *); 338 extern int ip_sioctl_get_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *, 339 ip_ioctl_cmd_t *, void *); 340 341 extern int ip_sioctl_flags(ipif_t *, sin_t *, queue_t *, mblk_t *, 342 ip_ioctl_cmd_t *, void *); 343 extern int ip_sioctl_flags_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 344 ip_ioctl_cmd_t *, void *); 345 extern int ip_sioctl_get_flags(ipif_t *, sin_t *, queue_t *, mblk_t *, 346 ip_ioctl_cmd_t *, void *); 347 348 extern int ip_sioctl_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *, 349 ip_ioctl_cmd_t *, void *); 350 extern int ip_sioctl_get_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *, 351 ip_ioctl_cmd_t *, void *); 352 353 extern int ip_sioctl_get_ifconf(ipif_t *, sin_t *, queue_t *, mblk_t *, 354 ip_ioctl_cmd_t *, void *); 355 extern int ip_sioctl_get_lifconf(ipif_t *, sin_t *, queue_t *, mblk_t *, 356 ip_ioctl_cmd_t *, void *); 357 extern int ip_sioctl_get_ifnum(ipif_t *, sin_t *, queue_t *, mblk_t *, 358 ip_ioctl_cmd_t *, void *); 359 extern int ip_sioctl_get_lifnum(ipif_t *, sin_t *, queue_t *, mblk_t *, 360 ip_ioctl_cmd_t *, void *); 361 362 extern int ip_sioctl_token(ipif_t *, sin_t *, queue_t *, mblk_t *, 363 ip_ioctl_cmd_t *, void *); 364 extern int ip_sioctl_get_token(ipif_t *, sin_t *, queue_t *, mblk_t *, 365 ip_ioctl_cmd_t *, void *); 366 367 extern int if_unitsel(ipif_t *, sin_t *, queue_t *, mblk_t *, 368 ip_ioctl_cmd_t *, void *); 369 extern int if_unitsel_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 370 ip_ioctl_cmd_t *, void *); 371 372 extern int ip_sioctl_sifname(ipif_t *, sin_t *, queue_t *, mblk_t *, 373 ip_ioctl_cmd_t *, void *); 374 375 extern int ip_sioctl_slifname(ipif_t *, sin_t *, queue_t *, mblk_t *, 376 ip_ioctl_cmd_t *, void *); 377 extern int ip_sioctl_slifname_restart(ipif_t *, sin_t *, queue_t *, 378 mblk_t *, ip_ioctl_cmd_t *, void *); 379 380 extern int ip_sioctl_slifindex(ipif_t *, sin_t *, queue_t *, mblk_t *, 381 ip_ioctl_cmd_t *, void *); 382 extern int ip_sioctl_get_lifindex(ipif_t *, sin_t *, queue_t *, mblk_t *, 383 ip_ioctl_cmd_t *, void *); 384 385 extern int ip_sioctl_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *, 386 ip_ioctl_cmd_t *, void *); 387 extern int ip_sioctl_get_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *, 388 ip_ioctl_cmd_t *, void *); 389 390 extern int ip_sioctl_get_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *, 391 ip_ioctl_cmd_t *, void *); 392 extern int ip_sioctl_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *, 393 ip_ioctl_cmd_t *, void *); 394 395 extern int ip_sioctl_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *, 396 ip_ioctl_cmd_t *, void *); 397 extern int ip_sioctl_get_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *, 398 ip_ioctl_cmd_t *, void *); 399 extern int ip_sioctl_netmask_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 400 ip_ioctl_cmd_t *, void *); 401 402 extern int ip_sioctl_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *, 403 ip_ioctl_cmd_t *, void *); 404 extern int ip_sioctl_subnet_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 405 ip_ioctl_cmd_t *, void *); 406 extern int ip_sioctl_get_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *, 407 ip_ioctl_cmd_t *, void *); 408 409 extern int ip_sioctl_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *, 410 ip_ioctl_cmd_t *, void *); 411 extern int ip_sioctl_get_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *, 412 ip_ioctl_cmd_t *, void *); 413 414 extern int ip_sioctl_metric(ipif_t *, sin_t *, queue_t *, mblk_t *, 415 ip_ioctl_cmd_t *, void *); 416 extern int ip_sioctl_get_metric(ipif_t *, sin_t *, queue_t *, mblk_t *, 417 ip_ioctl_cmd_t *, void *); 418 419 extern int ip_sioctl_arp(ipif_t *, sin_t *, queue_t *, mblk_t *, 420 ip_ioctl_cmd_t *, void *); 421 422 extern int ip_sioctl_addif(ipif_t *, sin_t *, queue_t *, mblk_t *, 423 ip_ioctl_cmd_t *, void *); 424 extern int ip_sioctl_removeif(ipif_t *, sin_t *, queue_t *, mblk_t *, 425 ip_ioctl_cmd_t *, void *); 426 extern int ip_sioctl_removeif_restart(ipif_t *, sin_t *, queue_t *, mblk_t *, 427 ip_ioctl_cmd_t *, void *); 428 429 extern int ip_sioctl_tonlink(ipif_t *, sin_t *, queue_t *, mblk_t *, 430 ip_ioctl_cmd_t *, void *); 431 extern int ip_sioctl_tmysite(ipif_t *, sin_t *, queue_t *, mblk_t *, 432 ip_ioctl_cmd_t *, void *); 433 extern int ip_sioctl_tmyaddr(ipif_t *, sin_t *, queue_t *, mblk_t *, 434 ip_ioctl_cmd_t *, void *); 435 436 extern int ip_sioctl_tunparam(ipif_t *, sin_t *, queue_t *, mblk_t *, 437 ip_ioctl_cmd_t *, void *); 438 439 extern int ip_sioctl_get_binding(ipif_t *, sin_t *, queue_t *, 440 mblk_t *, ip_ioctl_cmd_t *, void *); 441 extern int ip_sioctl_groupname(ipif_t *, sin_t *, queue_t *, 442 mblk_t *, ip_ioctl_cmd_t *, void *); 443 extern int ip_sioctl_get_groupname(ipif_t *, sin_t *, queue_t *, 444 mblk_t *, ip_ioctl_cmd_t *, void *); 445 extern int ip_sioctl_groupinfo(ipif_t *, sin_t *, queue_t *, 446 mblk_t *, ip_ioctl_cmd_t *, void *); 447 448 extern int ip_sioctl_get_lifzone(ipif_t *, sin_t *, queue_t *, 449 mblk_t *, ip_ioctl_cmd_t *, void *); 450 extern int ip_sioctl_slifzone(ipif_t *, sin_t *, queue_t *, 451 mblk_t *, ip_ioctl_cmd_t *, void *); 452 extern int ip_sioctl_slifzone_restart(ipif_t *, sin_t *, queue_t *, 453 mblk_t *, ip_ioctl_cmd_t *, void *); 454 455 extern int ip_sioctl_get_lifusesrc(ipif_t *, sin_t *, queue_t *, 456 mblk_t *, ip_ioctl_cmd_t *, void *); 457 extern int ip_sioctl_slifusesrc(ipif_t *, sin_t *, queue_t *, 458 mblk_t *, ip_ioctl_cmd_t *, void *); 459 extern int ip_sioctl_get_lifsrcof(ipif_t *, sin_t *, queue_t *, 460 mblk_t *, ip_ioctl_cmd_t *, void *); 461 462 extern void ip_sioctl_copyin_resume(ipsq_t *, queue_t *, mblk_t *, void *); 463 extern void ip_sioctl_copyin_setup(queue_t *, mblk_t *); 464 extern void ip_sioctl_iocack(ipsq_t *, queue_t *, mblk_t *, void *); 465 extern ip_ioctl_cmd_t *ip_sioctl_lookup(int); 466 467 extern void conn_delete_ire(conn_t *, caddr_t); 468 extern boolean_t phyint_exists(uint_t, ip_stack_t *); 469 470 /* 471 * Notes on reference tracing on ill, ipif, ire, nce data structures: 472 * 473 * The current model of references on an ipif or ill is purely based on threads 474 * acquiring a reference by doing a lookup on the ill or ipif or by calling a 475 * refhold function on the ill or ipif. In particular any data structure that 476 * points to an ipif or ill does not explicitly contribute to a reference on the 477 * ill or ipif. More details may be seen in the block comment above ipif_down(). 478 * Thus in the quiescent state an ill or ipif has a refcnt of zero. Similarly 479 * when a thread exits, there can't be any references on the ipif or ill due to 480 * the exiting thread. 481 * 482 * As a debugging aid, the refhold and refrele functions call into tracing 483 * functions that record the stack trace of the caller and the references 484 * acquired or released by the calling thread, hashed by the structure address 485 * in thread-specific-data (TSD). On thread exit, ip_thread_exit destroys the 486 * hash, and the destructor for the hash entries (th_trace_free) verifies that 487 * there are no outstanding references to the ipif or ill from the exiting 488 * thread. 489 * 490 * In the case of ires and nces, the model is slightly different. Typically each 491 * ire pointing to an nce contributes to the nce_refcnt. Similarly a conn_t 492 * pointing to an ire also contributes to the ire_refcnt. Excluding the above 493 * special cases, the tracing behavior is similar to the tracing on ipif / ill. 494 * Traces are neither recorded nor verified in the exception cases, and the code 495 * is careful to use the right refhold and refrele functions. On thread exit 496 * ire_thread_exit, nce_thread_exit does the verification that are no 497 * outstanding references on the ire / nce from the exiting thread. 498 * 499 * The reference verification is driven from the TSD destructor which calls 500 * into IP's verification function ip_thread_exit. This debugging aid may be 501 * helpful in tracing missing refrele's on a debug kernel. On a non-debug 502 * kernel, these missing refrele's are noticeable only when an interface is 503 * being unplumbed, and the unplumb hangs, long after the missing refrele. On a 504 * debug kernel, the traces (th_trace_t) which contain the stack backtraces can 505 * be examined on a crash dump to locate the missing refrele. 506 */ 507 508 #endif /* _KERNEL */ 509 510 #ifdef __cplusplus 511 } 512 #endif 513 514 #endif /* _INET_IP_IF_H */ 515