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 vmp->msg_id_base 31 vl_api_vrrp_vr_add_del_reply_t *rmp;
34 ip46_address_t *addrs = 0;
39 api_flags = htonl (mp->
flags);
64 for (i = 0; i < mp->
n_addrs; i++)
74 src = &mp->
addrs[
i].un.ip4;
76 len =
sizeof (addr->ip4);
80 src = &mp->
addrs[
i].un.ip6;
82 len =
sizeof (addr->ip6);
94 rv = VNET_API_ERROR_INVALID_VALUE;
99 rv = VNET_API_ERROR_INVALID_VALUE;
101 else if (vr_conf.
vr_id == 0)
104 rv = VNET_API_ERROR_INVALID_VALUE;
121 int n_addrs, msg_size;
122 ip46_address_t *
addr;
123 vl_api_address_t *api_addr;
127 msg_size =
sizeof (*mp) + n_addrs *
sizeof (*api_addr);
132 mp->_vl_msg_id = htons (VL_API_VRRP_VR_DETAILS + vmp->
msg_id_base);
150 mp->
config.flags = htonl (api_flags);
155 case VRRP_VR_STATE_INIT:
158 case VRRP_VR_STATE_BACKUP:
161 case VRRP_VR_STATE_MASTER:
164 case VRRP_VR_STATE_INTF_DOWN:
181 api_addr = mp->
addrs;
190 dst = &api_addr->un.ip6;
192 len =
sizeof (addr->ip6);
197 dst = &api_addr->un.ip4;
199 len =
sizeof (addr->ip4);
225 if (sw_if_index && (sw_if_index != ~0) &&
226 (sw_if_index != vr->config.sw_if_index))
229 send_vrrp_vr_details (vr, reg, mp->context);
238 vl_api_vrrp_vr_start_stop_reply_t *rmp;
257 vl_api_vrrp_vr_set_peers_reply_t *rmp;
259 ip46_address_t *peer_addrs = 0;
269 for (i = 0; i < mp->
n_addrs; i++)
271 ip46_address_t *
peer;
293 int n_addrs, msg_size;
294 ip46_address_t *
addr;
295 vl_api_address_t *api_addr;
298 msg_size =
sizeof (*mp) + n_addrs *
sizeof (*api_addr);
303 mp->_vl_msg_id = htons (VL_API_VRRP_VR_PEER_DETAILS + vmp->
msg_id_base);
321 dst = &api_addr->un.ip6;
323 len =
sizeof (addr->ip6);
328 dst = &api_addr->un.ip4;
330 len =
sizeof (addr->ip4);
375 if (!vec_len (vr->config.peer_addrs))
378 send_vrrp_vr_details (vr, reg, mp->context);
389 vl_api_vrrp_vr_track_if_add_del_reply_t *rmp;
399 rv = VNET_API_ERROR_INVALID_VALUE;
405 vl_api_vrrp_vr_track_if_t *api_track_if = &mp->
ifs[
i];
408 track_if->
sw_if_index = ntohl (api_track_if->sw_if_index);
409 track_if->
priority = api_track_if->priority;
416 REPLY_MACRO (VL_API_VRRP_VR_TRACK_IF_ADD_DEL_REPLY);
426 vl_api_vrrp_vr_track_if_t *api_track_if;
433 msg_size =
sizeof (*mp) + n_ifs *
sizeof (*api_track_if);
438 mp->_vl_msg_id = htons (VL_API_VRRP_VR_TRACK_IF_DETAILS + vmp->
msg_id_base);
447 api_track_if = mp->
ifs;
450 api_track_if->sw_if_index = htonl (track_if->
sw_if_index);
451 api_track_if->priority = track_if->
priority;
480 if (!vec_len (vr->tracking.interfaces))
483 send_vrrp_vr_track_if_details (vr, reg, mp->context);
490 #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)
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.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
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)
VRRP: dump virtual router peer address data.
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
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.
#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...)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
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
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)
#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 setup_message_id_table(snat_main_t *sm, api_main_t *am)
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
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)