aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLutz Donnerhacke <donner@FreeBSD.org>2021-05-04 19:20:39 +0000
committerLutz Donnerhacke <donner@FreeBSD.org>2021-06-10 09:33:19 +0000
commita0694da5d035ea0e686ad1bae95709e52df0913a (patch)
treec9709a616bb47482b87395faf7147838779b3c85
parent6fab8f9b8ae7a2f5489191714393494c88bd937b (diff)
downloadsrc-a0694da5d035ea0e686ad1bae95709e52df0913a.tar.gz
src-a0694da5d035ea0e686ad1bae95709e52df0913a.zip
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 Differential Revision: https://reviews.freebsd.org/D30110 (cherry picked from commit 0345fd891fe13a191fc0fae9463ea9458bfaff5a)
-rw-r--r--sys/netgraph/ng_base.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 4c6a2f606119..f7c2cdb9afb0 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -854,6 +854,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] == ':')