Skip to content

Conversation

@c8ef
Copy link
Contributor

@c8ef c8ef commented Oct 7, 2025

No description provided.

@llvmbot llvmbot added the libc label Oct 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2025

@llvm/pr-subscribers-libc

Author: Connector Switch (c8ef)

Changes

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

2 Files Affected:

  • (modified) libc/include/llvm-libc-macros/netinet-in-macros.h (+8)
  • (modified) libc/test/include/netinet_in_test.cpp (+10)
diff --git a/libc/include/llvm-libc-macros/netinet-in-macros.h b/libc/include/llvm-libc-macros/netinet-in-macros.h
index c05e5e2aec248..fb7564cee9e80 100644
--- a/libc/include/llvm-libc-macros/netinet-in-macros.h
+++ b/libc/include/llvm-libc-macros/netinet-in-macros.h
@@ -16,4 +16,12 @@
 #define IPPROTO_IPV6 41
 #define IPPROTO_RAW 255
 
+#define IPV6_UNICAST_HOPS 16
+#define IPV6_MULTICAST_IF 17
+#define IPV6_MULTICAST_HOPS 18
+#define IPV6_MULTICAST_LOOP 19
+#define IPV6_JOIN_GROUP 20
+#define IPV6_LEAVE_GROUP 21
+#define IPV6_V6ONLY 26
+
 #endif // LLVM_LIBC_MACROS_NETINET_IN_MACROS_H
diff --git a/libc/test/include/netinet_in_test.cpp b/libc/test/include/netinet_in_test.cpp
index a6c47a779ea44..714892f511b1c 100644
--- a/libc/test/include/netinet_in_test.cpp
+++ b/libc/test/include/netinet_in_test.cpp
@@ -17,3 +17,13 @@ TEST(LlvmLibcNetinetInTest, IPPROTOMacro) {
   EXPECT_EQ(IPPROTO_IPV6, 41);
   EXPECT_EQ(IPPROTO_RAW, 255);
 }
+
+TEST(LlvmLibcNetinetInTest, IPV6Macro) {
+  EXPECT_EQ(IPV6_UNICAST_HOPS, 16);
+  EXPECT_EQ(IPV6_MULTICAST_IF, 17);
+  EXPECT_EQ(IPV6_MULTICAST_HOPS, 18);
+  EXPECT_EQ(IPV6_MULTICAST_LOOP, 19);
+  EXPECT_EQ(IPV6_JOIN_GROUP, 20);
+  EXPECT_EQ(IPV6_LEAVE_GROUP, 21);
+  EXPECT_EQ(IPV6_V6ONLY, 26);
+}

@c8ef c8ef requested review from lntue and michaelrj-google October 7, 2025 05:09
Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the test is necessary for the macros, given that they're only checking that the value hasn't changed.

@c8ef
Copy link
Contributor Author

c8ef commented Oct 8, 2025

I'm not sure if the test is necessary for the macros, given that they're only checking that the value hasn't changed.

At least it is a place to double-check the initial value? I am fine with keeping it or removing it.

@c8ef c8ef requested a review from michaelrj-google October 8, 2025 11:41
@c8ef
Copy link
Contributor Author

c8ef commented Oct 11, 2025

Gentle ping~

(Perhaps we could use #ifdef to test these macros, or the current approach is enough?)

@c8ef
Copy link
Contributor Author

c8ef commented Oct 17, 2025

I plan to commit this for now. It follows the same implementation strategy as #161855. I am willing to make any necessary refinements afterwards.

@c8ef c8ef merged commit c4ceb8d into llvm:main Oct 17, 2025
19 checks passed
@c8ef c8ef deleted the ipv6 branch October 17, 2025 15:41
@michaelrj-google
Copy link
Contributor

Hi, yes this change is fine, sorry about missing the review. I still don't think the test is useful but we can change that in a followup.

If I'm not responding on github please ping me on discord, I get a lot of emails about pull requests and it can be hard to tell which are urgent.

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