Display facts for aliases in *BSD

* interfaces.rb - aliases on *BSD are iterated over up to their actual count - slightly modified Michelle Sullivan's version
* util/ip.rb - added get_alias_no method to return alias count; method get_interface_value modified by Michelle Sullivan to allow obtaining values for specific aliases

Originated here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190796

Hi,

There can be a different number of ip and ipv6 aliases, hence the label is
left there.

Regards,
Daniel
 On 22 Jul 2014 20:09, "Adrien Thebo" <notifications@github.com> wrote:

> In lib/facter/util/ip.rb:
>
> >        end
> >      end
> >    end
> >
> >    ##
> > +  # get_alias_no obtains alias count for a specified interface and label
> > +  #
> > +  # @param interface [String] the interface identifier, e.g. "eth0" or "bond0"
> > +  #
> > +  # @param label [String] the attribute of the interface to obtain a value for,
> > +  # e.g. "netmask" or "ipaddress" (note eg. ipaddress and ipaddress6 can have different
> > +  # number of aliases, so label does make sense here)
> > +  #
> > +  # @api private
> > +  #
> > +  # @return [Integer] representing the requested value.  0 is returned if the
> > +  # kernel is not supported by the REGEX_MAP constant and on Windows.
> > +  def self.get_alias_no(interface, label)
>
> If this method is simply enumerating the number of addresses defined for a
> given interface, why do we need to scan for a user specified label? Given
> output like so:
>
> ```lo1: flags=8049 metric 0 mtu 16384
>
> .......options=600003
> .......inet 10.0.2.21 netmask 0xffffffff.
> .......inet 10.0.2.22 netmask 0xffffffff.
> .......inet 10.0.2.23 netmask 0xffffffff.
> .......inet 10.0.2.24 netmask 0xffffffff.
> .......inet 10.0.2.25 netmask 0xffffffff.
> .......inet 10.0.2.26 netmask 0xffffffff.
> .......inet 10.0.2.27 netmask 0xffffffff.
> .......inet 10.0.2.28 netmask 0xffffffff.
> .......inet 10.0.2.29 netmask 0xffffffff.
> .......inet 10.0.2.30 netmask 0xffffffff
>
> Can't we just count the number of times `inet` is specified?
>
>  —
> Reply to this email directly or view it on GitHub
> <https://github.com/puppetlabs/facter/pull/731/files#r15248979>.
>