diff options
author | Alexander Chernavin <achernavin@netgate.com> | 2023-02-02 14:22:56 +0000 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2023-02-08 03:20:32 +0000 |
commit | 3b28fd730625a475a4093bec3e2ed9b1b6932131 (patch) | |
tree | 5afc537c75cde2bddc45981a0ab01be0a3095fdf /src/vnet/ip6-nd/ip6_nd_test.c | |
parent | 02dfd296342525a0802132d85d0ea51da841e5ce (diff) |
ip6-nd: support dump/details for IPv6 RA
Type: improvement
With this change, add support for dumping IPv6 Router Advertisements
details on a per-interface basis (or all). Also, cover that with a test.
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: I89fa93439d33cc36252377f27187b18b3d30a1d4
Diffstat (limited to 'src/vnet/ip6-nd/ip6_nd_test.c')
-rw-r--r-- | src/vnet/ip6-nd/ip6_nd_test.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/vnet/ip6-nd/ip6_nd_test.c b/src/vnet/ip6-nd/ip6_nd_test.c index 933029d7593..488ca591ba0 100644 --- a/src/vnet/ip6-nd/ip6_nd_test.c +++ b/src/vnet/ip6-nd/ip6_nd_test.c @@ -325,6 +325,63 @@ api_ip6nd_proxy_enable_disable (vat_main_t *vam) return -1; } +static int +api_sw_interface_ip6nd_ra_dump (vat_main_t *vam) +{ + unformat_input_t *i = vam->input; + vl_api_sw_interface_ip6nd_ra_dump_t *mp; + vl_api_control_ping_t *mp_ping; + u32 sw_if_index = ~0; + int ret; + + /* Parse args required to build the message */ + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index)) + ; + else if (unformat (i, "sw_if_index %u", &sw_if_index)) + ; + else + { + clib_warning ("parse error '%U'", format_unformat_error, i); + return -99; + } + } + + /* Construct the API message */ + M (SW_INTERFACE_IP6ND_RA_DUMP, mp); + mp->sw_if_index = ntohl (sw_if_index); + + /* Send it */ + S (mp); + + /* Use control ping for synchronization */ + PING (&ip6_nd_test_main, mp_ping); + S (mp_ping); + + /* Wait for a reply... */ + W (ret); + + return ret; +} + +static void +vl_api_sw_interface_ip6nd_ra_details_t_handler ( + vl_api_sw_interface_ip6nd_ra_details_t *mp) +{ + vat_main_t *vam = ip6_nd_test_main.vat_main; + u32 sw_if_index; + u8 send_radv; + + /* Read the message */ + sw_if_index = ntohl (mp->sw_if_index); + send_radv = mp->send_radv; + + /* Print it */ + print (vam->ofp, "sw_if_index: %u, send_radv: %s", sw_if_index, + (send_radv ? "on" : "off")); +} + #include <ip6-nd/ip6_nd.api_test.c> /* |