Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1988413

Summary: rear overwrites the ifcfg-XXX files's MAC address with another MAC address
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: rearAssignee: Pavel Cahyna <pcahyna>
Status: CLOSED MIGRATED QA Contact: Jakub Haruda <jharuda>
Severity: medium Docs Contact: Šárka Jana <sjanderk>
Priority: medium    
Version: 8.4CC: jharuda, myamazak, ovasik, pcahyna
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-21 23:40:36 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:

Description Renaud Métrich 2021-07-30 13:54:12 UTC
Description of problem:

Even when restoring on exact same system, it may happen that ReaR overwrites the HWADDR field in ifcfg-XXX files with the HWADDR of another network interface present on the system.

This is due to having /usr/share/rear/finalize/GNU/Linux/300_create_mac_mapping.sh script rely on the ifcfg-XXX file name instead of actual content (see reproducer below):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 14 for file in "${PATCH_FILES[@]}"; do
 15         grep -q HWADDR $file || continue
 16         dev=$(echo $file | cut -d- -f3)
 17         old_mac=$(grep HWADDR $file | cut -d= -f2)
 18         new_mac=$(cat /sys/class/net/$dev/address)
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here above on line 16, the "dev" is computed as the first part of ifcfg-XXX file name, as shown in the examples below:

- /etc/sysconfig/network-scripts/ifcfg-FOO --> device is supposed to be FOO
- /etc/sysconfig/network-scripts/ifcfg-FOO-BAR --> device is supposed to be FOO as well

This code is unreliable, the device name should be collected by checking the DEVICE field in the file instead.


Version-Release number of selected component (if applicable):

rear-2.4+ and Upstream (but didn't test)


How reproducible:

Always

Steps to Reproduce:
1. Add another network interface to a VM

  e.g. there was "enp1s0" and you add an interface that becomes "enp7s0"

2. Create file ifcfg-enp1s0-enp7s0 as a modified copy of ifcfg-enp1s0 with corresponding HWADDR for enp7s0

  e.g. /etc/sysconfig/network-scripts/ifcfg-enp1s0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp1s0"
UUID="40412d75-5e23-4d6b-8a42-0f2b2995b1d7"
ONBOOT="yes"
HWADDR=52:54:00:20:7d:fb
DEVICE="enp1s0"
NAME="enp1s0"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

  and /etc/sysconfig/network-scripts/ifcfg-enp1s0-enp7s0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp1s0"
UUID="5aa1ebf2-d4d4-4dc3-9f68-6d32ab457867"
ONBOOT="yes"
HWADDR=52:54:00:e5:bc:d1
DEVICE="enp7s0"
NAME="enp7s0"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

3. Create a REAR backup and restore it on same system


Actual results:

HWADDR in /mnt/local/etc/sysconfig/network-scripts/ifcfg-enp1s0-enp7s0 becomes the one for enp1s0:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
HWADDR=52:54:00:20:7d:fb
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Expected results:

Correct MAC for enp7s0 even though the ifcfg file name is weird


Additional info:

You may think the root cause is the weird file name, but in fact it's not really the case, in normal situations, such kind of weirdness in names happens with slaves of bonding interfaces created using NetworkManager.

Comment 1 Pavel Cahyna 2021-09-21 16:56:48 UTC
Thank you for the report and analysis, I will try to implement some more reliable method.

Comment 3 RHEL Program Management 2023-09-21 23:35:29 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 4 RHEL Program Management 2023-09-21 23:40:36 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.