Nan Zhou | 14fe669 | 2021-06-08 16:35:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2021 Google LLC |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_ |
| 18 | #define PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_ |
| 19 | // |
| 20 | // Nemora dedicated port. Filtered by NIC. |
| 21 | #define DEFAULT_ADDRESSES_RX_PORT 3959 |
| 22 | |
| 23 | // NOTE: All the IPv4 addresses used in this file will be represented in the |
| 24 | // CPU order and therefore must *not* be used to initialize LWIP |
| 25 | // ip_addr types, unless the HTONL macro is used. |
| 26 | // |
| 27 | // Example: Given Nemora UDP collector VIP 172.20.0.197, the |
| 28 | // DEFAULT_ADDRESSES_TARGET_IP macro expands to the 32-bit number 0xAC1408C5 |
| 29 | // (to help the reader: 172 is 0xAC), but with our little endian CPU that |
| 30 | // 32-bit number is represented in memory as: |
| 31 | // 0xC5 @ offset 0, 0x08 @ offset 1, 0x14 @ offset 2, 0xAC @ offset 3 |
| 32 | // Since LWIP uses network order, a correct initialization requires: |
| 33 | // ip_addr collector = { .addr = HTONL(DEFAULT_ADDRESSES_TARGET_IP) }; |
| 34 | // |
| 35 | #ifdef USE_LAB_UDP_DEST |
| 36 | // Currently targets the lab installer fdcorp1.mtv |
| 37 | #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (18 << 16) | (107 << 8) | 1) |
| 38 | #define DEFAULT_ADDRESSES_TARGET_PORT 50201 |
| 39 | #else |
| 40 | // DEFAULT : Point to production Nemora collector (via anycast VIP). |
| 41 | #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (20 << 16) | (0 << 8) | 197) |
| 42 | #define DEFAULT_ADDRESSES_TARGET_PORT 3960 |
| 43 | #endif |
| 44 | |
| 45 | // 2001:4860:f802::c5 |
| 46 | #define DEFAULT_ADDRESSES_TARGET_IP6 \ |
| 47 | { \ |
| 48 | 0x20014860, 0xf8020000, 0, 0xc5 \ |
| 49 | } |
| 50 | |
| 51 | #ifdef NETWORK_UNITTEST |
| 52 | #define DEFAULT_ADDRESSES_GATEWAY ((172 << 24) | (23 << 16) | (130 << 8) | 190) |
| 53 | #define DEFAULT_ADDRESSES_NETMASK ((255 << 24) | (255 << 16) | (255 << 8) | 192) |
| 54 | #define DEFAULT_ADDRESSES_LOCAL_IP ((172 << 24) | (23 << 16) | (130 << 8) | 141) |
| 55 | #define DEFAULT_ADDRESSES_MAC \ |
| 56 | { \ |
| 57 | 0x00, 0x1a, 0x11, 0x30, 0xc9, 0x6f \ |
| 58 | } |
| 59 | #define DEFAULT_ADDRESSES_GATEWAY6 \ |
| 60 | { \ |
| 61 | 0, 0, 0, 0 \ |
| 62 | } |
| 63 | #define DEFAULT_ADDRESSES_GATEWAY6_MAC \ |
| 64 | { \ |
| 65 | 0, 0, 0, 0, 0, 0 \ |
| 66 | } |
| 67 | #else |
| 68 | #define DEFAULT_ADDRESSES_GATEWAY 0 |
| 69 | #define DEFAULT_ADDRESSES_NETMASK 0 |
| 70 | #define DEFAULT_ADDRESSES_LOCAL_IP 0 |
| 71 | #define DEFAULT_ADDRESSES_MAC \ |
| 72 | { \ |
| 73 | 0, 0, 0, 0, 0, 0 \ |
| 74 | } |
| 75 | // fe80::1 -- as of 2016-10-13 this is guaranteed to be the GW in prod. |
| 76 | #define DEFAULT_ADDRESSES_GATEWAY6 \ |
| 77 | { \ |
| 78 | 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 \ |
| 79 | } |
| 80 | // 02:32:00:00:00:00 -- as of 2016-10-13 this is guaranteed to be the |
| 81 | // GW MAC addr in prod. |
| 82 | #define DEFAULT_ADDRESSES_GATEWAY6_MAC \ |
| 83 | { \ |
| 84 | 0x02, 0x32, 0, 0, 0, 0 \ |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | #endif // PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_ |