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 (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
28 */
29
30 #include <sys/types.h>
31 #include <sys/socket.h>
32 #include <sys/sockio.h>
33 #include <sys/sysevent/vrrp.h>
34 #include <sys/sysevent/eventdefs.h>
35 #include <sys/varargs.h>
36 #include <auth_attr.h>
37 #include <ctype.h>
38 #include <fcntl.h>
39 #include <stdlib.h>
40 #include <strings.h>
41 #include <errno.h>
42 #include <unistd.h>
43 #include <zone.h>
44 #include <libsysevent.h>
45 #include <limits.h>
46 #include <locale.h>
47 #include <arpa/inet.h>
67 * - The RX socket is successfully created over the physical interface to
68 * receive the VRRP multicast advertisement. Note that one RX socket can
69 * be shared by several VRRP routers configured over the same physical
70 * interface. (See vrrpd_init_rxsock())
71 * - The TX socket is successfully created over the VNIC interface to send
72 * the VRRP advertisment. (See vrrpd_init_txsock())
73 * - The primary IP address has been successfully selected over the physical
74 * interface. (See vrrpd_select_primary())
75 *
76 * If a VRRP router is enabled but the other conditions haven't be satisfied,
77 * the router will be stay at the VRRP_STATE_INIT state. If all the above
78 * conditions are met, the VRRP router will be transit to either
79 * the VRRP_STATE_MASTER or the VRRP_STATE_BACKUP state, depends on the VRRP
80 * protocol.
81 */
82
83 #define skip_whitespace(p) while (isspace(*(p))) ++(p)
84
85 #define BUFFSIZE 65536
86
87 #define VRRPCONF "/etc/inet/vrrp.conf"
88
89 typedef struct vrrpd_rtsock_s {
90 int vrt_af; /* address family */
91 int vrt_fd; /* socket for the PF_ROUTE msg */
92 iu_event_id_t vrt_eid; /* event ID */
93 } vrrpd_rtsock_t;
94
95 static ipadm_handle_t vrrp_ipadm_handle = NULL; /* libipadm handle */
96 static int vrrp_logflag = 0;
97 boolean_t vrrp_debug_level = 0;
98 iu_eh_t *vrrpd_eh = NULL;
99 iu_tq_t *vrrpd_timerq = NULL;
100 static vrrp_handle_t vrrpd_vh = NULL;
101 static int vrrpd_cmdsock_fd = -1; /* socket to communicate */
102 /* between vrrpd/libvrrpadm */
103 static iu_event_id_t vrrpd_cmdsock_eid = -1;
104 static int vrrpd_ctlsock_fd = -1; /* socket to bring up/down */
105 /* the virtual IP addresses */
106 static int vrrpd_ctlsock6_fd = -1;
|
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 (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
28 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
29 */
30
31 #include <sys/types.h>
32 #include <sys/socket.h>
33 #include <sys/sockio.h>
34 #include <sys/sysevent/vrrp.h>
35 #include <sys/sysevent/eventdefs.h>
36 #include <sys/varargs.h>
37 #include <auth_attr.h>
38 #include <ctype.h>
39 #include <fcntl.h>
40 #include <stdlib.h>
41 #include <strings.h>
42 #include <errno.h>
43 #include <unistd.h>
44 #include <zone.h>
45 #include <libsysevent.h>
46 #include <limits.h>
47 #include <locale.h>
48 #include <arpa/inet.h>
68 * - The RX socket is successfully created over the physical interface to
69 * receive the VRRP multicast advertisement. Note that one RX socket can
70 * be shared by several VRRP routers configured over the same physical
71 * interface. (See vrrpd_init_rxsock())
72 * - The TX socket is successfully created over the VNIC interface to send
73 * the VRRP advertisment. (See vrrpd_init_txsock())
74 * - The primary IP address has been successfully selected over the physical
75 * interface. (See vrrpd_select_primary())
76 *
77 * If a VRRP router is enabled but the other conditions haven't be satisfied,
78 * the router will be stay at the VRRP_STATE_INIT state. If all the above
79 * conditions are met, the VRRP router will be transit to either
80 * the VRRP_STATE_MASTER or the VRRP_STATE_BACKUP state, depends on the VRRP
81 * protocol.
82 */
83
84 #define skip_whitespace(p) while (isspace(*(p))) ++(p)
85
86 #define BUFFSIZE 65536
87
88 #define MAXLINELEN 1024
89
90 #define VRRPCONF "/etc/inet/vrrp.conf"
91
92 typedef struct vrrpd_rtsock_s {
93 int vrt_af; /* address family */
94 int vrt_fd; /* socket for the PF_ROUTE msg */
95 iu_event_id_t vrt_eid; /* event ID */
96 } vrrpd_rtsock_t;
97
98 static ipadm_handle_t vrrp_ipadm_handle = NULL; /* libipadm handle */
99 static int vrrp_logflag = 0;
100 boolean_t vrrp_debug_level = 0;
101 iu_eh_t *vrrpd_eh = NULL;
102 iu_tq_t *vrrpd_timerq = NULL;
103 static vrrp_handle_t vrrpd_vh = NULL;
104 static int vrrpd_cmdsock_fd = -1; /* socket to communicate */
105 /* between vrrpd/libvrrpadm */
106 static iu_event_id_t vrrpd_cmdsock_eid = -1;
107 static int vrrpd_ctlsock_fd = -1; /* socket to bring up/down */
108 /* the virtual IP addresses */
109 static int vrrpd_ctlsock6_fd = -1;
|