- vpe_api_main_t *am = &vpe_api_main;
- vl_api_ip4_arp_event_t *event;
-
- if (pool_is_free_index (am->arp_events, pool_index))
- return 1;
-
- event = pool_elt_at_index (am->arp_events, pool_index);
- if (ethernet_mac_address_equal (event->mac, mac->bytes) &&
- sw_if_index == ntohl (event->sw_if_index))
- {
- return 1;
- }
-
- mac_address_encode (mac, event->mac);
- event->sw_if_index = htonl (sw_if_index);
- return 0;
-}
-
-static void
-vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- vnet_main_t *vnm = vnet_get_main ();
- vl_api_want_ip4_arp_events_reply_t *rmp;
- ip4_address_t ip;
- int rv = 0;
-
- ip4_address_decode (mp->ip, &ip);
-
- if (ip.as_u32 == 0)
- {
- uword *p =
- hash_get (am->wc_ip4_arp_events_registration_hash, mp->client_index);
- vpe_client_registration_t *rp;
- if (p)
- {
- if (mp->enable_disable)
- {
- clib_warning ("pid %d: already enabled...", mp->pid);
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- else
- {
- rp =
- pool_elt_at_index (am->wc_ip4_arp_events_registrations, p[0]);
- pool_put (am->wc_ip4_arp_events_registrations, rp);
- hash_unset (am->wc_ip4_arp_events_registration_hash,
- mp->client_index);
- if (pool_elts (am->wc_ip4_arp_events_registrations) == 0)
- wc_arp_set_publisher_node (~0, REPORT_MAX);
- goto reply;
- }
- }
- if (mp->enable_disable == 0)
- {
- clib_warning ("pid %d: already disabled...", mp->pid);
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- pool_get (am->wc_ip4_arp_events_registrations, rp);
- rp->client_index = mp->client_index;
- rp->client_pid = mp->pid;
- hash_set (am->wc_ip4_arp_events_registration_hash, rp->client_index,
- rp - am->wc_ip4_arp_events_registrations);
- wc_arp_set_publisher_node (wc_arp_process_node.index, WC_ARP_REPORT);
- goto reply;
- }
-
- if (mp->enable_disable)
- {
- vl_api_ip4_arp_event_t *event;
- pool_get (am->arp_events, event);
- rv = vnet_add_del_ip4_arp_change_event
- (vnm, arp_change_data_callback,
- mp->pid, mp->ip /* addr, in net byte order */ ,
- ip_resolver_process_node.index,
- IP4_ARP_EVENT, event - am->arp_events, 1 /* is_add */ );
-
- if (rv)
- {
- pool_put (am->arp_events, event);
- goto reply;
- }
- clib_memset (event, 0, sizeof (*event));
-
- /* Python API expects events to have no context */
- event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT);
- event->client_index = mp->client_index;
- memcpy (event->ip, mp->ip, 4);
- event->pid = mp->pid;
- if (ip.as_u32 == 0)
- event->mac_ip = 1;
- }
- else
- {
- rv = vnet_add_del_ip4_arp_change_event
- (vnm, arp_change_delete_callback,
- mp->pid, mp->ip /* addr, in net byte order */ ,
- ip_resolver_process_node.index,
- IP4_ARP_EVENT, ~0 /* pool index */ , 0 /* is_add */ );
- }
-reply:
- REPLY_MACRO (VL_API_WANT_IP4_ARP_EVENTS_REPLY);
-}
-
-static clib_error_t *
-want_ip4_arp_events_reaper (u32 client_index)
-{
- vpe_client_registration_t *rp;
- vl_api_ip4_arp_event_t *event;
- u32 *to_delete, *event_id;
- vpe_api_main_t *am;
- vnet_main_t *vnm;
- uword *p;
-
- am = &vpe_api_main;
- vnm = vnet_get_main ();
- to_delete = NULL;
-
- /* clear out all of its pending resolutions */
- /* *INDENT-OFF* */
- pool_foreach(event, am->arp_events,
- ({
- if (event->client_index == client_index)
- {
- vec_add1(to_delete, event - am->arp_events);
- }
- }));
- /* *INDENT-ON* */
-
- vec_foreach (event_id, to_delete)
- {
- event = pool_elt_at_index (am->arp_events, *event_id);
- vnet_add_del_ip4_arp_change_event
- (vnm, arp_change_delete_callback,
- event->pid, event->ip,
- ip_resolver_process_node.index, IP4_ARP_EVENT,
- ~0 /* pool index, notused */ , 0 /* is_add */ );
- }
- vec_free (to_delete);
-
- /* remove from the registration hash */
- p = hash_get (am->wc_ip4_arp_events_registration_hash, client_index);
-
- if (p)
- {
- rp = pool_elt_at_index (am->wc_ip4_arp_events_registrations, p[0]);
- pool_put (am->wc_ip4_arp_events_registrations, rp);
- hash_unset (am->wc_ip4_arp_events_registration_hash, client_index);
- if (pool_elts (am->wc_ip4_arp_events_registrations) == 0)
- wc_arp_set_publisher_node (~0, REPORT_MAX);
- }
- return (NULL);
-}
-
-VL_MSG_API_REAPER_FUNCTION (want_ip4_arp_events_reaper);
-
-static void
-vl_api_want_ip6_nd_events_t_handler (vl_api_want_ip6_nd_events_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- vnet_main_t *vnm = vnet_get_main ();
- vl_api_want_ip6_nd_events_reply_t *rmp;
- ip6_address_t ip6;
- int rv = 0;
-
- ip6_address_decode (mp->ip, &ip6);
-
- if (ip6_address_is_zero (&ip6))
- {
- uword *p =
- hash_get (am->wc_ip6_nd_events_registration_hash, mp->client_index);
- vpe_client_registration_t *rp;
- if (p)
- {
- if (mp->enable_disable)
- {
- clib_warning ("pid %d: already enabled...", mp->pid);
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- else
- {
- rp =
- pool_elt_at_index (am->wc_ip6_nd_events_registrations, p[0]);
- pool_put (am->wc_ip6_nd_events_registrations, rp);
- hash_unset (am->wc_ip6_nd_events_registration_hash,
- mp->client_index);
- if (pool_elts (am->wc_ip6_nd_events_registrations) == 0)
- wc_nd_set_publisher_node (~0, REPORT_MAX);
- goto reply;
- }
- }
- if (mp->enable_disable == 0)
- {
- clib_warning ("pid %d: already disabled...", mp->pid);
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- pool_get (am->wc_ip6_nd_events_registrations, rp);
- rp->client_index = mp->client_index;
- rp->client_pid = mp->pid;
- hash_set (am->wc_ip6_nd_events_registration_hash, rp->client_index,
- rp - am->wc_ip6_nd_events_registrations);
- wc_nd_set_publisher_node (wc_arp_process_node.index, WC_ND_REPORT);
- goto reply;
- }
-
- if (mp->enable_disable)
- {
- vl_api_ip6_nd_event_t *event;
- pool_get (am->nd_events, event);
-
- rv = vnet_add_del_ip6_nd_change_event
- (vnm, nd_change_data_callback,
- mp->pid, &ip6,
- ip_resolver_process_node.index,
- IP6_ND_EVENT, event - am->nd_events, 1 /* is_add */ );
-
- if (rv)
- {
- pool_put (am->nd_events, event);
- goto reply;
- }
- clib_memset (event, 0, sizeof (*event));
-
- event->_vl_msg_id = ntohs (VL_API_IP6_ND_EVENT);
- event->client_index = mp->client_index;
- ip6_address_encode (&ip6, event->ip);
- event->pid = mp->pid;
- }
- else
- {
- rv = vnet_add_del_ip6_nd_change_event
- (vnm, nd_change_delete_callback,
- mp->pid, &ip6 /* addr, in net byte order */ ,
- ip_resolver_process_node.index,
- IP6_ND_EVENT, ~0 /* pool index */ , 0 /* is_add */ );
- }
-reply:
- REPLY_MACRO (VL_API_WANT_IP6_ND_EVENTS_REPLY);
-}
-
-static clib_error_t *
-want_ip6_nd_events_reaper (u32 client_index)
-{
-
- vpe_client_registration_t *rp;
- vl_api_ip6_nd_event_t *event;
- u32 *to_delete, *event_id;
- vpe_api_main_t *am;
- vnet_main_t *vnm;
- uword *p;
-
- am = &vpe_api_main;
- vnm = vnet_get_main ();
- to_delete = NULL;
-
- /* clear out all of its pending resolutions */
- /* *INDENT-OFF* */
- pool_foreach(event, am->nd_events,
- ({
- if (event->client_index == client_index)
- {
- vec_add1(to_delete, event - am->nd_events);
- }
- }));
- /* *INDENT-ON* */
-
- vec_foreach (event_id, to_delete)
- {
- event = pool_elt_at_index (am->nd_events, *event_id);
- vnet_add_del_ip6_nd_change_event
- (vnm, nd_change_delete_callback,
- event->pid, event->ip,
- ip_resolver_process_node.index, IP6_ND_EVENT,
- ~0 /* pool index, notused */ , 0 /* is_add */ );
- }
- vec_free (to_delete);
-
- /* remove from the registration hash */
- p = hash_get (am->wc_ip6_nd_events_registration_hash, client_index);
-
- if (p)
- {
- rp = pool_elt_at_index (am->wc_ip6_nd_events_registrations, p[0]);
- pool_put (am->wc_ip6_nd_events_registrations, rp);
- hash_unset (am->wc_ip6_nd_events_registration_hash, client_index);
- if (pool_elts (am->wc_ip6_nd_events_registrations) == 0)
- wc_nd_set_publisher_node (~0, REPORT_MAX);
- }
- return (NULL);
-}
-
-VL_MSG_API_REAPER_FUNCTION (want_ip6_nd_events_reaper);
-
-static void
-vl_api_want_ip6_ra_events_t_handler (vl_api_want_ip6_ra_events_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- vl_api_want_ip6_ra_events_reply_t *rmp;
- int rv = 0;
-
- uword *p = hash_get (am->ip6_ra_events_registration_hash, mp->client_index);
- vpe_client_registration_t *rp;
- if (p)
- {
- if (mp->enable_disable)
- {
- clib_warning ("pid %d: already enabled...", ntohl (mp->pid));
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- else
- {
- rp = pool_elt_at_index (am->ip6_ra_events_registrations, p[0]);
- pool_put (am->ip6_ra_events_registrations, rp);
- hash_unset (am->ip6_ra_events_registration_hash, mp->client_index);
- goto reply;
- }
- }
- if (mp->enable_disable == 0)
- {
- clib_warning ("pid %d: already disabled...", ntohl (mp->pid));
- rv = VNET_API_ERROR_INVALID_REGISTRATION;
- goto reply;
- }
- pool_get (am->ip6_ra_events_registrations, rp);
- rp->client_index = mp->client_index;
- rp->client_pid = ntohl (mp->pid);
- hash_set (am->ip6_ra_events_registration_hash, rp->client_index,
- rp - am->ip6_ra_events_registrations);
-
-reply:
- REPLY_MACRO (VL_API_WANT_IP6_RA_EVENTS_REPLY);
-}
-
-static clib_error_t *
-want_ip6_ra_events_reaper (u32 client_index)
-{
- vpe_api_main_t *am = &vpe_api_main;
- vpe_client_registration_t *rp;
- uword *p;
-
- p = hash_get (am->ip6_ra_events_registration_hash, client_index);
-
- if (p)
- {
- rp = pool_elt_at_index (am->ip6_ra_events_registrations, p[0]);
- pool_put (am->ip6_ra_events_registrations, rp);
- hash_unset (am->ip6_ra_events_registration_hash, client_index);
- }
- return (NULL);
-}
-
-VL_MSG_API_REAPER_FUNCTION (want_ip6_ra_events_reaper);
-
-static void
-vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
-{
- vl_api_proxy_arp_add_del_reply_t *rmp;
- ip4_address_t lo, hi;
- u32 fib_index;
- int rv;
-
- fib_index = fib_table_find (FIB_PROTOCOL_IP4, ntohl (mp->proxy.table_id));
-
- if (~0 == fib_index)
- {
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto out;
- }
-
- ip4_address_decode (mp->proxy.low, &lo);
- ip4_address_decode (mp->proxy.hi, &hi);
-
- rv = vnet_proxy_arp_add_del (&lo, &hi, fib_index, mp->is_add == 0);
-
-out:
- REPLY_MACRO (VL_API_PROXY_ARP_ADD_DEL_REPLY);
-}
-
-typedef struct proxy_arp_walk_ctx_t_
-{
- vl_api_registration_t *reg;
- u32 context;
-} proxy_arp_walk_ctx_t;
-
-static walk_rc_t
-send_proxy_arp_details (const ip4_address_t * lo_addr,
- const ip4_address_t * hi_addr,
- u32 fib_index, void *data)
-{
- vl_api_proxy_arp_details_t *mp;
- proxy_arp_walk_ctx_t *ctx;
-
- ctx = data;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_DETAILS);
- mp->context = ctx->context;
- mp->proxy.table_id = htonl (fib_index);
-
- ip4_address_encode (lo_addr, mp->proxy.low);
- ip4_address_encode (hi_addr, mp->proxy.hi);
-
- vl_api_send_msg (ctx->reg, (u8 *) mp);
-
- return (WALK_CONTINUE);
-}
-
-static void
-vl_api_proxy_arp_dump_t_handler (vl_api_proxy_arp_dump_t * mp)
-{
- vl_api_registration_t *reg;
-
- reg = vl_api_client_index_to_registration (mp->client_index);
- if (!reg)
- return;
-
- proxy_arp_walk_ctx_t wctx = {
- .reg = reg,
- .context = mp->context,
- };
-
- proxy_arp_walk (send_proxy_arp_details, &wctx);
-}
-
-static walk_rc_t
-send_proxy_arp_intfc_details (u32 sw_if_index, void *data)
-{
- vl_api_proxy_arp_intfc_details_t *mp;
- proxy_arp_walk_ctx_t *ctx;
-
- ctx = data;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_DETAILS);
- mp->context = ctx->context;
- mp->sw_if_index = htonl (sw_if_index);
-
- vl_api_send_msg (ctx->reg, (u8 *) mp);
-
- return (WALK_CONTINUE);
-}
-
-static void
-vl_api_proxy_arp_intfc_dump_t_handler (vl_api_proxy_arp_intfc_dump_t * mp)
-{
- vl_api_registration_t *reg;
-
- reg = vl_api_client_index_to_registration (mp->client_index);
- if (!reg)
- return;
-
- proxy_arp_walk_ctx_t wctx = {
- .reg = reg,
- .context = mp->context,
- };
-
- proxy_arp_intfc_walk (send_proxy_arp_intfc_details, &wctx);
-}
-
-static void
- vl_api_proxy_arp_intfc_enable_disable_t_handler
- (vl_api_proxy_arp_intfc_enable_disable_t * mp)
-{
- int rv = 0;
- vnet_main_t *vnm = vnet_get_main ();
- vl_api_proxy_arp_intfc_enable_disable_reply_t *rmp;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = vnet_proxy_arp_enable_disable (vnm,
- ntohl (mp->sw_if_index),
- mp->enable_disable);
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY);
-}
-
-static void
-vl_api_ip_probe_neighbor_t_handler (vl_api_ip_probe_neighbor_t * mp)
-{
- int rv = 0;
- vlib_main_t *vm = vlib_get_main ();
- vl_api_ip_probe_neighbor_reply_t *rmp;
- clib_error_t *error;
- ip46_address_t dst;
- ip46_type_t itype;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- u32 sw_if_index = ntohl (mp->sw_if_index);
- itype = ip_address_decode (&mp->dst, &dst);
-
- if (IP46_TYPE_IP6 == itype)
- error = ip6_probe_neighbor (vm, &dst.ip6, sw_if_index, 0);
- else
- error = ip4_probe_neighbor (vm, &dst.ip4, sw_if_index, 0);
-
- if (error)
- {
- clib_error_report (error);
- rv = clib_error_get_code (error);
- }
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY);
-}
-
-static void
- vl_api_ip_scan_neighbor_enable_disable_t_handler
- (vl_api_ip_scan_neighbor_enable_disable_t * mp)
-{
- int rv = 0;
- vl_api_ip_scan_neighbor_enable_disable_reply_t *rmp;
- ip_neighbor_scan_arg_t arg;
-
- arg.mode = mp->mode;
- arg.scan_interval = mp->scan_interval;
- arg.max_proc_time = mp->max_proc_time;
- arg.max_update = mp->max_update;
- arg.scan_int_delay = mp->scan_int_delay;
- arg.stale_threshold = mp->stale_threshold;
- ip_neighbor_scan_enable_disable (&arg);
-
- REPLY_MACRO (VL_API_IP_SCAN_NEIGHBOR_ENABLE_DISABLE_REPLY);
-}
-
-static int
-ip4_reset_fib_t_handler (vl_api_reset_fib_t * mp)
-{
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_main_t *im = &vnm->interface_main;
- ip4_main_t *im4 = &ip4_main;
- static u32 *sw_if_indices_to_shut;
- fib_table_t *fib_table;
- ip4_fib_t *fib;
- u32 sw_if_index;
- int i;
- int rv = VNET_API_ERROR_NO_SUCH_FIB;
- u32 target_fib_id = ntohl (mp->vrf_id);
-
- /* *INDENT-OFF* */
- pool_foreach (fib_table, im4->fibs,
- ({
- vnet_sw_interface_t * si;
-
- fib = pool_elt_at_index (im4->v4_fibs, fib_table->ft_index);
-
- if (fib->table_id != target_fib_id)
- continue;
-
- /* remove any mpls encap/decap labels */
- mpls_fib_reset_labels (fib->table_id);
-
- /* remove any proxy arps in this fib */
- vnet_proxy_arp_fib_reset (fib->table_id);
-
- /* Set the flow hash for this fib to the default */
- vnet_set_ip4_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
-
- vec_reset_length (sw_if_indices_to_shut);
-
- /* Shut down interfaces in this FIB / clean out intfc routes */
- pool_foreach (si, im->sw_interfaces,
- ({
- u32 sw_if_index = si->sw_if_index;
-
- if (sw_if_index < vec_len (im4->fib_index_by_sw_if_index)
- && (im4->fib_index_by_sw_if_index[si->sw_if_index] ==
- fib->index))
- vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
- }));
-
- for (i = 0; i < vec_len (sw_if_indices_to_shut); i++) {
- sw_if_index = sw_if_indices_to_shut[i];
-
- u32 flags = vnet_sw_interface_get_flags (vnm, sw_if_index);
- flags &= ~(VNET_SW_INTERFACE_FLAG_ADMIN_UP);
- vnet_sw_interface_set_flags (vnm, sw_if_index, flags);
- }
-
- fib_table_flush(fib->index, FIB_PROTOCOL_IP4, FIB_SOURCE_API);
-
- rv = 0;
- break;
- })); /* pool_foreach (fib) */
- /* *INDENT-ON* */
-
- return rv;
-}
-
-static int
-ip6_reset_fib_t_handler (vl_api_reset_fib_t * mp)
-{
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_main_t *im = &vnm->interface_main;
- ip6_main_t *im6 = &ip6_main;
- static u32 *sw_if_indices_to_shut;
- fib_table_t *fib_table;
- ip6_fib_t *fib;
- u32 sw_if_index;
- int i;
- int rv = VNET_API_ERROR_NO_SUCH_FIB;
- u32 target_fib_id = ntohl (mp->vrf_id);
-
- /* *INDENT-OFF* */
- pool_foreach (fib_table, im6->fibs,
- ({
- vnet_sw_interface_t * si;
-
- fib = pool_elt_at_index (im6->v6_fibs, fib_table->ft_index);
-
- if (fib->table_id != target_fib_id)
- continue;
-
- vec_reset_length (sw_if_indices_to_shut);
-
- /* Set the flow hash for this fib to the default */
- vnet_set_ip6_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
-
- /* Shut down interfaces in this FIB / clean out intfc routes */
- pool_foreach (si, im->sw_interfaces,
- ({
- if (im6->fib_index_by_sw_if_index[si->sw_if_index] ==
- fib->index)
- vec_add1 (sw_if_indices_to_shut, si->sw_if_index);
- }));
-
- for (i = 0; i < vec_len (sw_if_indices_to_shut); i++) {
- sw_if_index = sw_if_indices_to_shut[i];
-
- u32 flags = vnet_sw_interface_get_flags (vnm, sw_if_index);
- flags &= ~(VNET_SW_INTERFACE_FLAG_ADMIN_UP);
- vnet_sw_interface_set_flags (vnm, sw_if_index, flags);
- }
-
- fib_table_flush(fib->index, FIB_PROTOCOL_IP6, FIB_SOURCE_API);
-
- rv = 0;
- break;
- })); /* pool_foreach (fib) */
- /* *INDENT-ON* */
-
- return rv;
-}
-
-static void
-vl_api_reset_fib_t_handler (vl_api_reset_fib_t * mp)
-{
- int rv;
- vl_api_reset_fib_reply_t *rmp;
-
- if (mp->is_ipv6)
- rv = ip6_reset_fib_t_handler (mp);
- else
- rv = ip4_reset_fib_t_handler (mp);
-
- REPLY_MACRO (VL_API_RESET_FIB_REPLY);
-}
-
-static void
-vl_api_set_arp_neighbor_limit_t_handler (vl_api_set_arp_neighbor_limit_t * mp)
-{
- int rv;
- vl_api_set_arp_neighbor_limit_reply_t *rmp;
- vnet_main_t *vnm = vnet_get_main ();
- clib_error_t *error;
-
- vnm->api_errno = 0;
-
- if (mp->is_ipv6)
- error = ip6_set_neighbor_limit (ntohl (mp->arp_neighbor_limit));
- else
- error = ip4_set_arp_limit (ntohl (mp->arp_neighbor_limit));
-
- if (error)
- {
- clib_error_report (error);
- rv = VNET_API_ERROR_UNSPECIFIED;
- }
- else
- {
- rv = vnm->api_errno;
- }
-
- REPLY_MACRO (VL_API_SET_ARP_NEIGHBOR_LIMIT_REPLY);
-}
-
-void
-vl_api_ip_reassembly_set_t_handler (vl_api_ip_reassembly_set_t * mp)
-{
- vl_api_ip_reassembly_set_reply_t *rmp;
- int rv = 0;
- if (mp->is_ip6)
- {
- rv = ip6_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
- clib_net_to_host_u32 (mp->max_reassemblies),
- clib_net_to_host_u32 (mp->max_reassembly_length),
- clib_net_to_host_u32 (mp->expire_walk_interval_ms));
- }
- else
- {
- rv = ip4_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
- clib_net_to_host_u32 (mp->max_reassemblies),
- clib_net_to_host_u32 (mp->max_reassembly_length),
- clib_net_to_host_u32 (mp->expire_walk_interval_ms));
- }
-
- REPLY_MACRO (VL_API_IP_REASSEMBLY_SET_REPLY);
-}
-
-void
-vl_api_ip_reassembly_get_t_handler (vl_api_ip_reassembly_get_t * mp)
-{
- vl_api_registration_t *rp;
-
- rp = vl_api_client_index_to_registration (mp->client_index);
- if (rp == 0)
- return;
-
- vl_api_ip_reassembly_get_reply_t *rmp = vl_msg_api_alloc (sizeof (*rmp));
- clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_IP_REASSEMBLY_GET_REPLY);
- rmp->context = mp->context;
- rmp->retval = 0;
- if (mp->is_ip6)
- {
- rmp->is_ip6 = 1;
- ip6_reass_get (&rmp->timeout_ms, &rmp->max_reassemblies,
- &rmp->expire_walk_interval_ms);
- }
- else
- {
- rmp->is_ip6 = 0;
- ip4_reass_get (&rmp->timeout_ms, &rmp->max_reassemblies,
- &rmp->max_reassembly_length,
- &rmp->expire_walk_interval_ms);
- }
- rmp->timeout_ms = clib_host_to_net_u32 (rmp->timeout_ms);
- rmp->max_reassemblies = clib_host_to_net_u32 (rmp->max_reassemblies);
- rmp->expire_walk_interval_ms =
- clib_host_to_net_u32 (rmp->expire_walk_interval_ms);
- vl_api_send_msg (rp, (u8 *) rmp);
-}
-
-void
- vl_api_ip_reassembly_enable_disable_t_handler
- (vl_api_ip_reassembly_enable_disable_t * mp)
-{
- vl_api_ip_reassembly_enable_disable_reply_t *rmp;
- int rv = 0;
- rv = ip4_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
- mp->enable_ip4);
- if (0 == rv)
- {
- rv = ip6_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
- mp->enable_ip6);