Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2021 09:36:02 GMT
From:      Lutz Donnerhacke <donner@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b57a593cb2d6 - stable/11 - netgraph/ng_base: Renaming a node to the same name is a noop
Message-ID:  <202106100936.15A9a2Oo033619@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by donner:

URL: https://cgit.FreeBSD.org/src/commit/?id=b57a593cb2d69a684e4be04e8cea7fe7a7f43b24

commit b57a593cb2d69a684e4be04e8cea7fe7a7f43b24
Author:     Lutz Donnerhacke <donner@FreeBSD.org>
AuthorDate: 2021-05-04 19:20:39 +0000
Commit:     Lutz Donnerhacke <donner@FreeBSD.org>
CommitDate: 2021-06-10 09:35:21 +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
    Differential Revision: https://reviews.freebsd.org/D30110
    
    (cherry picked from commit 0345fd891fe13a191fc0fae9463ea9458bfaff5a)
---
 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 065a539a7eec..b39c1b831b31 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] == ':')



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106100936.15A9a2Oo033619>