Bug 1928745

Summary: copy-mac-from should use perm_hwaddr
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 17:42:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
issue.log none

Description Mingyu Shi 2021-02-15 13:23:51 UTC
Description of problem:
In some bond modes, all slaves' mac addresses are changed to an identical one. If another bond interface enslaves and copies from one of these slaves, it will take the running mac, not perm_hwaddr(original mac).

Version-Release number of selected component (if applicable):
nmstate-1.0.2-0.3.el8.noarch
nispor-1.0.1-3.el8.x86_64
NetworkManager-1.30.0-0.10.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
ip link add veth0 type veth peer veth0_ep
ip link add veth1 type veth peer veth1_ep
ip link show veth1 #check the original mac of veth1
echo "interfaces:
- name: bond0
  type: bond
  state: up
  copy-mac-from: veth0
  link-aggregation:
    mode: balance-xor
    port:
    - veth0
    - veth1" | nmstatectl set
sleep 3
echo "interfaces:
- name: bond1
  type: bond
  state: up
  copy-mac-from: veth1
  link-aggregation:
    mode: balance-xor
    port:
    - veth1" | nmstatectl set
nmstatectl show bond*,veth[01]

Actual results:
bond0, bond1, veth0 and veth1 are with same mac address(copy from veth0)

Expected results:
bond1 and veth1 should use original mac address(perm_hwaddr) of veth1

Additional info:

Comment 1 Gris Ge 2021-02-18 03:32:08 UTC
This requires the support of ETHTOOL `ethtool -P|--show-permaddr DEVNAME` by nispor.

Nispor part will be tracked by https://bugzilla.redhat.com/show_bug.cgi?id=1929962

Comment 2 Fernando F. Mancera 2021-06-07 10:56:30 UTC
Upstream patch: https://github.com/nmstate/nmstate/commit/e87349169dd89eb66469c614a7eb05ccf0606b53

Comment 6 Mingyu Shi 2021-06-19 15:09:31 UTC
Created attachment 1792312 [details]
issue.log

Comment 7 Mingyu Shi 2021-06-19 15:16:02 UTC
Hi, when veth1 was moved from bond0 to bond1, bond1 and veth1 were still using mac from veth0, not perm_hwaddr of veth1.
Please check the attachment above.

As interface managed rule changed, here's an update of reproducer, set veth managed:
ip link add veth0 type veth peer veth0_ep
ip link add veth1 type veth peer veth1_ep
nmcli dev set veth0 managed yes
nmcli dev set veth1 managed yes
ip link show veth1 #check the original mac of veth1
echo "interfaces:
- name: bond0
  type: bond
  state: up
  copy-mac-from: veth0
  link-aggregation:
    mode: balance-xor
    port:
    - veth0
    - veth1" | nmstatectl set
sleep 3
echo "interfaces:
- name: bond1
  type: bond
  state: up
  copy-mac-from: veth1
  link-aggregation:
    mode: balance-xor
    port:
    - veth1" | nmstatectl set
nmstatectl show bond*,veth[01]

Comment 8 Mingyu Shi 2021-06-19 15:16:48 UTC
versions:
nmstate-1.1.0-0.3.alpha3.el8.noarch
nispor-1.1.0-2.el8.x86_64
NetworkManager-1.32.0-0.5.el8.x86_64

Comment 11 Gris Ge 2021-06-19 17:18:06 UTC
Hi Mingyu,

The veth does not support permanent mac address, that's the reason your test fails.

Please use real NICs or e1000e in VM.

Comment 12 Gris Ge 2021-06-23 08:33:45 UTC
There are two type permanent MAC address in this bug:
 1. Ethtool permanent MAC address which is retried from NIC driver/firmware.
 2. The bond port `perm_hwaddr` property which holding the original MAC address before this port been assigned to a bond controller.


With posted patch, nmstate will prefer item 1) and use item 2) as fallback.

To test item 1), you need real NIC or e1000e in VM.
To test item 2), veth is good enough.

Comment 13 Gris Ge 2021-06-23 08:34:11 UTC
Pre-test could be done by using `sudo dnf copr enable packit/nmstate-nmstate-1651`

Comment 15 Mingyu Shi 2021-07-13 06:41:20 UTC
Verified with versions:
nmstate-1.1.0-0.6.alpha6.el8.noarch
nispor-1.1.1-1.el8.x86_64
NetworkManager-1.32.2-1.el8.x86_64

Comment 18 errata-xmlrpc 2021-11-09 17:42:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (nmstate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4157