git: 0345fd891fe1 - main - netgraph/ng_base: Renaming a node to the same name is a noop
Lutz Donnerhacke
donner at FreeBSD.org
Fri Jun 4 09:22:03 UTC 2021
The branch main has been updated by donner:
URL: https://cgit.FreeBSD.org/src/commit/?id=0345fd891fe13a191fc0fae9463ea9458bfaff5a
commit 0345fd891fe13a191fc0fae9463ea9458bfaff5a
Author: Lutz Donnerhacke <donner at FreeBSD.org>
AuthorDate: 2021-05-04 19:20:39 +0000
Commit: Lutz Donnerhacke <donner at FreeBSD.org>
CommitDate: 2021-06-04 09:20:19 +0000
netgraph/ng_base: Renaming a node to the same name is a noop
Detailed analysis in https://github.com/genneko/freebsd-vimage-jails/issues/2
brought the problem down to a double call of ng_node_name() before and
after a vnet move. Because the name of the node is already known
(occupied by itself), the second call fails.
PR: 241954
Reported by: Paul Armstrong
MFC: 1 week
Differential Revision: https://reviews.freebsd.org/D30110
---
sys/netgraph/ng_base.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 63bc251f52f9..ae179cf13a45 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -855,6 +855,10 @@ ng_name_node(node_p node, const char *name)
node_p node2;
int i;
+ /* Rename without change is a noop */
+ if (strcmp(NG_NODE_NAME(node), name) == 0)
+ return (0);
+
/* Check the name is valid */
for (i = 0; i < NG_NODESIZ; i++) {
if (name[i] == '\0' || name[i] == '.' || name[i] == ':')
More information about the dev-commits-src-main
mailing list