1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * CDDL HEADER START
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * The contents of this file are subject to the terms of the
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Common Development and Distribution License (the "License").
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * You may not use this file except in compliance with the License.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * See the License for the specific language governing permissions
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * and limitations under the License.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * When distributing Covered Code, include this CDDL HEADER in each
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * If applicable, add the following below this CDDL HEADER, with the
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * fields enclosed by brackets "[]" replaced with your own identifying
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * information: Portions Copyright [yyyy] [name of copyright owner]
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * CDDL HEADER END
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Use is subject to license terms.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Internal data structs to store VRRP instance configuration information
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * and run-time state information.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Timer reused in master/backup state:
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Master: The Advertisement_Interval (Adver_Timer)
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Backup: The Master_Down_Intervel (Master_Down_timer)
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Peer information, got from the last adv message received
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Record the reason why the virtual router stays at the INIT
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * state, for the diagnose purpose.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou/* IP address/interface cache state flags */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhoutypedef enum {
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * The ifindex is get by the SIOCGLIFINDEX ioctl, easy to make it part of
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * vrrp_ip_t instead of vrrp_intf_t
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Used for primary interfaces
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou uint32_t vpii_nvr; /* numbers of virtual routers */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou iu_event_id_t vpii_eid; /* event id of RX socket */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou /* non-zero on the primary if */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Used for virtual interfaces
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * the state of the VRRP router, used to determine the up/down
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * state of the virtual IP addresses
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * VRRP interface structure
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * An interface is either the primary interface which owns the primary IP
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * address or a VNIC interface which owns the virtual IP addresses.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * As the primary interface, it can be shared by several VRRP routers.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou TAILQ_HEAD(, vrrp_ip_s) vvi_iplist; /* IP adddress list */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * Socket fd.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * - physical interfaces: used to receive the VRRP packet, and shared
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * by all virtual routers on this physical interface.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * - vnic interfaces: used to send the VRRP packet.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou vrrp_primary_ifinfo_t pifinfo; /* Primary interface info */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou vrrp_virtual_ifinfo_t vifinfo; /* VNIC interface info */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou (((intf)->vvi_sockfd >= 0) && ((intf)->vvi_eid != -1))
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou (((intf)->vvi_sockfd >= 0) && ((intf)->vvi_eid == -1))
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou#define VRRP_DBG0 4 /* debug message, only function calls */
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * The primary IP address must be brought up; further, in the case of IPv6,
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou * the link-local IP address is used as the primary IP address.
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou (((ip)->vip_flags & IFF_UP) && ((intf)->vvi_af != AF_INET6 || \
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou IN6_IS_ADDR_LINKLOCAL(&(ip)->vip_addr.in6.sin6_addr)))
1cb875ae88fb9463b368e725c2444776595895cbCathy Zhou#endif /* _VRRPD_IMPL_H */