Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149305653
D42691.1789844444.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42691.1789844444.diff
View Options
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -523,6 +523,9 @@
if (NG_NODE_HAS_NAME(node))
bcopy(NG_NODE_NAME(node), sg->sg_data,
strlen(NG_NODE_NAME(node)));
+ else
+ snprintf(sg->sg_data, sizeof(sg->sg_data), "[%x]",
+ ng_node2ID(node));
mtx_unlock(&pcbp->sockdata->mtx);
sg->sg_len = sg_len;
diff --git a/tests/sys/netgraph/socket.c b/tests/sys/netgraph/socket.c
--- a/tests/sys/netgraph/socket.c
+++ b/tests/sys/netgraph/socket.c
@@ -42,13 +42,12 @@
char name[NG_NODESIZ] = NAME;
int cs;
-#if 0
- /* Unnamed node. */
+ /* Unnamed node returns its ID as name. */
ATF_REQUIRE(NgMkSockNode(NULL, &cs, NULL) == 0);
ATF_REQUIRE(getsockname(cs, (struct sockaddr *)&sg, &len) == 0);
+ ATF_REQUIRE(strspn(sg.sg_data, "[0123456789abcdef]") >= 3 &&
+ sg.sg_data[strspn(sg.sg_data, "[0123456789abcdef]")] == '\0');
close(cs);
- /* Unnamed node doesn't return any name/ID now. */
-#endif
/* Named node. */
ATF_REQUIRE(NgMkSockNode(name, &cs, NULL) == 0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 19, 7:00 PM (7 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29789303
Default Alt Text
D42691.1789844444.diff (1 KB)
Attached To
Mode
D42691: ng_socket: with getsockname() return node ID for unnamed node
Attached
Detach File
Event Timeline
Log In to Comment