xref: /titanic_44/usr/src/uts/common/inet/ilb_ip.h (revision dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9)
1*dbed73cbSSangeeta Misra /*
2*dbed73cbSSangeeta Misra  * CDDL HEADER START
3*dbed73cbSSangeeta Misra  *
4*dbed73cbSSangeeta Misra  * The contents of this file are subject to the terms of the
5*dbed73cbSSangeeta Misra  * Common Development and Distribution License (the "License").
6*dbed73cbSSangeeta Misra  * You may not use this file except in compliance with the License.
7*dbed73cbSSangeeta Misra  *
8*dbed73cbSSangeeta Misra  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*dbed73cbSSangeeta Misra  * or http://www.opensolaris.org/os/licensing.
10*dbed73cbSSangeeta Misra  * See the License for the specific language governing permissions
11*dbed73cbSSangeeta Misra  * and limitations under the License.
12*dbed73cbSSangeeta Misra  *
13*dbed73cbSSangeeta Misra  * When distributing Covered Code, include this CDDL HEADER in each
14*dbed73cbSSangeeta Misra  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*dbed73cbSSangeeta Misra  * If applicable, add the following below this CDDL HEADER, with the
16*dbed73cbSSangeeta Misra  * fields enclosed by brackets "[]" replaced with your own identifying
17*dbed73cbSSangeeta Misra  * information: Portions Copyright [yyyy] [name of copyright owner]
18*dbed73cbSSangeeta Misra  *
19*dbed73cbSSangeeta Misra  * CDDL HEADER END
20*dbed73cbSSangeeta Misra  */
21*dbed73cbSSangeeta Misra 
22*dbed73cbSSangeeta Misra /*
23*dbed73cbSSangeeta Misra  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*dbed73cbSSangeeta Misra  * Use is subject to license terms.
25*dbed73cbSSangeeta Misra  */
26*dbed73cbSSangeeta Misra #ifndef _INET_ILB_IP_H
27*dbed73cbSSangeeta Misra #define	_INET_ILB_IP_H
28*dbed73cbSSangeeta Misra 
29*dbed73cbSSangeeta Misra #include <inet/ilb.h>
30*dbed73cbSSangeeta Misra #include <inet/ilb/ilb_stack.h>
31*dbed73cbSSangeeta Misra #include <inet/ilb/ilb_impl.h>
32*dbed73cbSSangeeta Misra 
33*dbed73cbSSangeeta Misra #ifdef __cplusplus
34*dbed73cbSSangeeta Misra extern "C" {
35*dbed73cbSSangeeta Misra #endif
36*dbed73cbSSangeeta Misra 
37*dbed73cbSSangeeta Misra extern void ilb_ddi_g_init(void);
38*dbed73cbSSangeeta Misra extern void ilb_ddi_g_destroy(void);
39*dbed73cbSSangeeta Misra 
40*dbed73cbSSangeeta Misra /* Return values of ilb_check_*() */
41*dbed73cbSSangeeta Misra #define	ILB_DROPPED	1	/* Caller should drop the packet. */
42*dbed73cbSSangeeta Misra #define	ILB_PASSED	2	/* No load balanced rule is matched. */
43*dbed73cbSSangeeta Misra #define	ILB_BALANCED	3	/* A rule is matached. */
44*dbed73cbSSangeeta Misra 
45*dbed73cbSSangeeta Misra extern boolean_t ilb_has_rules(ilb_stack_t *);
46*dbed73cbSSangeeta Misra 
47*dbed73cbSSangeeta Misra extern int ilb_check_v4(ilb_stack_t *, ill_t *, mblk_t *, ipha_t *, int,
48*dbed73cbSSangeeta Misra     uint8_t *, ipaddr_t *);
49*dbed73cbSSangeeta Misra extern int ilb_check_v6(ilb_stack_t *, ill_t *, mblk_t *, ip6_t *, int,
50*dbed73cbSSangeeta Misra     uint8_t *, in6_addr_t *);
51*dbed73cbSSangeeta Misra extern boolean_t ilb_rule_match_vip_v4(ilb_stack_t *, ipaddr_t, ilb_rule_t **);
52*dbed73cbSSangeeta Misra extern boolean_t ilb_rule_match_vip_v6(ilb_stack_t *, in6_addr_t *,
53*dbed73cbSSangeeta Misra     ilb_rule_t **);
54*dbed73cbSSangeeta Misra 
55*dbed73cbSSangeeta Misra extern int ip_sioctl_ilb_cmd(ipif_t *, sin_t *, queue_t *, mblk_t *,
56*dbed73cbSSangeeta Misra     ip_ioctl_cmd_t *, void *);
57*dbed73cbSSangeeta Misra 
58*dbed73cbSSangeeta Misra extern int ilb_rule_add(ilb_stack_t *, zoneid_t, const ilb_rule_cmd_t *);
59*dbed73cbSSangeeta Misra extern int ilb_rule_del(ilb_stack_t *, zoneid_t, const char *);
60*dbed73cbSSangeeta Misra extern void ilb_rule_del_all(ilb_stack_t *, zoneid_t);
61*dbed73cbSSangeeta Misra extern int ilb_rule_enable(ilb_stack_t *, zoneid_t, const char *,
62*dbed73cbSSangeeta Misra     ilb_rule_t *);
63*dbed73cbSSangeeta Misra extern void ilb_rule_enable_all(ilb_stack_t *, zoneid_t);
64*dbed73cbSSangeeta Misra extern int ilb_rule_disable(ilb_stack_t *, zoneid_t, const char *,
65*dbed73cbSSangeeta Misra     ilb_rule_t *);
66*dbed73cbSSangeeta Misra extern void ilb_rule_disable_all(ilb_stack_t *, zoneid_t);
67*dbed73cbSSangeeta Misra extern int ilb_rule_list(ilb_stack_t *, zoneid_t, ilb_rule_cmd_t *);
68*dbed73cbSSangeeta Misra 
69*dbed73cbSSangeeta Misra extern void ilb_get_num_rules(ilb_stack_t *, zoneid_t, uint32_t *);
70*dbed73cbSSangeeta Misra extern int ilb_get_num_servers(ilb_stack_t *, zoneid_t, const char *,
71*dbed73cbSSangeeta Misra     uint32_t *);
72*dbed73cbSSangeeta Misra extern ilb_rule_t *ilb_find_rule(ilb_stack_t *, zoneid_t, const char *, int *);
73*dbed73cbSSangeeta Misra extern void ilb_get_rulenames(ilb_stack_t *, zoneid_t, uint32_t *,
74*dbed73cbSSangeeta Misra     char *);
75*dbed73cbSSangeeta Misra extern int ilb_get_servers(ilb_stack_t *, zoneid_t, const char *,
76*dbed73cbSSangeeta Misra     ilb_server_info_t *, uint32_t *);
77*dbed73cbSSangeeta Misra 
78*dbed73cbSSangeeta Misra extern int ilb_server_add(ilb_stack_t *, ilb_rule_t *, ilb_server_info_t *);
79*dbed73cbSSangeeta Misra extern int ilb_server_del(ilb_stack_t *, zoneid_t, const char *,
80*dbed73cbSSangeeta Misra     ilb_rule_t *, in6_addr_t *);
81*dbed73cbSSangeeta Misra extern int ilb_server_enable(ilb_stack_t *, zoneid_t, const char *,
82*dbed73cbSSangeeta Misra     ilb_rule_t *, in6_addr_t *);
83*dbed73cbSSangeeta Misra extern int ilb_server_disable(ilb_stack_t *, zoneid_t, const char *,
84*dbed73cbSSangeeta Misra     ilb_rule_t *, in6_addr_t *);
85*dbed73cbSSangeeta Misra 
86*dbed73cbSSangeeta Misra extern int ilb_list_nat(ilb_stack_t *, zoneid_t, ilb_nat_entry_t *,
87*dbed73cbSSangeeta Misra     uint32_t *, uint32_t *);
88*dbed73cbSSangeeta Misra extern int ilb_list_sticky(ilb_stack_t *, zoneid_t, ilb_sticky_entry_t *,
89*dbed73cbSSangeeta Misra     uint32_t *, uint32_t *);
90*dbed73cbSSangeeta Misra 
91*dbed73cbSSangeeta Misra /* Currently supported transport protocol. */
92*dbed73cbSSangeeta Misra #define	ILB_SUPP_L4(proto)						\
93*dbed73cbSSangeeta Misra 	((proto) == IPPROTO_TCP || (proto) == IPPROTO_UDP ||		\
94*dbed73cbSSangeeta Misra 	    (proto) == IPPROTO_ICMP || (proto) == IPPROTO_ICMPV6)
95*dbed73cbSSangeeta Misra 
96*dbed73cbSSangeeta Misra 
97*dbed73cbSSangeeta Misra #ifdef __cplusplus
98*dbed73cbSSangeeta Misra }
99*dbed73cbSSangeeta Misra #endif
100*dbed73cbSSangeeta Misra 
101*dbed73cbSSangeeta Misra #endif /* _INET_ILB_IP_H */
102