mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 06:14:35 +00:00
zebra: filter zebra messages (label manager)
This change makes the zebra acting as label manager proxy not to relay non-LM messages to clients that a zebra acting in non-proxy mode may send to it. Also, the existing code does not schedule a rcv in case of relay_response_back returns -1. This patch re-schedules reads on the socket even in case such a function returns -1 by calling thread_add_read(). Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
parent
f533be73f6
commit
61eefcadc7
@ -88,7 +88,23 @@ static int relay_response_back(void)
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
zlog_debug("Label Manager response received, %d bytes", size);
|
||||
|
||||
/* do not relay a msg that has nothing to do with LM */
|
||||
switch (resp_cmd) {
|
||||
case ZEBRA_LABEL_MANAGER_CONNECT:
|
||||
case ZEBRA_LABEL_MANAGER_CONNECT_ASYNC: /* should not be seen */
|
||||
case ZEBRA_GET_LABEL_CHUNK:
|
||||
case ZEBRA_RELEASE_LABEL_CHUNK:
|
||||
break;
|
||||
default:
|
||||
zlog_debug("Not relaying '%s' response (size %d) from LM",
|
||||
zserv_command_string(resp_cmd), size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
zlog_debug("Received '%s' response (size %d) from LM",
|
||||
zserv_command_string(resp_cmd), size);
|
||||
|
||||
if (size == 0)
|
||||
return -1;
|
||||
|
||||
@ -139,6 +155,11 @@ static int lm_zclient_read(struct thread *t)
|
||||
/* read response and send it back */
|
||||
ret = relay_response_back();
|
||||
|
||||
/* on error, schedule another read */
|
||||
if (ret == -1)
|
||||
if (!zclient->t_read)
|
||||
thread_add_read(zclient->master, lm_zclient_read, NULL,
|
||||
zclient->sock, &zclient->t_read);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user