git: 59f3510ea793 - stable/12 - ifconfig: Fix configuring if_bridge with additional operating parameters

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Mon, 10 Apr 2023 05:08:04 UTC
The branch stable/12 has been updated by zlei:

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

commit 59f3510ea793d35fbf2996087af5ab870cc0229f
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-07 14:25:41 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-04-10 05:06:22 +0000

    ifconfig: Fix configuring if_bridge with additional operating parameters
    
    For clone create and rename operations, the interface name get back can be
    different from the one passed to ioctl(). Use the interface name we get back
    so that ifconfig will not return unexpected ENXIO.
    
    PR:             270618
    Reviewed by:    kp
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D39396
    
    (cherry picked from commit 09e5e3d598604167c1fb05e5cd0f41ed83314517)
    (cherry picked from commit bab5ce8deafb00683fb8319208750981e68d309c)
---
 sbin/ifconfig/ifbridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index f4c51632bc98..afbe4b309cb5 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -89,7 +89,7 @@ do_cmd(int sock, u_long op, void *arg, size_t argsize, int set)
 
 	memset(&ifd, 0, sizeof(ifd));
 
-	strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name));
+	strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name));
 	ifd.ifd_cmd = op;
 	ifd.ifd_len = argsize;
 	ifd.ifd_data = arg;