16 #include <vpp/app/version.h> 20 #include <vrrp/vrrp.api_enum.h> 21 #include <vrrp/vrrp.api_types.h> 23 #define REPLY_MSG_ID_BASE vrrp_main.msg_id_base 30 vl_api_vrrp_vr_add_del_reply_t *rmp;
33 ip46_address_t *addrs = 0;
38 api_flags = htonl (mp->
flags);
63 for (i = 0; i < mp->
n_addrs; i++)
73 src = &mp->
addrs[
i].un.ip4;
75 len =
sizeof (addr->ip4);
79 src = &mp->
addrs[
i].un.ip6;
81 len =
sizeof (addr->ip6);
93 rv = VNET_API_ERROR_INVALID_VALUE;
98 rv = VNET_API_ERROR_INVALID_VALUE;
100 else if (vr_conf.
vr_id == 0)
103 rv = VNET_API_ERROR_INVALID_VALUE;
114 static vl_api_vrrp_vr_state_t
117 if (vr_state == VRRP_VR_STATE_BACKUP)
119 if (vr_state == VRRP_VR_STATE_MASTER)
121 if (vr_state == VRRP_VR_STATE_INTF_DOWN)
133 int n_addrs, msg_size;
134 ip46_address_t *
addr;
135 vl_api_address_t *api_addr;
139 msg_size =
sizeof (*mp) + n_addrs *
sizeof (*api_addr);
144 mp->_vl_msg_id = htons (VL_API_VRRP_VR_DETAILS + vmp->
msg_id_base);
162 mp->
config.flags = htonl (api_flags);
177 api_addr = mp->
addrs;
186 dst = &api_addr->un.ip6;
188 len =
sizeof (addr->ip6);
193 dst = &api_addr->un.ip4;
195 len =
sizeof (addr->ip4);
221 if (sw_if_index && (sw_if_index != ~0) &&
233 vl_api_vrrp_vr_start_stop_reply_t *rmp;
251 vl_api_vrrp_vr_set_peers_reply_t *rmp;
253 ip46_address_t *peer_addrs = 0;
263 for (i = 0; i < mp->
n_addrs; i++)
265 ip46_address_t *
peer;
287 int n_addrs, msg_size;
288 ip46_address_t *
addr;
289 vl_api_address_t *api_addr;
292 msg_size =
sizeof (*mp) + n_addrs *
sizeof (*api_addr);
297 mp->_vl_msg_id = htons (VL_API_VRRP_VR_PEER_DETAILS + vmp->
msg_id_base);
315 dst = &api_addr->un.ip6;
317 len =
sizeof (addr->ip6);
322 dst = &api_addr->un.ip4;
324 len =
sizeof (addr->ip4);
382 vl_api_vrrp_vr_track_if_add_del_reply_t *rmp;
392 rv = VNET_API_ERROR_INVALID_VALUE;
398 vl_api_vrrp_vr_track_if_t *api_track_if = &mp->
ifs[
i];
401 track_if->
sw_if_index = ntohl (api_track_if->sw_if_index);
402 track_if->
priority = api_track_if->priority;
409 REPLY_MACRO (VL_API_VRRP_VR_TRACK_IF_ADD_DEL_REPLY);
419 vl_api_vrrp_vr_track_if_t *api_track_if;
426 msg_size =
sizeof (*mp) + n_ifs *
sizeof (*api_track_if);
431 mp->_vl_msg_id = htons (VL_API_VRRP_VR_TRACK_IF_DETAILS + vmp->
msg_id_base);
440 api_track_if = mp->
ifs;
443 api_track_if->sw_if_index = htonl (track_if->
sw_if_index);
444 api_track_if->priority = track_if->
priority;
526 #include <vrrp/vrrp.api.c>
static u8 vrrp_vr_is_unicast(vrrp_vr_t *vr)
VRRP: dump virtual router interface tracking data.
vrrp_vr_tracking_t tracking
int vrrp_vr_start_stop(u8 is_start, vrrp_vr_key_t *vr_key)
#define pool_foreach(VAR, POOL)
Iterate through pool.
vl_api_interface_index_t sw_if_index
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
int vrrp_vr_set_peers(vrrp_vr_key_t *vr_key, ip46_address_t *peers)
vl_api_interface_index_t sw_if_index
void * vl_msg_api_alloc(int nbytes)
vl_api_interface_index_t sw_if_index
static void vl_api_vrrp_vr_peer_dump_t_handler(vl_api_vrrp_vr_peer_dump_t *mp)
#define clib_memcpy(d, s, n)
static void vl_api_vrrp_vr_track_if_dump_t_handler(vl_api_vrrp_vr_track_if_dump_t *mp)
static void send_vrrp_vr_track_if_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
VRRP: start or shutdown the VRRP protocol for a virtual router.
VRRP: Add/delete VR priority tracking of interface status.
vl_api_address_t peer_addrs[n_peer_addrs]
static void send_vrrp_vr_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
vl_api_vrrp_vr_state_t new_state
VRRP: dump virtual router peer address data.
Notification about VRRP VR state change event.
vl_api_interface_index_t sw_if_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vl_api_interface_index_t sw_if_index
pub_sub_handler(vrrp_vr_events, VRRP_VR_EVENTS)
vrrp_vr_runtime_t runtime
static void vl_api_vrrp_vr_dump_t_handler(vl_api_vrrp_vr_dump_t *mp)
static void vl_api_vrrp_vr_add_del_t_handler(vl_api_vrrp_vr_add_del_t *mp)
static u8 vrrp_vr_is_ipv6(vrrp_vr_t *vr)
An API client registration, only in vpp/vlib.
static void setup_message_id_table(api_main_t *am)
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_vrrp_vr_track_if_add_del_t_handler(vl_api_vrrp_vr_track_if_add_del_t *mp)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
clib_error_t * vrrp_plugin_api_hookup(vlib_main_t *vm)
vl_api_vrrp_vr_conf_t config
#define clib_warning(format, args...)
void vrrp_vr_event(vrrp_vr_t *vr, vrrp_vr_state_t new_state)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_vrrp_vr_state_t old_state
static u8 vrrp_vr_priority(vrrp_vr_t *vr)
VRRP: Add or delete a VRRP virtual router.
vl_api_vrrp_vr_track_if_t ifs[n_ifs]
VRRP: dump virtual router data.
vl_api_interface_index_t sw_if_index
static uword * mhash_get(mhash_t *h, const void *key)
vrrp_vr_tracking_if_t * interfaces
vl_api_address_t addrs[n_addrs]
int vrrp_vr_add_del(u8 is_add, vrrp_vr_config_t *vr_conf)
vl_api_vrrp_vr_flags_t flags
vl_api_interface_index_t sw_if_index
static vl_api_vrrp_vr_state_t vrrp_vr_state_encode(vrrp_vr_state_t vr_state)
enum vrrp_vr_state vrrp_vr_state_t
VRRP: set unicast peers for a VR.
vl_api_interface_index_t sw_if_index
vl_api_vrrp_vr_track_if_t ifs[n_ifs]
static void send_vrrp_vr_peer_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
static void send_vrrp_vr_event(vpe_client_registration_t *reg, vl_api_registration_t *vl_reg, vrrp_vr_t *vr, vrrp_vr_state_t new_state)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static vrrp_vr_t * vrrp_vr_lookup(u32 sw_if_index, u8 vr_id, u8 is_ipv6)
vl_api_address_t addrs[n_addrs]
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_vrrp_vr_set_peers_t_handler(vl_api_vrrp_vr_set_peers_t *mp)
static void vl_api_vrrp_vr_start_stop_t_handler(vl_api_vrrp_vr_start_stop_t *mp)
ip46_address_t * vr_addrs
VRRP: VR peer dump response.
ip46_address_t * peer_addrs
vpe_api_main_t vpe_api_main
vl_api_address_t addrs[n_addrs]
int vrrp_vr_tracking_ifs_add_del(vrrp_vr_t *vr, vrrp_vr_tracking_if_t *track_ifs, u8 is_add)
vl_api_interface_index_t sw_if_index
vl_api_interface_index_t sw_if_index
VRRP: VR interface tracking dump response.
vl_api_vrrp_vr_runtime_t runtime
#define VALIDATE_SW_IF_INDEX(mp)