Red Hat Bugzilla – Bug 1090011
Need to limit names of new interfaces to IFNAMSIZ
Last modified: 2015-11-19 03:58:12 EST
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:
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@redhat.com> 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@redhat.com> 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 #
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.
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