Bug 270618

Summary: ifconfig: BRDGADD epair0a: Device not configured
Product: Base System Reporter: Zhenlei Huang <zlei>
Component: binAssignee: Zhenlei Huang <zlei>
Status: Closed FIXED    
Severity: Affects Some People CC: freebsd
Priority: --- Flags: zlei: mfc-stable13+
zlei: mfc-stable12+
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://reviews.freebsd.org/D39396

Description Zhenlei Huang freebsd_committer freebsd_triage 2023-04-03 08:57:54 UTC
While repeating https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270607 I encountered this interesting bug again. Its first occurrence is when I was doing https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270417 . 

When clone creating if_bridge(4), ifconfig will fail with `Device not configured` if the device unit number of bridge is not provided.

Scripts to repeat:

```
#!/bin/sh

ep=$( ifconfig epair create )
br=$( ifconfig bridge create addm $ep )

ifconfig $br destroy
ifconfig $ep destroy
```
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-04-07 14:27:24 UTC
A commit in branch main references this bug:

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

commit 09e5e3d598604167c1fb05e5cd0f41ed83314517
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-07 14:25:41 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-04-07 14:25:41 +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

 sbin/ifconfig/ifbridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-04-10 04:17:16 UTC
A commit in branch stable/13 references this bug:

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

commit bab5ce8deafb00683fb8319208750981e68d309c
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-07 14:25:41 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-04-10 04:15:05 +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)

 sbin/ifconfig/ifbridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-04-10 05:08:20 UTC
A commit in branch stable/12 references this bug:

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(-)