|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
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);
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;
193 dst = &api_addr->un.ip4;
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;
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;
322 dst = &api_addr->un.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>
VRRP: set unicast peers for a VR.
static void send_vrrp_vr_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
Notification about VRRP VR state change event.
#define VALIDATE_SW_IF_INDEX(mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_interface_index_t sw_if_index
static void vl_api_vrrp_vr_start_stop_t_handler(vl_api_vrrp_vr_start_stop_t *mp)
ip46_address_t * vr_addrs
#define clib_memcpy(d, s, n)
ip46_address_t * peer_addrs
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vl_api_address_t peer_addrs[n_peer_addrs]
VRRP: Add or delete a VRRP virtual router.
@ VRRP_API_VR_STATE_BACKUP
clib_error_t * vrrp_plugin_api_hookup(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
vl_api_vrrp_vr_track_if_t ifs[n_ifs]
static uword * mhash_get(mhash_t *h, const void *key)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vrrp_vr_runtime_t runtime
static u8 vrrp_vr_is_ipv6(vrrp_vr_t *vr)
static vl_api_vrrp_vr_state_t vrrp_vr_state_encode(vrrp_vr_state_t vr_state)
vl_api_interface_index_t sw_if_index
vl_api_vrrp_vr_state_t old_state
vl_api_interface_index_t sw_if_index
void vrrp_vr_event(vrrp_vr_t *vr, vrrp_vr_state_t new_state)
static u8 vrrp_vr_is_unicast(vrrp_vr_t *vr)
@ VRRP_API_VR_STATE_MASTER
VRRP: VR interface tracking dump response.
static void vl_api_vrrp_vr_track_if_add_del_t_handler(vl_api_vrrp_vr_track_if_add_del_t *mp)
VRRP: dump virtual router peer address data.
static void setup_message_id_table(api_main_t *am)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ VRRP_API_VR_STATE_INTF_DOWN
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
vl_api_vrrp_vr_conf_t config
vl_api_address_t addrs[n_addrs]
An API client registration, only in vpp/vlib.
static void vl_api_vrrp_vr_dump_t_handler(vl_api_vrrp_vr_dump_t *mp)
int vrrp_vr_set_peers(vrrp_vr_key_t *vr_key, ip46_address_t *peers)
static void send_vrrp_vr_track_if_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
sll srl srl sll sra u16x4 i
vl_api_address_t addrs[n_addrs]
vl_api_interface_index_t sw_if_index
VRRP: dump virtual router interface tracking data.
vrrp_vr_tracking_t tracking
enum vrrp_vr_state vrrp_vr_state_t
vl_api_interface_index_t sw_if_index
static vrrp_vr_t * vrrp_vr_lookup(u32 sw_if_index, u8 vr_id, u8 is_ipv6)
#define BAD_SW_IF_INDEX_LABEL
vl_api_vrrp_vr_track_if_t ifs[n_ifs]
#define vec_free(V)
Free vector's memory (no header).
static void send_vrrp_vr_peer_details(vrrp_vr_t *vr, vl_api_registration_t *reg, u32 context)
vl_api_vrrp_vr_flags_t flags
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)
pub_sub_handler(vrrp_vr_events, VRRP_VR_EVENTS)
vl_api_interface_index_t sw_if_index
static void vl_api_vrrp_vr_add_del_t_handler(vl_api_vrrp_vr_add_del_t *mp)
VRRP: dump virtual router data.
vl_api_vrrp_vr_state_t new_state
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_foreach(var, vec)
Vector iterator.
int vrrp_vr_tracking_ifs_add_del(vrrp_vr_t *vr, vrrp_vr_tracking_if_t *track_ifs, u8 is_add)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
VRRP: start or shutdown the VRRP protocol for a virtual router.
int vrrp_vr_start_stop(u8 is_start, vrrp_vr_key_t *vr_key)
VRRP: Add/delete VR priority tracking of interface status.
static void vl_api_vrrp_vr_set_peers_t_handler(vl_api_vrrp_vr_set_peers_t *mp)
#define clib_warning(format, args...)
vl_api_address_t addrs[n_addrs]
static void vl_api_vrrp_vr_track_if_dump_t_handler(vl_api_vrrp_vr_track_if_dump_t *mp)
int vrrp_vr_add_del(u8 is_add, vrrp_vr_config_t *vr_conf)
vl_api_interface_index_t sw_if_index
VRRP: VR peer dump response.
vrrp_vr_tracking_if_t * interfaces
vl_api_interface_index_t sw_if_index
vl_api_vrrp_vr_runtime_t runtime
static u8 vrrp_vr_priority(vrrp_vr_t *vr)
vpe_api_main_t vpe_api_main
void * vl_msg_api_alloc(int nbytes)