mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
zebra: fix zapi fuzzing infra
Some of this stuff got broken with the introduction of pthreads. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
bf03267495
commit
2875801fa3
15
zebra/main.c
15
zebra/main.c
@ -349,13 +349,6 @@ int main(int argc, char **argv)
|
|||||||
/* For debug purpose. */
|
/* For debug purpose. */
|
||||||
/* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */
|
/* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */
|
||||||
|
|
||||||
#if defined(HANDLE_ZAPI_FUZZING)
|
|
||||||
if (fuzzing) {
|
|
||||||
zserv_read_file(fuzzing);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Process the configuration file. Among other configuration
|
/* Process the configuration file. Among other configuration
|
||||||
* directives we can meet those installing static routes. Such
|
* directives we can meet those installing static routes. Such
|
||||||
* requests will not be executed immediately, but queued in
|
* requests will not be executed immediately, but queued in
|
||||||
@ -391,6 +384,14 @@ int main(int argc, char **argv)
|
|||||||
/* RNH init */
|
/* RNH init */
|
||||||
zebra_rnh_init();
|
zebra_rnh_init();
|
||||||
|
|
||||||
|
#if defined(HANDLE_ZAPI_FUZZING)
|
||||||
|
if (fuzzing) {
|
||||||
|
zserv_read_file(fuzzing);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
frr_run(zebrad.master);
|
frr_run(zebrad.master);
|
||||||
|
|
||||||
/* Not reached... */
|
/* Not reached... */
|
||||||
|
@ -640,7 +640,7 @@ static int zserv_handle_client_close(struct thread *thread)
|
|||||||
* sock
|
* sock
|
||||||
* client's socket file descriptor
|
* client's socket file descriptor
|
||||||
*/
|
*/
|
||||||
static void zserv_client_create(int sock)
|
static struct zserv *zserv_client_create(int sock)
|
||||||
{
|
{
|
||||||
struct zserv *client;
|
struct zserv *client;
|
||||||
int i;
|
int i;
|
||||||
@ -696,6 +696,8 @@ static void zserv_client_create(int sock)
|
|||||||
|
|
||||||
/* start pthread */
|
/* start pthread */
|
||||||
frr_pthread_run(client->pthread, NULL);
|
frr_pthread_run(client->pthread, NULL);
|
||||||
|
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1025,20 +1027,10 @@ void zserv_read_file(char *input)
|
|||||||
struct zserv *client = NULL;
|
struct zserv *client = NULL;
|
||||||
struct thread t;
|
struct thread t;
|
||||||
|
|
||||||
zserv_client_create(-1);
|
|
||||||
|
|
||||||
frr_pthread_stop(client->pthread, NULL);
|
|
||||||
frr_pthread_destroy(client->pthread);
|
|
||||||
client->pthread = NULL;
|
|
||||||
|
|
||||||
t.arg = client;
|
|
||||||
|
|
||||||
fd = open(input, O_RDONLY | O_NONBLOCK);
|
fd = open(input, O_RDONLY | O_NONBLOCK);
|
||||||
t.u.fd = fd;
|
t.u.fd = fd;
|
||||||
|
|
||||||
zserv_read(&t);
|
zserv_client_create(fd);
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user