-{
- vlib_main_t *vm = vlib_get_main ();
- vl_api_dhcp_client_config_reply_t *rmp;
- int rv = 0;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = dhcp_client_config (vm, ntohl (mp->sw_if_index),
- mp->hostname, mp->is_add, mp->client_index,
- mp->want_dhcp_event ? dhcp_compl_event_callback :
- NULL, mp->pid);
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_DHCP_CLIENT_CONFIG_REPLY);
-}
-
-static void
- vl_api_sw_interface_ip6nd_ra_config_t_handler
- (vl_api_sw_interface_ip6nd_ra_config_t * mp, vlib_main_t * vm)
-{
- vl_api_sw_interface_ip6nd_ra_config_reply_t *rmp;
- int rv = 0;
- u8 is_no, suppress, managed, other, ll_option, send_unicast, cease,
- default_router;
-
- is_no = mp->is_no == 1;
- suppress = mp->suppress == 1;
- managed = mp->managed == 1;
- other = mp->other == 1;
- ll_option = mp->ll_option == 1;
- send_unicast = mp->send_unicast == 1;
- cease = mp->cease == 1;
- default_router = mp->default_router == 1;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- rv = ip6_neighbor_ra_config (vm, ntohl (mp->sw_if_index),
- suppress, managed, other,
- ll_option, send_unicast, cease,
- default_router, ntohl (mp->lifetime),
- ntohl (mp->initial_count),
- ntohl (mp->initial_interval),
- ntohl (mp->max_interval),
- ntohl (mp->min_interval), is_no);
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG_REPLY);
-}
-
-static void
- vl_api_sw_interface_ip6nd_ra_prefix_t_handler
- (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, vlib_main_t * vm)
-{
- vl_api_sw_interface_ip6nd_ra_prefix_reply_t *rmp;
- int rv = 0;
- u8 is_no, use_default, no_advertise, off_link, no_autoconfig, no_onlink;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- is_no = mp->is_no == 1;
- use_default = mp->use_default == 1;
- no_advertise = mp->no_advertise == 1;
- off_link = mp->off_link == 1;
- no_autoconfig = mp->no_autoconfig == 1;
- no_onlink = mp->no_onlink == 1;
-
- rv = ip6_neighbor_ra_prefix (vm, ntohl (mp->sw_if_index),
- (ip6_address_t *) mp->address,
- mp->address_length, use_default,
- ntohl (mp->val_lifetime),
- ntohl (mp->pref_lifetime), no_advertise,
- off_link, no_autoconfig, no_onlink, is_no);
-
- BAD_SW_IF_INDEX_LABEL;
- REPLY_MACRO (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX_REPLY);
-}
-
-static void
- vl_api_sw_interface_ip6_enable_disable_t_handler
- (vl_api_sw_interface_ip6_enable_disable_t * mp, vlib_main_t * vm)
-{
- vl_api_sw_interface_ip6_enable_disable_reply_t *rmp;
- vnet_main_t *vnm = vnet_get_main ();
- int rv = 0;
- clib_error_t *error;
-
- vnm->api_errno = 0;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- error =
- (mp->enable == 1) ? enable_ip6_interface (vm,
- ntohl (mp->sw_if_index)) :
- disable_ip6_interface (vm, ntohl (mp->sw_if_index));
-
- if (error)
- {
- clib_error_report (error);
- rv = VNET_API_ERROR_UNSPECIFIED;
- }
- else
- {
- rv = vnm->api_errno;
- }
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY);
-}
-
-static void
- vl_api_sw_interface_ip6_set_link_local_address_t_handler
- (vl_api_sw_interface_ip6_set_link_local_address_t * mp, vlib_main_t * vm)
-{
- vl_api_sw_interface_ip6_set_link_local_address_reply_t *rmp;
- int rv = 0;
- clib_error_t *error;
- vnet_main_t *vnm = vnet_get_main ();
-
- vnm->api_errno = 0;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- error = set_ip6_link_local_address (vm,
- ntohl (mp->sw_if_index),
- (ip6_address_t *) mp->address,
- mp->address_length);
- if (error)
- {
- clib_error_report (error);
- rv = VNET_API_ERROR_UNSPECIFIED;
- }
- else
- {
- rv = vnm->api_errno;
- }
-
- BAD_SW_IF_INDEX_LABEL;
-
- REPLY_MACRO (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY);
-}
-
-static void
-set_ip6_flow_hash (vl_api_set_ip_flow_hash_t * mp)
-{
- vl_api_set_ip_flow_hash_reply_t *rmp;
- int rv = VNET_API_ERROR_UNIMPLEMENTED;
-
- clib_warning ("unimplemented...");
-
- REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
-}
-
-static void
-set_ip4_flow_hash (vl_api_set_ip_flow_hash_t * mp)
-{
- vl_api_set_ip_flow_hash_reply_t *rmp;
- int rv;
- u32 table_id;
- flow_hash_config_t flow_hash_config = 0;
-
- table_id = ntohl (mp->vrf_id);
-
-#define _(a,b) if (mp->a) flow_hash_config |= b;
- foreach_flow_hash_bit;
-#undef _
-
- rv = vnet_set_ip4_flow_hash (table_id, flow_hash_config);
-
- REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
-}
-
-
-static void
-vl_api_set_ip_flow_hash_t_handler (vl_api_set_ip_flow_hash_t * mp)
-{
- if (mp->is_ipv6 == 0)
- set_ip4_flow_hash (mp);
- else
- set_ip6_flow_hash (mp);
-}
-
-static void vl_api_sw_interface_set_unnumbered_t_handler
- (vl_api_sw_interface_set_unnumbered_t * mp)
-{
- vl_api_sw_interface_set_unnumbered_reply_t *rmp;
- int rv = 0;
- vnet_sw_interface_t *si;
- vnet_main_t *vnm = vnet_get_main ();
- u32 sw_if_index, unnumbered_sw_if_index;
-
- sw_if_index = ntohl (mp->sw_if_index);
- unnumbered_sw_if_index = ntohl (mp->unnumbered_sw_if_index);
-
- /*
- * The API message field names are backwards from
- * the underlying data structure names.
- * It's not worth changing them now.
- */
- if (pool_is_free_index (vnm->interface_main.sw_interfaces,
- unnumbered_sw_if_index))
- {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto done;
- }