From: Russ White Date: Sun, 29 Jul 2018 12:33:43 +0000 (-0400) Subject: Merge pull request #2696 from sworleys/Netlink-Fuzz X-Git-Tag: frr-6.1-dev~121 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=155d6d4415cb9428450fe43ff71d756c47cf5ee0;p=matthieu%2Ffrr.git Merge pull request #2696 from sworleys/Netlink-Fuzz zebra: Add code for fuzzing netlink --- 155d6d4415cb9428450fe43ff71d756c47cf5ee0 diff --cc zebra/kernel_netlink.c index cd881dcc24,bc2ed7f8f4..c627bda4f7 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@@ -636,9 -727,17 +727,17 @@@ int netlink_parse_info(int (*filter)(st zlog_hexdump(buf, status); } + #if defined(HANDLE_NETLINK_FUZZING) + if (!netlink_read) { + zlog_debug("Writing incoming netlink message"); + netlink_write_incoming(buf, status, + netlink_file_counter++); + } + #endif /* HANDLE_NETLINK_FUZZING */ + read_in++; for (h = (struct nlmsghdr *)buf; - NLMSG_OK(h, (unsigned int)status); + (status >= 0 && NLMSG_OK(h, (unsigned int)status)); h = NLMSG_NEXT(h, status)) { /* Finish of reading. */ if (h->nlmsg_type == NLMSG_DONE)