Feature #2132

support for named interface aliases under linux

Added by anarcat - over 1 year ago. Updated 4 months ago.

Status:Closed Start:04/02/2009
Priority:High Due date:
Assignee:James Turnbull % Done:

50%

Category:library
Target version:1.5.5
Keywords: Branch:
Votes: 0

Description

Linux supports naming interface aliases. Example here:

eth1      Lien encap:Ethernet  HWaddr CENSORED
          inet adr:192.168.0.42  Bcast:192.168.0.255  Masque:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:72056 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43727 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000 
          RX bytes:6908277 (6.5 MiB)  TX bytes:96520716 (92.0 MiB)

eth0:hg   Lien encap:Ethernet  HWaddr CENSORED
          inet adr:209.44.112.91  Bcast:209.44.112.127  Masque:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:rt   Lien encap:Ethernet  HWaddr CENSORED
          inet adr:209.44.112.92  Bcast:209.44.112.127  Masque:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

In facter 1.5.1 and 1.5.4, this yields duplicate eth0 interfaces in the interfaces fact:

interfaces => eth0,eth1,eth0,eth0,sit0

This, in turn, breaks modules (like the munin module) which rely on the interface list to create graphs per interface:

err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed with error ArgumentError: Duplicate definition: Munin::Plugin[if_eth0] is already defined in file /etc/puppet/modules/munin/manifests/plugin.pp at line 101; cannot redefine at /etc/puppet/modules/munin/manifests/plugin.pp:101 on node shell.koumbit.net

So lots of fun. :)

The fix is to be a bit more lenient in what we consider to be an interface. Patch for 1.5.4 attached. I know 1.5 master is slightly different, but it should be fairly trivial to patch.

With the patch, I get proper facts in place:

interfaces => eth0,eth1,eth0_hg,eth0_rt,sit0

Since those are “virtual” interfaces (they’re just aliases), I guess an alternative approach could be to filter out duplicates in the interfaces fact.

if_alias.patch (429 Bytes) anarcat -, 04/02/2009 11:58 pm

0001-tests-for-ifconfig-on-linux-with-vlans-and-aliases.patch - a new test (4.7 KB) Marc Fournier, 04/23/2009 10:29 pm

Associated revisions

Revision 7fa257689b08d5c6c8e22da9da49f0679aa9b1d9
Added by James Turnbull over 1 year ago

Fixed #2132 – support for named interface aliases under linux

History

Updated by Luke Kanies over 1 year ago

  • Category set to library
  • Status changed from Unreviewed to Ready for Checkin
  • Assignee set to James Turnbull
  • Target version changed from 1.5.4 to 1.6.0

Updated by James Turnbull over 1 year ago

  • Status changed from Ready for Checkin to Closed
  • Target version changed from 1.6.0 to 1.5.5

Pushed in commit:“7fa257689b08d5c6c8e22da9da49f0679aa9b1d9” in branch 1.5.x

Updated by Marc Fournier over 1 year ago

I was about to open a bugreport for this issue when I found it was already resolved.

In the process of fixing the issue, I created a new test for interfaces with aliases/vlans. Maybe you’ll find it useful ?

Also available in: Atom PDF