Hugo Benichi | 1661ca0 | 2019-10-16 15:36:13 +0900 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame^] | 5 | #include "patchpanel/multicast_forwarder.h" |
| 6 | #include "patchpanel/net_util.h" |
Hugo Benichi | 1661ca0 | 2019-10-16 15:36:13 +0900 | [diff] [blame] | 7 | |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame^] | 8 | namespace patchpanel { |
Hugo Benichi | 1661ca0 | 2019-10-16 15:36:13 +0900 | [diff] [blame] | 9 | |
| 10 | constexpr const struct in_addr kLanIp = {.s_addr = Ipv4Addr(192, 168, 1, 1)}; |
| 11 | constexpr const struct in_addr kGuestIp = {.s_addr = Ipv4Addr(100, 115, 92, 2)}; |
| 12 | |
| 13 | namespace { |
| 14 | |
| 15 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 16 | // Turn off logging. |
| 17 | logging::SetMinLogLevel(logging::LOG_FATAL); |
| 18 | |
| 19 | // Copy the input data so that TranslateMdnsIp can mutate it. |
| 20 | char* payload = new char[size]; |
| 21 | memcpy(payload, data, size); |
| 22 | |
| 23 | MulticastForwarder::TranslateMdnsIp(kLanIp, kGuestIp, payload, size); |
| 24 | |
| 25 | delete[] payload; |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | } // namespace |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame^] | 30 | } // namespace patchpanel |