]>
git.proxmox.com Git - mirror_frr.git/blob - vrrpd/vrrp.h
2 * VRRPD global definitions
3 * Copyright (C) 2018 Cumulus Networks, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 /* Global definitions */
31 #define VRRP_DEFAULT_ADVINT 100
32 #define VRRP_DEFAULT_PRIORITY 100
33 #define VRRP_PRIO_MASTER 255
34 #define VRRP_MCAST_GROUP "224.0.0.18"
35 #define VRRP_MCAST_GROUP_HEX 0xe0000012
36 #define IPPROTO_VRRP 112
39 extern struct thread_master
*master
;
41 /* Global hash of all Virtual Routers */
42 struct hash
*vrrp_vrouters_hash
;
52 struct interface
*ifp
;
54 /* Virtual Router Identifier */
57 /* One or more IPv4 addresses associated with this Virtual Router. */
61 * One ore more IPv6 addresses associated with this Virtual Router. The
62 * first address must be the Link-Local address associated with the
67 /* Time between ADVERTISEMENTS (centiseconds) */
70 /* Whether this VRRP Router is currently the master */
77 * Time interval between ADVERTISEMENTS (centiseconds). Default is 100
78 * centiseconds (1 second).
80 uint16_t advertisement_interval
;
82 * Advertisement interval contained in ADVERTISEMENTS received from the
83 * Master (centiseconds)
85 uint16_t master_adver_interval
;
88 * Time to skew Master_Down_Interval in centiseconds. Calculated as:
89 * (((256 - priority) * Master_Adver_Interval) / 256)
94 * Time interval for Backup to declare Master down (centiseconds).
96 * (3 * Master_Adver_Interval) + Skew_time
98 uint16_t master_down_interval
;
101 * Controls whether a (starting or restarting) higher-priority Backup
102 * router preempts a lower-priority Master router. Values are True to
103 * allow preemption and False to prohibit preemption. Default is True.
108 * Controls whether a virtual router in Master state will accept
109 * packets addressed to the address owner's IPvX address as its own if
110 * it is not the IPvX address owner. The default is False.
115 * The MAC address used for the source MAC address in VRRP
116 * advertisements and advertised in ARP responses as the MAC address to
117 * use for IP_Addresses.
119 struct ethaddr vr_mac_v4
;
120 struct ethaddr vr_mac_v6
;
122 struct thread
*t_master_down_timer
;
123 struct thread
*t_adver_timer
;
131 #define VRRP_STATE_INITIALIZE 1
132 #define VRRP_STATE_MASTER 2
133 #define VRRP_STATE_BACKUP 3
134 #define VRRP_EVENT_STARTUP 1
135 #define VRRP_EVENT_SHUTDOWN 2
137 DECLARE_HOOK(vrrp_change_state_hook
, (struct vrrp_vrouter
*vr
, int to
), (vr
, to
));
138 void vrrp_event(struct vrrp_vrouter
*vr
, int event
);
139 /* End state machine */
143 * Initialize VRRP global datastructures.
145 void vrrp_init(void);
148 * Create and register a new VRRP Virtual Router.
150 struct vrrp_vrouter
*vrrp_vrouter_create(struct interface
*ifp
, uint8_t vrid
);
153 * Find VRRP Virtual Router by Virtual Router ID
155 struct vrrp_vrouter
*vrrp_lookup(uint8_t vrid
);
160 void vrrp_event(struct vrrp_vrouter
*vr
, int event
);