xref: /illumos-gate/usr/src/uts/common/inet/ip_ftable.h (revision 78a2e113edb6fe0a0382b403b55d92e8f0bba78f)
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 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _INET_IP_FTABLE_H
28 #define	_INET_IP_FTABLE_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #ifdef 	_KERNEL
35 
36 #include <net/radix.h>
37 #include <inet/common.h>
38 #include <inet/ip.h>
39 
40 struct rt_entry {
41 	struct	radix_node rt_nodes[2];	/* tree glue, and other values */
42 	/*
43 	 * struct rt_entry must begin with a struct radix_node (or two!)
44 	 * to a 'struct rt_entry *'
45 	 */
46 	struct rt_sockaddr rt_dst;
47 	/*
48 	 * multiple routes to same dest/mask via varying gate/ifp are stored
49 	 * in the rt_irb bucket.
50 	 */
51 	irb_t rt_irb;
52 };
53 
54 /*
55  * vehicle for passing args through rn_walktree
56  *
57  * The comment below (and for other netstack_t references) refers
58  * to the fact that we only do netstack_hold in particular cases,
59  * such as the references from open endpoints (ill_t and conn_t's
60  * pointers). Internally within IP we rely on IP's ability to cleanup e.g.
61  * ire_t's when an ill goes away.
62  */
63 struct rtfuncarg {
64 	pfv_t rt_func;
65 	char *rt_arg;
66 	uint_t rt_match_flags;
67 	uint_t rt_ire_type;
68 	ill_t  *rt_ill;
69 	zoneid_t rt_zoneid;
70 	ip_stack_t *rt_ipst;   	/* Does not have a netstack_hold */
71 };
72 int rtfunc(struct radix_node *, void *);
73 
74 typedef struct rt_entry rt_t;
75 typedef struct rtfuncarg rtf_t;
76 
77 struct ts_label_s;
78 extern	void ire_delete_host_redirects(ipaddr_t, ip_stack_t *);
79 extern irb_t	*ire_get_bucket(ire_t *);
80 extern uint_t ifindex_lookup(const struct sockaddr *, zoneid_t);
81 extern int ipfil_sendpkt(const struct sockaddr *, mblk_t *, uint_t, zoneid_t);
82 
83 extern void  irb_refhold_rn(struct radix_node *);
84 extern void  irb_refrele_rn(struct radix_node *);
85 
86 #endif /* _KERNEL */
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _INET_IP_FTABLE_H */
93