Taoyu Li | 906553a | 2019-10-18 13:44:41 +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/ndproxy.h" |
Taoyu Li | 906553a | 2019-10-18 13:44:41 +0900 | [diff] [blame] | 6 | |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame] | 7 | namespace patchpanel { |
Taoyu Li | 906553a | 2019-10-18 13:44:41 +0900 | [diff] [blame] | 8 | |
| 9 | namespace { |
| 10 | |
Taoyu Li | e47df4a | 2019-11-08 12:48:57 +0900 | [diff] [blame] | 11 | constexpr MacAddress guest_if_mac({0xd2, 0x47, 0xf7, 0xc5, 0x9e, 0x53}); |
Taoyu Li | 906553a | 2019-10-18 13:44:41 +0900 | [diff] [blame] | 12 | |
| 13 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 14 | // Turn off logging. |
| 15 | logging::SetMinLogLevel(logging::LOG_FATAL); |
| 16 | |
Taoyu Li | 18041fe | 2019-11-13 15:49:31 +0900 | [diff] [blame] | 17 | uint8_t* out_buffer_extended = new uint8_t[size + 4]; |
| 18 | uint8_t* out_buffer = NDProxy::AlignFrameBuffer(out_buffer_extended); |
Taoyu Li | e47df4a | 2019-11-08 12:48:57 +0900 | [diff] [blame] | 19 | NDProxy ndproxy; |
| 20 | ndproxy.Init(); |
| 21 | ndproxy.TranslateNDFrame(data, size, guest_if_mac, out_buffer); |
Taoyu Li | 18041fe | 2019-11-13 15:49:31 +0900 | [diff] [blame] | 22 | delete[] out_buffer_extended; |
Taoyu Li | 906553a | 2019-10-18 13:44:41 +0900 | [diff] [blame] | 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | } // namespace |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame] | 28 | } // namespace patchpanel |