diff options
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip.api | 25 | ||||
-rw-r--r-- | src/vnet/ip/ip_api.c | 94 |
2 files changed, 84 insertions, 35 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api index 8b18c1e764a..0dec7266b42 100644 --- a/src/vnet/ip/ip.api +++ b/src/vnet/ip/ip.api @@ -20,7 +20,7 @@ called through a shared memory interface. */ -option version = "3.0.1"; +option version = "3.0.2"; import "vnet/interface_types.api"; import "vnet/fib/fib_types.api"; @@ -549,6 +549,29 @@ autoreply define sw_interface_ip6_set_link_local_address vl_api_ip6_address_t ip; }; +/** \brief IPv6 get link local address on interface request + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param sw_if_index - interface to set link local on +*/ +define sw_interface_ip6_get_link_local_address +{ + u32 client_index; + u32 context; + vl_api_interface_index_t sw_if_index; +}; + +/** \brief IPv6 link local address detail + @param context - sender context, to match reply w/ request + @param ip - the link local address +*/ +define sw_interface_ip6_get_link_local_address_reply +{ + u32 context; + i32 retval; + vl_api_ip6_address_t ip; +}; + /** \brief IOAM enable : Enable in-band OAM @param id - profile id @param seqno - To enable Seqno Processing diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index 1d0dea86443..228d252534c 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -67,40 +67,42 @@ #include <vnet/format_fns.h> -#define foreach_ip_api_msg \ -_(SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable) \ -_(IP_TABLE_DUMP, ip_table_dump) \ -_(IP_ROUTE_DUMP, ip_route_dump) \ -_(IP_MTABLE_DUMP, ip_mtable_dump) \ -_(IP_MROUTE_DUMP, ip_mroute_dump) \ -_(IP_MROUTE_ADD_DEL, ip_mroute_add_del) \ -_(MFIB_SIGNAL_DUMP, mfib_signal_dump) \ -_(IP_ADDRESS_DUMP, ip_address_dump) \ -_(IP_UNNUMBERED_DUMP, ip_unnumbered_dump) \ -_(IP_DUMP, ip_dump) \ -_(IP_TABLE_REPLACE_BEGIN, ip_table_replace_begin) \ -_(IP_TABLE_REPLACE_END, ip_table_replace_end) \ -_(IP_TABLE_FLUSH, ip_table_flush) \ -_(IP_ROUTE_ADD_DEL, ip_route_add_del) \ -_(IP_ROUTE_LOOKUP, ip_route_lookup) \ -_(IP_TABLE_ADD_DEL, ip_table_add_del) \ -_(IP_PUNT_POLICE, ip_punt_police) \ -_(IP_PUNT_REDIRECT, ip_punt_redirect) \ -_(SET_IP_FLOW_HASH,set_ip_flow_hash) \ -_(IP_CONTAINER_PROXY_ADD_DEL, ip_container_proxy_add_del) \ -_(IP_CONTAINER_PROXY_DUMP, ip_container_proxy_dump) \ -_(IOAM_ENABLE, ioam_enable) \ -_(IOAM_DISABLE, ioam_disable) \ -_(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \ - ip_source_and_port_range_check_add_del) \ -_(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \ - ip_source_and_port_range_check_interface_add_del) \ - _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \ - sw_interface_ip6_set_link_local_address) \ -_(IP_REASSEMBLY_SET, ip_reassembly_set) \ -_(IP_REASSEMBLY_GET, ip_reassembly_get) \ -_(IP_REASSEMBLY_ENABLE_DISABLE, ip_reassembly_enable_disable) \ -_(IP_PUNT_REDIRECT_DUMP, ip_punt_redirect_dump) +#define foreach_ip_api_msg \ + _ (SW_INTERFACE_IP6_ENABLE_DISABLE, sw_interface_ip6_enable_disable) \ + _ (IP_TABLE_DUMP, ip_table_dump) \ + _ (IP_ROUTE_DUMP, ip_route_dump) \ + _ (IP_MTABLE_DUMP, ip_mtable_dump) \ + _ (IP_MROUTE_DUMP, ip_mroute_dump) \ + _ (IP_MROUTE_ADD_DEL, ip_mroute_add_del) \ + _ (MFIB_SIGNAL_DUMP, mfib_signal_dump) \ + _ (IP_ADDRESS_DUMP, ip_address_dump) \ + _ (IP_UNNUMBERED_DUMP, ip_unnumbered_dump) \ + _ (IP_DUMP, ip_dump) \ + _ (IP_TABLE_REPLACE_BEGIN, ip_table_replace_begin) \ + _ (IP_TABLE_REPLACE_END, ip_table_replace_end) \ + _ (IP_TABLE_FLUSH, ip_table_flush) \ + _ (IP_ROUTE_ADD_DEL, ip_route_add_del) \ + _ (IP_ROUTE_LOOKUP, ip_route_lookup) \ + _ (IP_TABLE_ADD_DEL, ip_table_add_del) \ + _ (IP_PUNT_POLICE, ip_punt_police) \ + _ (IP_PUNT_REDIRECT, ip_punt_redirect) \ + _ (SET_IP_FLOW_HASH, set_ip_flow_hash) \ + _ (IP_CONTAINER_PROXY_ADD_DEL, ip_container_proxy_add_del) \ + _ (IP_CONTAINER_PROXY_DUMP, ip_container_proxy_dump) \ + _ (IOAM_ENABLE, ioam_enable) \ + _ (IOAM_DISABLE, ioam_disable) \ + _ (IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \ + ip_source_and_port_range_check_add_del) \ + _ (IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \ + ip_source_and_port_range_check_interface_add_del) \ + _ (SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \ + sw_interface_ip6_set_link_local_address) \ + _ (SW_INTERFACE_IP6_GET_LINK_LOCAL_ADDRESS, \ + sw_interface_ip6_get_link_local_address) \ + _ (IP_REASSEMBLY_SET, ip_reassembly_set) \ + _ (IP_REASSEMBLY_GET, ip_reassembly_get) \ + _ (IP_REASSEMBLY_ENABLE_DISABLE, ip_reassembly_enable_disable) \ + _ (IP_PUNT_REDIRECT_DUMP, ip_punt_redirect_dump) static void vl_api_sw_interface_ip6_enable_disable_t_handler @@ -1364,6 +1366,30 @@ static void } static void +vl_api_sw_interface_ip6_get_link_local_address_t_handler ( + vl_api_sw_interface_ip6_get_link_local_address_t *mp) +{ + vl_api_sw_interface_ip6_get_link_local_address_reply_t *rmp; + const ip6_address_t *ip = NULL; + int rv = 0; + + VALIDATE_SW_IF_INDEX (mp); + + ip = ip6_get_link_local_address (ntohl (mp->sw_if_index)); + if (NULL == ip) + rv = VNET_API_ERROR_IP6_NOT_ENABLED; + + BAD_SW_IF_INDEX_LABEL; + /* clang-format off */ + REPLY_MACRO2 (VL_API_SW_INTERFACE_IP6_GET_LINK_LOCAL_ADDRESS_REPLY, + ({ + if (!rv) + ip6_address_encode (ip, rmp->ip); + })) + /* clang-format on */ +} + +static void vl_api_ip_table_replace_begin_t_handler (vl_api_ip_table_replace_begin_t * mp) { vl_api_ip_table_replace_begin_reply_t *rmp; |