Bug 1090011

Summary: Need to limit names of new interfaces to IFNAMSIZ
Product: Red Hat Enterprise Linux 7 Reporter: yanbing du <ydu>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, jsuchane, laine, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: netcf-0.2.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 08:58:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1206680    
Bug Blocks:    

Description yanbing du 2014-04-22 11:32:30 UTC
Description of problem:
in /usr/include/net/if.h. 
/* Length of interface name.  */
#define IF_NAMESIZE     16

But libvirt/netcf didn't process the name given by user, which will lead to interface/bridge start fail.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7.x86_64


How reproducible:
100% 

Steps to Reproduce:
1. Create a bridge via virsh command

 # virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
eth0                 active     44:37:e6:4a:42:d1
lo                   active     00:00:00:00:00:00

# virsh iface-bridge lo abcdefghijklmnopq
Created bridge abcdefghijklmnopq with attached device lo
error: Failed to start bridge interface abcdefghijklmnopq
error: internal error: failed to create (start) interface abcdefghijklmnopq: failed to execute external program - Running 'ifup abcdefghijklmnopq' failed with exit code 1: device abcdefghijklmnopq already exists; can't create bridge with the same name

# virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
abcdefghijklmnopq    inactive
eth0                 active     44:37:e6:4a:42:d1

# brctl show
bridge name    bridge id        STP enabled    interfaces
abcdefghijklmno        8000.000000000000    no       
virbr0        8000.52540048acc5    yes        virbr0-nic

# virsh iface-unbridge abcdefghijklmnopq
Device lo un-attached from bridge abcdefghijklmnopq
Interface lo started

 virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
eth0                 active     44:37:e6:4a:42:d1
lo                   active     00:00:00:00:00:00

# brctl show
bridge name    bridge id        STP enabled    interfaces
abcdefghijklmno        8000.000000000000    no       
virbr0        8000.52540048acc5    yes        virbr0-nic

Actual result:
By using the lone bridge name, libvirt can define a bridge, but can't start it, as system only take the first 16 characters to create a bridge and which will not deleted/undefined by virsh iface-unbridge command.

Expected results:
Before create the interface/bridge, libvirt need process the name. 

Additional info:

Comment 3 John Ferlan 2015-05-19 17:06:45 UTC
This was not a libvirt issue - it was a netcf issue (changed the component).

In any case, netcf 0.2.4 has the following commit:

commit ccf88a39fb3a0efdff0fefe1903664fec541b747
Author: jmiao <jmiao>
Date:   Mon Apr 21 18:01:12 2014 +0800

    Don't allow defining an interface with length > IFNAMSIZ-1
    
    drv_define() needs to check the length of interface's name to prevent
    the actual name being different (truncated) from the configured name.
    
    Signed-off-by: jmiao <jmiao>

Which resolves the issue.

Moving to MODIFIED as once the depends on bz is resolved for RHEL7.2 this will be resolved.

FWIW: Using the same command on a much more recent upstream environment results in the following:

# virsh iface-bridge lo abcdefghijklmnopq
error: Failed to define new bridge interface abcdefghijklmnopq
error: internal error: could not get interface XML description: internal error - The interface name 'abcdefghijklmnopq' exceeds the maximum allowed length: 15

#

Comment 6 Hu Jianwei 2015-05-28 02:15:40 UTC
Verified as below:

[root@localhost ~]# rpm -q netcf
netcf-0.2.8-1.el7.x86_64
[root@localhost ~]# 
[root@localhost ~]# virsh iface-list --all
 Name                 State      MAC Address
---------------------------------------------------
 eno1                 active     24:be:05:18:81:ce
 enp2s0               inactive   00:1b:21:27:4e:ce
 lo                   active     00:00:00:00:00:00

[root@localhost ~]# virsh iface-bridge lo abcdefghijklmnopq
error: Failed to define new bridge interface abcdefghijklmnopq
error: internal error: could not get interface XML description: internal error - The interface name 'abcdefghijklmnopq' exceeds the maximum allowed length: 15

We can get expected results, changed to Verified.

Comment 8 errata-xmlrpc 2015-11-19 08:58:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-2248.html