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