-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc] add IPV6 related macros #162219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] add IPV6 related macros #162219
Conversation
|
@llvm/pr-subscribers-libc Author: Connector Switch (c8ef) ChangesFull diff: https://github.com/llvm/llvm-project/pull/162219.diff 2 Files Affected:
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);
+}
|
michaelrj-google
left a comment
There was a problem hiding this 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.
At least it is a place to double-check the initial value? I am fine with keeping it or removing it. |
|
Gentle ping~ (Perhaps we could use #ifdef to test these macros, or the current approach is enough?) |
|
I plan to commit this for now. It follows the same implementation strategy as #161855. I am willing to make any necessary refinements afterwards. |
|
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. |
No description provided.