Skip to content

Conversation

@c8ef
Copy link
Contributor

@c8ef c8ef commented Dec 16, 2025

No description provided.

Copy link
Contributor Author

c8ef commented Dec 16, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@c8ef c8ef marked this pull request as ready for review December 16, 2025 15:12
@llvmbot llvmbot added the libc label Dec 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2025

@llvm/pr-subscribers-libc

Author: Connector Switch (c8ef)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/172498.diff

2 Files Affected:

  • (modified) libc/include/llvm-libc-macros/netinet-in-macros.h (+3)
  • (modified) libc/test/include/netinet_in_test.cpp (+5)
diff --git a/libc/include/llvm-libc-macros/netinet-in-macros.h b/libc/include/llvm-libc-macros/netinet-in-macros.h
index 3148aed6bb112..863ff8759e446 100644
--- a/libc/include/llvm-libc-macros/netinet-in-macros.h
+++ b/libc/include/llvm-libc-macros/netinet-in-macros.h
@@ -53,6 +53,9 @@
    (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[14]) == 0 &&              \
    (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[15]) == 1)
 
+#define IN6_IS_ADDR_MULTICAST(a)                                               \
+  (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[0]) == 0xff
+
 #define IN6_IS_ADDR_LINKLOCAL(a)                                               \
   ((__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[0]) == 0xfe &&            \
    (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[1] & 0xc0) == 0x80)
diff --git a/libc/test/include/netinet_in_test.cpp b/libc/test/include/netinet_in_test.cpp
index 15e57ccef7ac5..e8cb8e48ff4b4 100644
--- a/libc/test/include/netinet_in_test.cpp
+++ b/libc/test/include/netinet_in_test.cpp
@@ -24,6 +24,11 @@ TEST(LlvmLibcNetinetInTest, IN6Macro) {
   EXPECT_TRUE(IN6_IS_ADDR_LOOPBACK(buff));
   buff[15] = 0;
 
+  EXPECT_FALSE(IN6_IS_ADDR_MULTICAST(buff));
+  buff[0] = 0xff;
+  EXPECT_TRUE(IN6_IS_ADDR_MULTICAST(buff));
+  buff[0] = 0;
+
   buff[0] = 0xfe;
   buff[1] = 0x80;
   EXPECT_TRUE(IN6_IS_ADDR_LINKLOCAL(buff));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants