summaryrefslogtreecommitdiffstats
path: root/zebra/kernel_netlink.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2018-07-26 20:30:04 +0200
committerStephen Worley <sworley@cumulusnetworks.com>2018-07-26 20:32:50 +0200
commitef593eff0084285280e754c4866eb1bec1e67008 (patch)
tree45cbbca87c2da3d56333263ff59d1282a69f3728 /zebra/kernel_netlink.c
parentRefactor code for new fuzzing netlink flag (diff)
downloadfrr-ef593eff0084285280e754c4866eb1bec1e67008.tar.xz
frr-ef593eff0084285280e754c4866eb1bec1e67008.zip
zebra: Make fuzzer code use default netlink socket
Change the fuzzing code so that it fakes data from the listening socket rather than using its own pseudo one. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'zebra/kernel_netlink.c')
-rw-r--r--zebra/kernel_netlink.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 4d1991f09..483aab027 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -318,16 +318,9 @@ void netlink_read_init(const char *fname)
{
snprintf(netlink_fuzz_file, MAXPATHLEN, "%s", fname);
/* Creating this fake socket for testing purposes */
- struct zebra_ns zns = {
- .ns_id = 0,
- .netlink_cmd = {.sock = -1,
- .seq = -1,
- .name = "fuzzer_command_channel"},
- .netlink = {.sock = -1,
- .seq = -1,
- .name = "fuzzer_kernel_message"}
- };
- netlink_parse_info(netlink_information_fetch, &zns.netlink, &zns, 1, 0);
+ struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT);
+
+ netlink_parse_info(netlink_information_fetch, &zns->netlink, zns, 1, 0);
}
/**
@@ -371,7 +364,7 @@ static long netlink_read_file(char *buf, const char *fname)
fseek(f, 0, SEEK_END);
file_bytes = ftell(f);
rewind(f);
- fread(buf, file_bytes, 1, f);
+ fread(buf, NL_RCV_PKT_BUF_SIZE, 1, f);
fclose(f);
}
zserv_privs.change(ZPRIVS_LOWER);