Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157431356
D50111.id155587.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D50111.id155587.diff
View Options
diff --git a/tests/sys/netgraph/ksocket.c b/tests/sys/netgraph/ksocket.c
--- a/tests/sys/netgraph/ksocket.c
+++ b/tests/sys/netgraph/ksocket.c
@@ -53,6 +53,11 @@
struct sockaddr sa = {
.sa_family = AF_INET,
};
+ struct ngm_mkpeer mkp = {
+ .type = NG_KSOCKET_NODE_TYPE,
+ .ourhook = OURHOOK,
+ .peerhook = "inet/dgram/udp",
+ };
socklen_t slen = sizeof(sa);
int ds, cs, us;
@@ -60,11 +65,6 @@
ATF_REQUIRE(bind(us, &sa, sizeof(sa)) == 0);
ATF_REQUIRE(getsockname(us, &sa, &slen) == 0);
- struct ngm_mkpeer mkp = {
- .type = NG_KSOCKET_NODE_TYPE,
- .ourhook = OURHOOK,
- .peerhook = "inet/dgram/udp",
- };
ATF_REQUIRE(NgMkSockNode(NULL, &cs, &ds) == 0);
ATF_REQUIRE(NgSendMsg(cs, ".", NGM_GENERIC_COOKIE, NGM_MKPEER, &mkp,
sizeof(mkp)) >= 0);
@@ -81,14 +81,14 @@
.sin_family = AF_INET,
.sin_len = sizeof(sin),
};
- struct ng_mesg *rep;
- int ds, cs, us;
-
struct ngm_mkpeer mkp = {
.type = NG_KSOCKET_NODE_TYPE,
.ourhook = OURHOOK,
.peerhook = "inet/dgram/udp",
};
+ struct ng_mesg *rep;
+ int ds, cs, us;
+
ATF_REQUIRE(NgMkSockNode(NULL, &cs, &ds) == 0);
ATF_REQUIRE(NgSendMsg(cs, ".", NGM_GENERIC_COOKIE, NGM_MKPEER, &mkp,
sizeof(mkp)) >= 0);
@@ -106,10 +106,72 @@
hellocheck(us, ds);
}
+ATF_TC_WITHOUT_HEAD(udp6_connect);
+ATF_TC_BODY(udp6_connect, tc)
+{
+ struct sockaddr_in6 sa = {
+ .sin6_family = AF_INET6,
+ };
+ struct ngm_mkpeer mkp = {
+ .type = NG_KSOCKET_NODE_TYPE,
+ .ourhook = OURHOOK,
+ .peerhook = "inet6/dgram/udp6",
+ };
+ socklen_t slen = sizeof(sa);
+ int ds, cs, us;
+
+ ATF_REQUIRE((us = socket(PF_INET6, SOCK_DGRAM, 0)) > 0);
+ ATF_REQUIRE(bind(us, (struct sockaddr *)&sa, sizeof(sa)) == 0);
+ ATF_REQUIRE(getsockname(us, (struct sockaddr *)&sa, &slen) == 0);
+
+ ATF_REQUIRE(NgMkSockNode(NULL, &cs, &ds) == 0);
+ ATF_REQUIRE(NgSendMsg(cs, ".", NGM_GENERIC_COOKIE, NGM_MKPEER, &mkp,
+ sizeof(mkp)) >= 0);
+ ATF_REQUIRE(NgSendMsg(cs, ".:" OURHOOK, NGM_KSOCKET_COOKIE,
+ NGM_KSOCKET_CONNECT, &sa, sizeof(sa)) >= 0);
+
+ hellocheck(ds, us);
+}
+
+
+ATF_TC_WITHOUT_HEAD(udp6_bind);
+ATF_TC_BODY(udp6_bind, tc)
+{
+ struct ngm_mkpeer mkp = {
+ .type = NG_KSOCKET_NODE_TYPE,
+ .ourhook = OURHOOK,
+ .peerhook = "inet6/dgram/udp6",
+ };
+ struct sockaddr_in6 sin6 = {
+ .sin6_family = AF_INET6,
+ .sin6_len = sizeof(sin6),
+ };
+ struct ng_mesg *rep;
+ int ds, cs, us;
+
+ ATF_REQUIRE(NgMkSockNode(NULL, &cs, &ds) == 0);
+ ATF_REQUIRE(NgSendMsg(cs, ".", NGM_GENERIC_COOKIE, NGM_MKPEER, &mkp,
+ sizeof(mkp)) >= 0);
+ ATF_REQUIRE(NgSendMsg(cs, ".:" OURHOOK, NGM_KSOCKET_COOKIE,
+ NGM_KSOCKET_BIND, &sin6, sizeof(sin6)) >= 0);
+ ATF_REQUIRE(NgSendMsg(cs, ".:" OURHOOK, NGM_KSOCKET_COOKIE,
+ NGM_KSOCKET_GETNAME, NULL, 0) >= 0);
+ ATF_REQUIRE(NgAllocRecvMsg(cs, &rep, NULL) == sizeof(struct ng_mesg) +
+ sizeof(struct sockaddr_in6));
+
+ ATF_REQUIRE((us = socket(PF_INET6, SOCK_DGRAM, 0)) > 0);
+ ATF_REQUIRE(connect(us, (struct sockaddr *)rep->data,
+ sizeof(struct sockaddr_in6)) == 0);
+
+ hellocheck(us, ds);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, udp_connect);
ATF_TP_ADD_TC(tp, udp_bind);
+ ATF_TP_ADD_TC(tp, udp6_connect);
+ ATF_TP_ADD_TC(tp, udp6_bind);
return (atf_no_error());
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 22, 9:35 AM (8 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33418072
Default Alt Text
D50111.id155587.diff (3 KB)
Attached To
Mode
D50111: ng_ksocket: Add tests for IPv6
Attached
Detach File
Event Timeline
Log In to Comment