Public bug reported:

The comparison used in provisioningserver/utils/__init__.py:
find_ip_via_arp(mac) compares MAC addresses to the output of an "arp -n"
command using case sensitive comparison. This MAC address may be entered
by a user in a web UI and often is NOT cut/pasted from ARP but rather
from the IPMI vendor's display, which may display the MAC address in
uppercase.

For a fix, I strongly recommend doing these things to make this more
friendly:

1. Trim all whitespace from the supplied MAC address before comparison.

2. Trim all delimiters too - both on the supplied MAC address and from
the output column of the "arp -n" it's being compared with.

3. Translate both the supplied MAC address and the "arp -n" column data
to lowercase or uppercase for comparison or use a case-insensitive match
in the "for" loop.

- DIFF -

diff /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.py 
__init__.py
46a47
> import re
824a826,827
>     mac = mac.lower()
>     mac = re.sub('[^0-9a-f]', '', mac)
829c832,833
<         if len(columns) == 5 and columns[2] == mac:
---
>         col = re.sub('[^0-9a-f]', '', columns[2])
>         if len(columns) == 5 and col == mac:

** Affects: maas (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1367455

Title:
  MAC address for node's IPMI is reversed looked up to yield IP address
  using case sensitive comparison

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1367455/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to