[fuzz] enable Thread protocols and set state to Leader (#2067)

This commit:

- Enables Thread-related protocols and sets the device role state to Leader
  in fuzz tests.

- Bypasses AES-CCM decryption and authentication in fuzz tests.
This commit is contained in:
Jonathan Hui
2017-08-04 16:06:59 -07:00
committed by GitHub
parent 97e957b14a
commit 71d40a5c83
3 changed files with 20 additions and 6 deletions
+8 -3
View File
@@ -33,6 +33,7 @@
#include <openthread/link.h>
#include <openthread/message.h>
#include <openthread/thread.h>
#include <openthread/thread_ftd.h>
#include <openthread/types.h>
#include "common/code_utils.hpp"
@@ -41,12 +42,16 @@ static otInstance *sInstance;
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
{
(void)argc;
(void)argv;
const otPanId panId = 0xdead;
sInstance = otInstanceInitSingle();
otLinkSetPanId(sInstance, (otPanId)0xdead);
otLinkSetPanId(sInstance, panId);
otIp6SetEnabled(sInstance, true);
otThreadSetEnabled(sInstance, true);
otThreadBecomeLeader(sInstance);
(void)argc;
(void)argv;
return 0;
}