1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stddef.h>
6 #include <stdint.h>
7
8 #include "base/functional/callback_helpers.h"
9 #include "net/base/address_tracker_linux.h"
10
11 using net::internal::AddressTrackerLinux;
12
13 namespace net::test {
14
15 class AddressTrackerLinuxTest {
16 public:
TestHandleMessage(const char * buffer,size_t length)17 static void TestHandleMessage(const char* buffer, size_t length) {
18 std::unordered_set<std::string> ignored_interfaces;
19 AddressTrackerLinux tracker(base::DoNothing(), base::DoNothing(),
20 base::DoNothing(), ignored_interfaces);
21 bool address_changed, link_changed, tunnel_changed;
22 tracker.HandleMessage(buffer, length, &address_changed, &link_changed,
23 &tunnel_changed);
24 }
25 };
26
27 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
29 if (size == 0)
30 return 0;
31 AddressTrackerLinuxTest::TestHandleMessage(
32 reinterpret_cast<const char*>(data), size);
33 return 0;
34 }
35
36 } // namespace net::test
37