diff options
author | Hiroki Shirokura <slank.dev@gmail.com> | 2021-03-22 02:45:33 +0100 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2021-06-02 16:24:48 +0200 |
commit | a9510347aa9126fbbca09679a170b10c63ef851c (patch) | |
tree | d5e1696cd76f2e0c2ed0e5c8f2e7a9014a836895 | |
parent | lib: erase wrong comments by copy-paste (diff) | |
download | frr-a9510347aa9126fbbca09679a170b10c63ef851c.tar.xz frr-a9510347aa9126fbbca09679a170b10c63ef851c.zip |
zebra: delete unneeded zebra_srv6_manager_connect
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
-rw-r--r-- | lib/zclient.c | 83 | ||||
-rw-r--r-- | lib/zclient.h | 2 | ||||
-rw-r--r-- | zebra/zapi_msg.c | 68 |
3 files changed, 0 insertions, 153 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 270f780ed..de3aed46e 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2738,89 +2738,6 @@ stream_failure: } /** - * Connect to srv6 manager in a syncronous way - * - * It first writes the request to zcient output buffer and then - * immediately reads the answer from the input buffer. - * - * @param zclient Zclient used to connect to srv6 manager (zebra) - * @result Result of response - */ -int srv6_manager_connect(struct zclient *zclient) -{ - struct stream *s; - int ret, result = 0; - uint16_t cmd = ZEBRA_SRV6_MANAGER_CONNECT; - - if (zclient_debug) - zlog_debug("Connecting to SRv6 Manager"); - - if (zclient->sock < 0) { - zlog_debug("%s: invalid zclient socket", __func__); - return -1; - } - - /* send request */ - s = zclient->obuf; - stream_reset(s); - zclient_create_header(s, cmd, VRF_DEFAULT); - - stream_putc(s, zclient->redist_default); /* proto */ - stream_putw(s, zclient->instance); /* instance */ - stream_putw_at(s, 0, stream_get_endp(s)); - ret = writen(zclient->sock, s->data, stream_get_endp(s)); - if (ret < 0) { - flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock"); - close(zclient->sock); - zclient->sock = -1; - return -1; - } - if (ret == 0) { - flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed"); - close(zclient->sock); - zclient->sock = -1; - return -1; - } - if (zclient_debug) - zlog_debug("SRv6 Manager connect request sent (%d bytes)", ret); - - /* read response */ - if (zclient_read_sync_response(zclient, cmd) != 0) - return -1; - - s = zclient->ibuf; - - /* read instance and proto */ - uint8_t proto; - uint16_t instance; - - STREAM_GETC(s, proto); - STREAM_GETW(s, instance); - - /* sanity */ - if (proto != zclient->redist_default) - flog_err( - EC_LIB_ZAPI_ENCODE, - "Wrong proto (%u) in SRv6 Manager connect response. Should be %u", - proto, zclient->redist_default); - if (instance != zclient->instance) - flog_err( - EC_LIB_ZAPI_ENCODE, - "Wrong instId (%u) in SRv6 Manager connect response. Should be %u", - instance, zclient->instance); - - /* result code */ - STREAM_GETC(s, result); - if (zclient_debug) - zlog_debug("SRv6 Manager connect-response received, result %u", result); - - return (int)result; - -stream_failure: - return -1; -} - -/** * Function to request a srv6-locator chunk in an Asyncronous way * * @param zclient Zclient used to connect to table manager (zebra) diff --git a/lib/zclient.h b/lib/zclient.h index d9ca6a859..c41d25133 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -219,7 +219,6 @@ typedef enum { ZEBRA_EVPN_REMOTE_NH_DEL, ZEBRA_SRV6_LOCATOR_ADD, ZEBRA_SRV6_LOCATOR_DELETE, - ZEBRA_SRV6_MANAGER_CONNECT, ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK, ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK, ZEBRA_ERROR, @@ -1070,7 +1069,6 @@ extern int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size, uint32_t *start, uint32_t *end); extern int tm_release_table_chunk(struct zclient *zclient, uint32_t start, uint32_t end); -extern int srv6_manager_connect(struct zclient *zclient); extern int srv6_manager_get_locator_chunk(struct zclient *zclient, const char *locator_name); extern int srv6_manager_release_locator_chunk(struct zclient *zclient, diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 4331487b8..4f6663fe2 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1137,29 +1137,6 @@ static int zsend_table_manager_connect_response(struct zserv *client, return zserv_send_message(client, s); } -static int zsend_srv6_manager_connect_response(struct zserv *client, - vrf_id_t vrf_id, - uint16_t result) -{ - struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); - - zclient_create_header(s, ZEBRA_SRV6_MANAGER_CONNECT, vrf_id); - - /* proto */ - stream_putc(s, client->proto); - - /* instance */ - stream_putw(s, client->instance); - - /* result */ - stream_putc(s, result); - - /* Write packet size. */ - stream_putw_at(s, 0, stream_get_endp(s)); - - return zserv_send_message(client, s); -} - /* Inbound message handling ------------------------------------------------ */ const int cmd2type[] = { @@ -2656,47 +2633,6 @@ int zsend_client_close_notify(struct zserv *client, struct zserv *closed_client) return zserv_send_message(client, s); } -/* Send response to a srv6 manager connect request to client */ -static void zread_srv6_manager_connect(struct zserv *client, - struct stream *msg, vrf_id_t vrf_id) -{ - struct stream *s; - uint8_t proto; - uint16_t instance; - struct vrf *vrf = vrf_lookup_by_id(vrf_id); - - s = msg; - - /* Get data. */ - STREAM_GETC(s, proto); - STREAM_GETW(s, instance); - - /* accept only dynamic routing protocols */ - if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) { - flog_err(EC_ZEBRA_TM_WRONG_PROTO, - "client %d has wrong protocol %s", client->sock, - zebra_route_string(proto)); - zsend_srv6_manager_connect_response(client, vrf_id, 1); - return; - } - zlog_notice("client %d with vrf %s(%u) instance %u connected as %s", - client->sock, VRF_LOGNAME(vrf), vrf_id, instance, - zebra_route_string(proto)); - client->proto = proto; - client->instance = instance; - - /* - * Release previous locators of same protocol and instance. - * This is done in case it restarted from an unexpected shutdown. - */ - release_daemon_srv6_locator_chunks(client); - - zsend_srv6_manager_connect_response(client, vrf_id, 0); - -stream_failure: - return; -} - int zsend_srv6_manager_get_locator_chunk_response(struct zserv *client, vrf_id_t vrf_id, struct srv6_locator *loc) @@ -2983,9 +2919,6 @@ stream_failure: static void zread_srv6_manager_request(ZAPI_HANDLER_ARGS) { switch (hdr->command) { - case ZEBRA_SRV6_MANAGER_CONNECT: - zread_srv6_manager_connect(client, msg, zvrf_id(zvrf)); - break; case ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK: zread_srv6_manager_get_locator_chunk(client, msg, zvrf_id(zvrf)); @@ -3759,7 +3692,6 @@ void (*const zserv_handlers[])(ZAPI_HANDLER_ARGS) = { [ZEBRA_MLAG_CLIENT_REGISTER] = zebra_mlag_client_register, [ZEBRA_MLAG_CLIENT_UNREGISTER] = zebra_mlag_client_unregister, [ZEBRA_MLAG_FORWARD_MSG] = zebra_mlag_forward_client_msg, - [ZEBRA_SRV6_MANAGER_CONNECT] = zread_srv6_manager_request, [ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK] = zread_srv6_manager_request, [ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK] = zread_srv6_manager_request, [ZEBRA_CLIENT_CAPABILITIES] = zread_client_capabilities, |