This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 68c6b90942c1849aaea46da3d90828a1868988ae
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 27 23:17:20 2026 +0100

    include/netinet/in.h: Add IN_LOOPBACKNET, IN_EXPERIMENTAL() and 
IN_BADCLASS().
    
    <netinet/in.h> had the classful address macros of 4.4BSD but not these
    three.  glibc, musl and the BSDs have them, and programs use them
    (openssh's sshconnect.c tests for IN_LOOPBACKNET).
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/netinet/in.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/netinet/in.h b/include/netinet/in.h
index 927a022d9c2..a2fb86f7214 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -153,6 +153,8 @@
 #define IN_CLASSA_HOST        (0xffffffff & ~IN_CLASSA_NET)
 #define IN_CLASSA_MAX         128
 
+#define IN_LOOPBACKNET        127  /* The loopback network, 127/8 */
+
 #define IN_CLASSB(a)          ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
 #define IN_CLASSB_NET         0xffff0000
 #define IN_CLASSB_NSHIFT      16
@@ -169,6 +171,11 @@
 #define IN_CLASSD(i)          (((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
 #define IN_MULTICAST(i)       IN_CLASSD(i)
 
+/* Experimental (224/3) and reserved (240/4) addresses, as in glibc */
+
+#define IN_EXPERIMENTAL(a)    (((in_addr_t)(a) & 0xe0000000) == 0xe0000000)
+#define IN_BADCLASS(a)        (((in_addr_t)(a) & 0xf0000000) == 0xf0000000)
+
 /* Special values of in_addr_t */
 
 #define INADDR_ANY            ((in_addr_t)0x00000000) /* Address to accept any

Reply via email to