canonical / canonical/cloud-init

incorrect duplicate mac error for non-Ethernet based interfaces have empty saddr

Open
#3,070 0 comments 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1734989](https://bugs.launchpad.net/cloud-init/+bug/1734989)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2017-11-28T19:37:44.028995+00:00
date_fix_committed = None
date_fix_released = None
id = 1734989
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1734989
milestone = None
owner = sorah
owner_name = Sorah Fukumori
private = False
status = confirmed
submitter = sorah
submitter_name = Sorah Fukumori
tags = []
duplicates = []

_Launchpad user **Sorah Fukumori(sorah)** wrote on 2017-11-28T19:37:44.028995+00:00_

## Environment

Cloud provider: EC2
Distro: Gentoo (Kernel: 4.12.12-gentoo)
Version: 17.1

## Crashes as follows:

[ 14.383147] cloud-init[2765]: ------------------------------------------------------------
[ 14.395646] cloud-init[2765]: Traceback (most recent call last):
[ 14.407168] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/cmd/main.py", line 638, in status_wrapper
[ 14.421615] cloud-init[2765]: ret = functor(name, args)
[ 14.429130] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/cmd/main.py", line 357, in main_init
[ 14.441136] cloud-init[2765]: init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
[ 14.455574] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/stages.py", line 635, in apply_network_config
[ 14.470693] cloud-init[2765]: netcfg, src = self._find_networking_config()
[ 14.478577] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/stages.py", line 622, in _find_networking_config
[ 14.496614] cloud-init[2765]: if self.datasource and hasattr(self.datasource, 'network_config'):
[ 14.509144] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/sources/DataSourceEc2.py", line 301, in network_config
[ 14.526627] cloud-init[2765]: result = convert_ec2_metadata_network_config(net_md)
[ 14.535504] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/sources/DataSourceEc2.py", line 475, in convert_ec2_metadata_network_config
[ 14.552604] cloud-init[2765]: macs_to_nics = net.get_interfaces_by_mac()
[ 14.560545] cloud-init[2765]: File "/usr/lib64/python3.4/site-packages/cloudinit/net/__init__.py", line 522, in get_interfaces_by_mac
[ 14.576593] cloud-init[2765]: (name, ret[mac], mac))
[ 14.582105] cloud-init[2765]: RuntimeError: duplicate mac found! both 'gre0' and 'ip_vti0' have mac '00:00:00:00'

## Cause

/sys/class/net/*/address varies based on a lower-level protocol used by a interface.
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net

However, cloud-init assumes /sys/class/net/*/address always to be Ethernet MAC address. https://github.com/cloud-init/cloud-init/blob/4964fb38f11c15ed119ff4c7f4379ae3c8785a9a/cloudinit/net/__init__.py#L533 But some interfaces have IPv4/v6 for underlying protocol:

$ ip -br l|grep 0.0.0.0
tunl0@NONE DOWN 0.0.0.0
gre0@NONE DOWN 0.0.0.0
ip_vti0@NONE DOWN 0.0.0.0
sit0@NONE DOWN 0.0.0.0
$ ip -br l|grep ::
ip6_vti0@NONE DOWN ::
ip6tnl0@NONE DOWN ::
$ grep -r ^00:00 /sys/class/net/*/address
/sys/class/net/gre0/address:00:00:00:00
/sys/class/net/gretap0/address:00:00:00:00:00:00
/sys/class/net/ip6gre0/address:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
/sys/class/net/ip6tnl0/address:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
/sys/class/net/ip6_vti0/address:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
/sys/class/net/ip_vti0/address:00:00:00:00
/sys/class/net/lo/address:00:00:00:00:00:00
/sys/class/net/sit0/address:00:00:00:00
/sys/class/net/tunl0/address:00:00:00:00

These should also be ignored as the empty_mac pattern.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.