ip_ftable.h revision 2535:b66cbb80977f
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 2006 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 33extern "C" { 34#endif 35 36#ifdef _KERNEL 37 38#include <net/radix.h> 39#include <inet/common.h> 40#include <inet/ip.h> 41 42struct 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/* vehicle for passing args through rn_walktree */ 57struct rtfuncarg { 58 pfv_t rt_func; 59 char *rt_arg; 60 uint_t rt_match_flags; 61 uint_t rt_ire_type; 62 ill_t *rt_ill; 63 zoneid_t rt_zoneid; 64}; 65int rtfunc(struct radix_node *, void *); 66 67typedef struct rt_entry rt_t; 68typedef struct rtfuncarg rtf_t; 69 70struct ts_label_s; 71extern ire_t *ire_ftable_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int, 72 const ipif_t *, ire_t **, zoneid_t, uint32_t, 73 const struct ts_label_s *, int); 74extern ire_t *ire_lookup_multi(ipaddr_t, zoneid_t); 75extern ire_t *ipif_lookup_multi_ire(ipif_t *, ipaddr_t); 76extern void ire_delete_host_redirects(ipaddr_t); 77extern ire_t *ire_ihandle_lookup_onlink(ire_t *); 78extern ire_t *ire_forward(ipaddr_t, boolean_t *, ire_t *, ire_t *, 79 const struct ts_label_s *); 80extern void ire_ftable_walk(struct rt_entry *, uint_t, uint_t, 81 ill_t *, zoneid_t, pfv_t, char *); 82extern irb_t *ire_get_bucket(ire_t *); 83extern uint_t ifindex_lookup(const struct sockaddr *, zoneid_t); 84extern int ipfil_sendpkt(const struct sockaddr *, mblk_t *, uint_t, zoneid_t); 85 86extern struct radix_node_head *ip_ftable; 87 88#define IRB_REFHOLD_RN(rn) \ 89 if ((rn->rn_flags & RNF_ROOT) == 0) \ 90 IRB_REFHOLD(&((rt_t *)(rn))->rt_irb) 91 92#define IRB_REFRELE_RN(rn) \ 93 if ((rn->rn_flags & RNF_ROOT) == 0) \ 94 irb_refrele_ftable(&((rt_t *)(rn))->rt_irb); 95 96#else 97 98#define IRB_REFHOLD_RN(rn) /* */ 99#define IRB_REFRELE_RN(rn) /* */ 100 101#endif /* _KERNEL */ 102 103#ifdef __cplusplus 104} 105#endif 106 107#endif /* _INET_IP_FTABLE_H */ 108