fix no net compilation on zephyr (#19399)

Co-authored-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
This commit is contained in:
Jaremy Creechley 2022-01-17 04:02:31 -08:00 • committed by GitHub
commit dc8ac66873
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,11 +399,15 @@ elif defined(zephyr):
const Sockaddr_max_length* = 24 const Sockaddr_max_length* = 24
elif defined(net_raw): elif defined(net_raw):
const Sockaddr_max_length* = 20 const Sockaddr_max_length* = 20
else: elif defined(net_ipv4):
const Sockaddr_max_length* = 8 const Sockaddr_max_length* = 8
else:
const Sockaddr_max_length* = 255 # just for compilation purposes
const Sockaddr_un_path_length* = Sockaddr_max_length const Sockaddr_un_path_length* = Sockaddr_max_length
# Zephyr is heavily customizable so it's easy to get to a state # Zephyr is heavily customizable so it's easy to get to a state
# where Nim & Zephyr IPv6 settings are out of sync, causing painful runtime failures. # where Nim & Zephyr IPv6 settings are out of sync, causing painful runtime failures.
when defined(net_ipv4) or defined(net_ipv6) or defined(net_raw):
{.emit: ["NIM_STATIC_ASSERT(NET_SOCKADDR_MAX_SIZE == ", {.emit: ["NIM_STATIC_ASSERT(NET_SOCKADDR_MAX_SIZE == ",
Sockaddr_max_length, Sockaddr_max_length,
",\"NET_SOCKADDR_MAX_SIZE and Sockaddr_max_length size mismatch!", ",\"NET_SOCKADDR_MAX_SIZE and Sockaddr_max_length size mismatch!",