diff options
author | Jon Loeliger <jdl@netgate.com> | 2022-03-02 14:26:56 -0600 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2022-03-21 15:56:36 +0000 |
commit | f47917959872afe2aff464343944bbffee545308 (patch) | |
tree | ab333044516e5c24a828fecffee541176b4c476f /src/plugins/wireguard | |
parent | 17ecd853e9efc40023185ecdf38c37d23dd8a0ce (diff) |
wireguard: improve peer dump details
- Add peer_index, table_id, and keep-alive.
- Fix some lingering cut-n-paste issues in the API file.
Type: improvement
Signed-off-by: Jon Loeliger <jdl@netgate.com>
Change-Id: I6fc0729ba0268bbcda0248f680979c44e68b6b0c
Diffstat (limited to 'src/plugins/wireguard')
-rw-r--r-- | src/plugins/wireguard/wireguard.api | 30 | ||||
-rw-r--r-- | src/plugins/wireguard/wireguard_api.c | 3 |
2 files changed, 22 insertions, 11 deletions
diff --git a/src/plugins/wireguard/wireguard.api b/src/plugins/wireguard/wireguard.api index a95c243e101..d630a2fa841 100644 --- a/src/plugins/wireguard/wireguard.api +++ b/src/plugins/wireguard/wireguard.api @@ -14,7 +14,7 @@ * limitations under the License. */ -option version = "0.2.0"; +option version = "0.3.0"; import "vnet/interface_types.api"; import "vnet/ip/ip_types.api"; @@ -86,17 +86,21 @@ enum wireguard_peer_flags : u8 WIREGUARD_PEER_ESTABLISHED = 0x2, }; -/** \brief Create new peer +/** \brief Peer structure + @param peer_index - peer pool index @param public_key - public key (in binary format) of destination peer @param port - destination port + @param persistent_keepalive - keepalive packet timeout @param table_id - The IP table in which 'endpoint' is reachable @param endpoint - destination ip - @param allowed_ip - allowed incoming ip tunnel - @param tun_sw_if_index - tunnel interface - @param persistent_keepalive - keepalive packet timeout + @param sw_if_index - tunnel SW interface + @param flags - peer status flags + @param n_allowed_ips - number of prefixes in allowed_ips + @param allowed_ips - allowed incoming tunnel prefixes */ typedef wireguard_peer { + u32 peer_index; u8 public_key[32]; u16 port; u16 persistent_keepalive; @@ -154,6 +158,12 @@ define wireguard_peer_add u32 context; vl_api_wireguard_peer_t peer; }; + +/** \brief Create new peer + @param context - sender context, to match reply w/ request + @param retval - return status + @param peer_index - Created or existing peer pool index +*/ define wireguard_peer_add_reply { u32 context; @@ -161,10 +171,10 @@ define wireguard_peer_add_reply u32 peer_index; }; -/** \brief Remove peer by public_key +/** \brief Remove peer @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request - @param public_key + @param peer_index - peer to be removed */ autoreply define wireguard_peer_remove { @@ -184,11 +194,9 @@ define wireguard_peers_dump { u32 peer_index [default=0xFFFFFFFF]; }; -/** \brief Dump peers response +/** \brief Dump peer details @param context - sender context, to match reply w/ request - @param is_dead - is peer valid yet - @param public_key - peer public_key - @param ip4_address - ip4 endpoint address + @param peer - peer details */ define wireguard_peers_details { u32 context; diff --git a/src/plugins/wireguard/wireguard_api.c b/src/plugins/wireguard/wireguard_api.c index fecf93c9290..c5334e0ecd4 100644 --- a/src/plugins/wireguard/wireguard_api.c +++ b/src/plugins/wireguard/wireguard_api.c @@ -228,6 +228,7 @@ wg_api_send_peers_details (index_t peeri, void *data) rmp->_vl_msg_id = htons (VL_API_WIREGUARD_PEERS_DETAILS + wg_main.msg_id_base); + rmp->peer.peer_index = htonl (peeri); rmp->peer.flags = peer->flags; clib_memcpy (rmp->peer.public_key, peer->remote.r_public, NOISE_PUBLIC_KEY_LEN); @@ -236,6 +237,8 @@ wg_api_send_peers_details (index_t peeri, void *data) rmp->peer.port = htons (peer->dst.port); rmp->peer.n_allowed_ips = n_allowed_ips; rmp->peer.sw_if_index = htonl (peer->wg_sw_if_index); + rmp->peer.persistent_keepalive = htons (peer->persistent_keepalive_interval); + rmp->peer.table_id = htonl (peer->table_id); int ii; for (ii = 0; ii < n_allowed_ips; ii++) |