ip_ftable.h revision 5907:d36d01fc3658
1132720Skan/*
297403Sobrien * CDDL HEADER START
3169691Skan *
4169691Skan * The contents of this file are subject to the terms of the
597403Sobrien * Common Development and Distribution License (the "License").
697403Sobrien * You may not use this file except in compliance with the License.
797403Sobrien *
897403Sobrien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
997403Sobrien * or http://www.opensolaris.org/os/licensing.
1097403Sobrien * See the License for the specific language governing permissions
1197403Sobrien * and limitations under the License.
1297403Sobrien *
1397403Sobrien * When distributing Covered Code, include this CDDL HEADER in each
1497403Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1597403Sobrien * If applicable, add the following below this CDDL HEADER, with the
1697403Sobrien * fields enclosed by brackets "[]" replaced with your own identifying
1797403Sobrien * information: Portions Copyright [yyyy] [name of copyright owner]
1897403Sobrien *
19169691Skan * CDDL HEADER END
2097403Sobrien */
2197403Sobrien
2297403Sobrien/*
2397403Sobrien * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
2497403Sobrien * Use is subject to license terms.
2597403Sobrien */
2697403Sobrien
2797403Sobrien#ifndef _INET_IP_FTABLE_H
2897403Sobrien#define	_INET_IP_FTABLE_H
2997403Sobrien
3097403Sobrien#pragma ident	"%Z%%M%	%I%	%E% SMI"
31169691Skan
32169691Skan#ifdef	__cplusplus
33169691Skanextern "C" {
34169691Skan#endif
35169691Skan
36132720Skan#ifdef 	_KERNEL
37132720Skan
3897403Sobrien#include <net/radix.h>
3997403Sobrien#include <inet/common.h>
4097403Sobrien#include <inet/ip.h>
41169691Skan
42169691Skanstruct rt_entry {
4397403Sobrien	struct	radix_node rt_nodes[2];	/* tree glue, and other values */
4497403Sobrien	/*
4597403Sobrien	 * struct rt_entry must begin with a struct radix_node (or two!)
46132720Skan	 * to a 'struct rt_entry *'
4797403Sobrien	 */
4897403Sobrien	struct rt_sockaddr rt_dst;
4997403Sobrien	/*
5097403Sobrien	 * multiple routes to same dest/mask via varying gate/ifp are stored
51132720Skan	 * in the rt_irb bucket.
52132720Skan	 */
5397403Sobrien	irb_t rt_irb;
54132720Skan};
5597403Sobrien
56132720Skan/*
5797403Sobrien * vehicle for passing args through rn_walktree
5897403Sobrien *
5997403Sobrien * The comment below (and for other netstack_t references) refers
6097403Sobrien * to the fact that we only do netstack_hold in particular cases,
6197403Sobrien * such as the references from open streams (ill_t and conn_t's
6297403Sobrien * pointers). Internally within IP we rely on IP's ability to cleanup e.g.
6397403Sobrien * ire_t's when an ill goes away.
6497403Sobrien */
6597403Sobrienstruct rtfuncarg {
6697403Sobrien	pfv_t rt_func;
6797403Sobrien	char *rt_arg;
6897403Sobrien	uint_t rt_match_flags;
69132720Skan	uint_t rt_ire_type;
70132720Skan	ill_t  *rt_ill;
71132720Skan	zoneid_t rt_zoneid;
7297403Sobrien	ip_stack_t *rt_ipst;   	/* Does not have a netstack_hold */
73132720Skan};
74132720Skanint rtfunc(struct radix_node *, void *);
7597403Sobrien
76132720Skantypedef struct rt_entry rt_t;
77132720Skantypedef struct rtfuncarg rtf_t;
78132720Skan
7997403Sobrien/* For ire_forward() */
80132720Skanenum ire_forward_action {
81132720Skan	Forward_ok,			/* OK to use this IRE to forward */
82132720Skan	Forward_check_multirt,		/* CGTP multirt check required */
83132720Skan	Forward_ret_icmp_err,		/* Callers to return an ICMP error */
84132720Skan	Forward_blackhole		/* Packet is silently discarded */
85132720Skan};
86132720Skan
87132720Skanstruct ts_label_s;
88132720Skanextern	ire_t	*ire_ftable_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int,
89132720Skan    const ipif_t *, ire_t **, zoneid_t, uint32_t,
90132720Skan    const struct ts_label_s *, int, ip_stack_t *);
91117397Skanextern	ire_t *ire_lookup_multi(ipaddr_t, zoneid_t, ip_stack_t *);
92132720Skanextern	ire_t *ipif_lookup_multi_ire(ipif_t *, ipaddr_t);
93132720Skanextern	void ire_delete_host_redirects(ipaddr_t, ip_stack_t *);
94132720Skanextern	ire_t *ire_ihandle_lookup_onlink(ire_t *);
95132720Skanextern	ire_t *ire_forward(ipaddr_t, enum ire_forward_action *, ire_t *,
96132720Skan    ire_t *, const struct ts_label_s *, ip_stack_t *);
97132720Skanextern irb_t	*ire_get_bucket(ire_t *);
98117397Skanextern uint_t ifindex_lookup(const struct sockaddr *, zoneid_t);
99132720Skanextern int ipfil_sendpkt(const struct sockaddr *, mblk_t *, uint_t, zoneid_t);
100132720Skan
101132720Skanextern void  irb_refhold_rn(struct radix_node *);
102132720Skanextern void  irb_refrele_rn(struct radix_node *);
103132720Skan
104132720Skan#endif /* _KERNEL */
105132720Skan
106117397Skan#ifdef	__cplusplus
107132720Skan}
108117397Skan#endif
109132720Skan
110132720Skan#endif	/* _INET_IP_FTABLE_H */
111132720Skan