You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add missing IN_CLASSA_NSHIFT and related macros to <netinet/in.h> #8
Newlib's <netinet/in.h>\ is missing several BSD/glibc IPv4 address classification macros that are commonly expected by portable networking code:
\IN_CLASSA_NSHIFT\ (should be \24)
\IN_MULTICAST(i)\ (should be (((i) & 0xf0000000U) == 0xe0000000U))
\IN_EXPERIMENTAL(i)\ (should be (((i) & 0xe0000000U) == 0xe0000000U))
\IN_LOOPBACKNET\ (should be \127)
Context
CPython's \Modules/getaddrinfo.c\ (the fallback \getaddrinfo\ implementation) uses these macros to classify numeric IPv4 addresses — for example, to skip reverse-DNS (canonical name) lookups on loopback (\127.x.x.x) and multicast addresses. The file already carries #ifndef\ guards that define fallback values when the system headers omit them, so the CPython build is unaffected. However, it would be cleaner if these macros lived in the proper system header.
These macros are defined in glibc's <netinet/in.h>\ and in most BSD <netinet/in.h>\ variants. Adding them to Nanvix's Newlib fork would improve POSIX networking compatibility and reduce the need for downstream workarounds.
Suggested location
ewlib/libc/sys/nanvix/include/netinet/in.h\ (or whichever header currently defines \struct in_addr, \INADDR_ANY, etc.)
Activity