← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1285185] Re: netinfo.py displays corrupted inet/inet6 addr on Linux

 

** Changed in: cloud-init
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1285185

Title:
  netinfo.py displays corrupted inet/inet6 addr on Linux

Status in Init scripts for use on cloud images:
  Fix Released

Bug description:
  >>> import cloudinit.netinfo
  >>> print(cloudinit.netinfo.debug_info())
  ci-info: ++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
  ci-info: +--------+------+-----------------+---------------+-------------------+
  ci-info: | Device |  Up  |     Address     |      Mask     |     Hw-Address    |
  ci-info: +--------+------+-----------------+---------------+-------------------+
  ci-info: |   lo   | True |  addr:127.0.0.1 |   255.0.0.0   |         .         |
  ci-info: |  eth0  | True | addr:10.0.128.5 | 255.255.255.0 | fa:16:3e:2d:1a:c7 |
  ci-info: +--------+------+-----------------+---------------+-------------------+
  ci-info: +++++++++++++++++++++++++++++++Route info+++++++++++++++++++++++++++++++
  ci-info: +-------+-------------+------------+---------------+-----------+-------+
  ci-info: | Route | Destination |  Gateway   |    Genmask    | Interface | Flags |
  ci-info: +-------+-------------+------------+---------------+-----------+-------+
  ci-info: |   0   |   0.0.0.0   | 10.0.128.6 |    0.0.0.0    |    eth0   |   UG  |
  ci-info: |   1   |  10.0.128.0 |  0.0.0.0   | 255.255.255.0 |    eth0   |   U   |
  ci-info: +-------+-------------+------------+---------------+-----------+-------+

  'addr:127.0.0.1' and 'addr:10.0.128.5' are obviously incorrect values.
  Correct ones are '127.0.0.1' and '10.0.128.5' respectively.

  This issue was introduced together with basic FreeBSD support in this commit:
  http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/920

  This code (http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/cloudinit/netinfo.py#L63)
  parses the following string 'inet addr:10.0.128.5  Bcast:10.0.128.255  Mask:255.255.255.0'
  It handles both 'inet' token (required for FreeBSD) and 'addr:' token but 'inet' shows up first and gets handled by setting
  devs[curdev]['inet'] = toks[i + 1] where toks[i + 1] == 'addr:10.0.128.5 '
  'addr:' is not handled because we don't allow to overwrite data in devs[x][y].

  I was able to fix this issue by allowing the script to overwrite data in devs[x][y].
  It still handles 'inet' and sets incorrect devs[x][y] value but it's overwrited by correct 'addr:' handler on the next step.
  My change is here: http://bazaar.launchpad.net/~strikov/cloud-init/netinfo-inet-addr-fix/revision/956

  (!) We need to make sure that this code works correctly on FreeBSD (!)

  Is there any good reason (e.g. we don't want to add one more
  dependency to solve such a simple task) to avoid using
  https://pypi.python.org/pypi/netifaces or some other library?

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1285185/+subscriptions


References