ip_if.h revision fbc5b1b861935ff819d8b4b1d01f1e6489d95981
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1990 Mentat Inc. */
#ifndef _INET_IP_IF_H
#define _INET_IP_IF_H
#ifdef __cplusplus
extern "C" {
#endif
#define PREFIX_INFINITY 0xffffffffUL
#define IP_MAX_HW_LEN 40
/* DLPI SAPs are in host byte order for all systems */
#define IP_DL_SAP 0x0800
#define IP6_DL_SAP 0x86dd
#ifdef _KERNEL
/*
* Interface flags actually represent the state/properties of 3 different
* abstractions of interfaces in IP. Interface flags are set using
* SIOCS[L]IFFLAGS ioctl. The three abstractions are :
*
* 1) Physical interface (phyint) : There is one phyint allocated common
* to both IPv4 and IPv6 physical interface instance.
*
* 2) Physical interface instance (ill) : This encompasses all the state
* that is common across all IP addresses assigned to a physical
* interface but different between the IPv4 and IPv6 instance.
*
* 3) Logical interface (ipif) : This has state about a single IP address.
*
* Values for the various states are derived from the same name space
* as applications querying the state using SIOCGIFFLAGS/SIOCGLIFFLAGS
* see only one state returned in lifr_flags which is a union of all
* the above states/properties. Thus deriving the values from the common
* name space makes implementation easier. All these values are stored in
* uint64_ts.
*
* As we maintain the interface flags in 3 different flags namely
* phyint_flags, ill_flags, ipif_flags we define the following flag values
* to be used within the kernel to reduce potential errors. The ones
* starting with PHYI_ are supposed to be used with phyint_flags, the ones
* starting with ILLF_ are supposed to be used with ill_flags and the ones
* starting with IPIF_ are supposed to be used with ipif_flags. If you see
* any code with a mismatch i.e phyint_flags & IPIF_UP - it is wrong. Only
* PHYI_XXX can be used with phyint_flags.
*
* NOTE : For EVERY FLAG in if.h, there should be a corresponding value
* defined HERE and this is the one that should be USED within IP. We
* use IFF_ flags within IP only when we examine lifr_flags.
*/
#ifdef DEBUG
#else
#define ILL_MAC_PERIM_HELD(ill)
#endif
/* for ipif_resolver_up */
enum ip_resolver_action {
Res_act_initial, /* initial address establishment */
Res_act_rebind, /* IPMP address rebind (new hwaddr) */
Res_act_defend, /* address defense */
Res_act_none /* do nothing */
};
extern void ill_dlpi_send_deferred(ill_t *);
extern void ill_capability_done(ill_t *);
/* NOTE: Keep unmodified ill_lookup_on_ifindex for ipp for now */
ipsq_func_t, int *, ip_stack_t *);
ip_stack_t *);
extern void ill_grp_cache_delete(ire_t *, char *);
extern void ill_ipif_cache_delete(ire_t *, char *);
extern void ill_stq_cache_delete(ire_t *, char *);
extern void ill_delete(ill_t *);
extern void ill_delete_tail(ill_t *);
extern void ill_fastpath_nack(ill_t *);
extern void ill_fastpath_flush(ill_t *);
extern void ill_refresh_bcast(ill_t *);
extern void ill_refhold(ill_t *);
extern void ill_refhold_locked(ill_t *);
extern int ill_check_and_refhold(ill_t *);
extern void ill_refrele(ill_t *);
extern void ill_waiter_dcr(ill_t *);
extern void ill_trace_ref(ill_t *);
extern void ill_untrace_ref(ill_t *);
ip_stack_t *);
extern void ill_capability_probe(ill_t *);
extern void ill_taskq_dispatch(ip_stack_t *);
extern void ill_mtu_change(ire_t *, char *);
extern void ip_loopback_cleanup(ip_stack_t *);
extern void ipif_get_name(const ipif_t *, char *, int);
extern void ipif_init(ip_stack_t *);
ip_stack_t *);
ip_stack_t *);
ip_stack_t *);
ip_stack_t *);
extern void ipif_refhold(ipif_t *);
extern void ipif_refhold_locked(ipif_t *);
extern void ipif_refrele(ipif_t *);
extern void ipif_resolver_down(ipif_t *);
extern void ipif_down_tail(ipif_t *);
extern void ipif_multicast_down(ipif_t *);
extern void ipif_multicast_up(ipif_t *);
extern void ipif_ndp_down(ipif_t *);
extern int ipif_up_done(ipif_t *);
extern int ipif_up_done_v6(ipif_t *);
extern void ipif_up_notify(ipif_t *);
extern void ipif_update_other_ipifs_v6(ipif_t *);
extern void ill_update_source_selection(ill_t *);
extern int ipif_setlinklocal(ipif_t *);
extern void ipif_mask_reply(ipif_t *);
extern void ipsq_current_finish(ipsq_t *);
ill_t *);
ipsq_func_t, int, boolean_t);
mblk_t *, int);
cmd_info_t *, ipsq_func_t);
extern ip_extract_func_t ip_extract_tunreq;
extern int ip_addr_availability_check(ipif_t *);
struct rtsa_s *, ip_stack_t *);
ipsq_func_t, ip_stack_t *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
mblk_t *, ip_ioctl_cmd_t *, void *);
extern ip_ioctl_cmd_t *ip_sioctl_lookup(int);
/*
* Notes on reference tracing on ill, ipif, ire, nce data structures:
*
* The current model of references on an ipif or ill is purely based on threads
* acquiring a reference by doing a lookup on the ill or ipif or by calling a
* refhold function on the ill or ipif. In particular any data structure that
* points to an ipif or ill does not explicitly contribute to a reference on the
* ill or ipif. More details may be seen in the block comment above ipif_down().
* Thus in the quiescent state an ill or ipif has a refcnt of zero. Similarly
* when a thread exits, there can't be any references on the ipif or ill due to
* the exiting thread.
*
* As a debugging aid, the refhold and refrele functions call into tracing
* functions that record the stack trace of the caller and the references
* acquired or released by the calling thread, hashed by the structure address
* in thread-specific-data (TSD). On thread exit, ip_thread_exit destroys the
* hash, and the destructor for the hash entries (th_trace_free) verifies that
* there are no outstanding references to the ipif or ill from the exiting
* thread.
*
* In the case of ires and nces, the model is slightly different. Typically each
* ire pointing to an nce contributes to the nce_refcnt. Similarly a conn_t
* pointing to an ire also contributes to the ire_refcnt. Excluding the above
* special cases, the tracing behavior is similar to the tracing on ipif / ill.
* Traces are neither recorded nor verified in the exception cases, and the code
* is careful to use the right refhold and refrele functions. On thread exit
* ire_thread_exit, nce_thread_exit does the verification that are no
* outstanding references on the ire / nce from the exiting thread.
*
* The reference verification is driven from the TSD destructor which calls
* into IP's verification function ip_thread_exit. This debugging aid may be
* helpful in tracing missing refrele's on a debug kernel. On a non-debug
* kernel, these missing refrele's are noticeable only when an interface is
* being unplumbed, and the unplumb hangs, long after the missing refrele. On a
* debug kernel, the traces (th_trace_t) which contain the stack backtraces can
* be examined on a crash dump to locate the missing refrele.
*/
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _INET_IP_IF_H */