xref: /openbmc/google-misc/subprojects/nemora-postd/src/default_addresses.h (revision c66ebc35bf44912992e18de47198ba98a9a34b97)
114fe6698SNan Zhou /*
214fe6698SNan Zhou  * Copyright 2021 Google LLC
314fe6698SNan Zhou  *
414fe6698SNan Zhou  * Licensed under the Apache License, Version 2.0 (the "License");
514fe6698SNan Zhou  * you may not use this file except in compliance with the License.
614fe6698SNan Zhou  * You may obtain a copy of the License at
714fe6698SNan Zhou  *
814fe6698SNan Zhou  *      http://www.apache.org/licenses/LICENSE-2.0
914fe6698SNan Zhou  *
1014fe6698SNan Zhou  * Unless required by applicable law or agreed to in writing, software
1114fe6698SNan Zhou  * distributed under the License is distributed on an "AS IS" BASIS,
1214fe6698SNan Zhou  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314fe6698SNan Zhou  * See the License for the specific language governing permissions and
1414fe6698SNan Zhou  * limitations under the License.
1514fe6698SNan Zhou  */
1614fe6698SNan Zhou 
1714fe6698SNan Zhou #ifndef PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
1814fe6698SNan Zhou #define PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
1914fe6698SNan Zhou //
2014fe6698SNan Zhou // Nemora dedicated port. Filtered by NIC.
2114fe6698SNan Zhou #define DEFAULT_ADDRESSES_RX_PORT 3959
2214fe6698SNan Zhou 
2314fe6698SNan Zhou // NOTE: All the IPv4 addresses used in this file will be represented in the
2414fe6698SNan Zhou //       CPU order and therefore must *not* be used to initialize LWIP
2514fe6698SNan Zhou //       ip_addr types, unless the HTONL macro is used.
2614fe6698SNan Zhou //
2714fe6698SNan Zhou // Example: Given Nemora UDP collector VIP 172.20.0.197, the
2814fe6698SNan Zhou //   DEFAULT_ADDRESSES_TARGET_IP macro expands to the 32-bit number 0xAC1408C5
2914fe6698SNan Zhou //  (to help the reader: 172 is 0xAC), but with our little endian CPU that
3014fe6698SNan Zhou //  32-bit number is represented in memory as:
3114fe6698SNan Zhou //  0xC5 @ offset 0, 0x08 @ offset 1, 0x14 @ offset 2, 0xAC @ offset 3
3214fe6698SNan Zhou //  Since LWIP uses network order, a correct initialization requires:
3314fe6698SNan Zhou //  ip_addr collector = { .addr = HTONL(DEFAULT_ADDRESSES_TARGET_IP) };
3414fe6698SNan Zhou //
3514fe6698SNan Zhou #ifdef USE_LAB_UDP_DEST
3614fe6698SNan Zhou // Currently targets the lab installer fdcorp1.mtv
3714fe6698SNan Zhou #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (18 << 16) | (107 << 8) | 1)
3814fe6698SNan Zhou #define DEFAULT_ADDRESSES_TARGET_PORT 50201
3914fe6698SNan Zhou #else
4014fe6698SNan Zhou // DEFAULT : Point to production Nemora collector (via anycast VIP).
4114fe6698SNan Zhou #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (20 << 16) | (0 << 8) | 197)
4214fe6698SNan Zhou #define DEFAULT_ADDRESSES_TARGET_PORT 3960
4314fe6698SNan Zhou #endif
4414fe6698SNan Zhou 
4514fe6698SNan Zhou // 2001:4860:f802::c5
46*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_TARGET_IP6 {0x20014860, 0xf8020000, 0, 0xc5}
4714fe6698SNan Zhou 
4814fe6698SNan Zhou #ifdef NETWORK_UNITTEST
4914fe6698SNan Zhou #define DEFAULT_ADDRESSES_GATEWAY ((172 << 24) | (23 << 16) | (130 << 8) | 190)
5014fe6698SNan Zhou #define DEFAULT_ADDRESSES_NETMASK ((255 << 24) | (255 << 16) | (255 << 8) | 192)
5114fe6698SNan Zhou #define DEFAULT_ADDRESSES_LOCAL_IP ((172 << 24) | (23 << 16) | (130 << 8) | 141)
52*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_MAC {0x00, 0x1a, 0x11, 0x30, 0xc9, 0x6f}
53*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_GATEWAY6 {0, 0, 0, 0}
54*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_GATEWAY6_MAC {0, 0, 0, 0, 0, 0}
5514fe6698SNan Zhou #else
5614fe6698SNan Zhou #define DEFAULT_ADDRESSES_GATEWAY 0
5714fe6698SNan Zhou #define DEFAULT_ADDRESSES_NETMASK 0
5814fe6698SNan Zhou #define DEFAULT_ADDRESSES_LOCAL_IP 0
59*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_MAC {0, 0, 0, 0, 0, 0}
6014fe6698SNan Zhou // fe80::1 -- as of 2016-10-13 this is guaranteed to be the GW in prod.
6114fe6698SNan Zhou #define DEFAULT_ADDRESSES_GATEWAY6                                             \
62*c66ebc35SPatrick Williams     {0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
6314fe6698SNan Zhou // 02:32:00:00:00:00 -- as of 2016-10-13 this is guaranteed to be the
6414fe6698SNan Zhou // GW MAC addr in prod.
65*c66ebc35SPatrick Williams #define DEFAULT_ADDRESSES_GATEWAY6_MAC {0x02, 0x32, 0, 0, 0, 0}
6614fe6698SNan Zhou #endif
6714fe6698SNan Zhou 
6814fe6698SNan Zhou #endif // PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
69