xref: /titanic_44/usr/src/uts/common/inet/ip_ftable.h (revision 67e3a03ed4a2813074d36330f062ed6e593a4937)
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 2008 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef 	_KERNEL
37 
38 #include <net/radix.h>
39 #include <inet/common.h>
40 #include <inet/ip.h>
41 
42 struct rt_entry {
43 	struct	radix_node rt_nodes[2];	/* tree glue, and other values */
44 	/*
45 	 * struct rt_entry must begin with a struct radix_node (or two!)
46 	 * to a 'struct rt_entry *'
47 	 */
48 	struct rt_sockaddr rt_dst;
49 	/*
50 	 * multiple routes to same dest/mask via varying gate/ifp are stored
51 	 * in the rt_irb bucket.
52 	 */
53 	irb_t rt_irb;
54 };
55 
56 /*
57  * vehicle for passing args through rn_walktree
58  *
59  * The comment below (and for other netstack_t references) refers
60  * to the fact that we only do netstack_hold in particular cases,
61  * such as the references from open streams (ill_t and conn_t's
62  * pointers). Internally within IP we rely on IP's ability to cleanup e.g.
63  * ire_t's when an ill goes away.
64  */
65 struct rtfuncarg {
66 	pfv_t rt_func;
67 	char *rt_arg;
68 	uint_t rt_match_flags;
69 	uint_t rt_ire_type;
70 	ill_t  *rt_ill;
71 	zoneid_t rt_zoneid;
72 	ip_stack_t *rt_ipst;   	/* Does not have a netstack_hold */
73 };
74 int rtfunc(struct radix_node *, void *);
75 
76 typedef struct rt_entry rt_t;
77 typedef struct rtfuncarg rtf_t;
78 
79 /* For ire_forward() */
80 enum ire_forward_action {
81 	Forward_ok,			/* OK to use this IRE to forward */
82 	Forward_check_multirt,		/* CGTP multirt check required */
83 	Forward_ret_icmp_err,		/* Callers to return an ICMP error */
84 	Forward_blackhole		/* Packet is silently discarded */
85 };
86 
87 struct ts_label_s;
88 extern	ire_t	*ire_ftable_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int,
89     const ipif_t *, ire_t **, zoneid_t, uint32_t,
90     const struct ts_label_s *, int, ip_stack_t *);
91 extern	ire_t *ire_lookup_multi(ipaddr_t, zoneid_t, ip_stack_t *);
92 extern	ire_t *ipif_lookup_multi_ire(ipif_t *, ipaddr_t);
93 extern	void ire_delete_host_redirects(ipaddr_t, ip_stack_t *);
94 extern	ire_t *ire_ihandle_lookup_onlink(ire_t *);
95 extern	ire_t *ire_forward(ipaddr_t, enum ire_forward_action *, ire_t *,
96     ire_t *, const struct ts_label_s *, ip_stack_t *);
97 extern irb_t	*ire_get_bucket(ire_t *);
98 extern uint_t ifindex_lookup(const struct sockaddr *, zoneid_t);
99 extern int ipfil_sendpkt(const struct sockaddr *, mblk_t *, uint_t, zoneid_t);
100 
101 extern void  irb_refhold_rn(struct radix_node *);
102 extern void  irb_refrele_rn(struct radix_node *);
103 
104 #endif /* _KERNEL */
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _INET_IP_FTABLE_H */
111