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 2151428

Summary: [RHEL9] Reapply does not updating IPv4 address in desired order
Product: Red Hat Enterprise Linux 9 Reporter: Gris Ge <fge>
Component: NetworkManagerAssignee: Fernando F. Mancera <ferferna>
Status: CLOSED NOTABUG QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 9.1CC: bgalvani, desktop-qa-list, ferferna, lrintel, nm-team, rkhan, sfaye, sukulkar, thaller, till
Target Milestone: rcKeywords: Triaged
Target Release: 9.2Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2151426 Environment:
Last Closed: 2022-12-20 10:26:53 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:
Bug Depends On: 2151426    
Bug Blocks:    
Attachments:
Description Flags
Reproducer script
none
NetworkManager trace log none

Description Gris Ge 2022-12-07 04:08:49 UTC
+++ This bug was initially created as a clone of Bug #2151426 +++

Description of problem:

The `nmcli d reapply <connection_name>` does not update IPv4 address as desired.

Version-Release number of selected component (if applicable):
NetworkManager-1.40.0-4.el8_7.x86_64
NetworkManager-1.36.0-11.el8_6.x86_64


How reproducible:

100%


Steps to Reproduce:

 * sudo ./bug.sh

Actual results:

Got IPv4 address in the order:

192.168.19.4/24
192.168.199.3/24
192.168.15.5/24

which is not desired

Expected results:

192.168.15.5/24
192.168.19.4/24
192.168.199.3/24

Additional info:

--- Additional comment from Gris Ge on 2022-12-07 12:04:27 CST ---



--- Additional comment from Gris Ge on 2022-12-07 12:06:10 CST ---

Requesting 8.4 zstream as customer request nmstate fix in bug 

https://bugzilla.redhat.com/show_bug.cgi?id=2132570#c8

Comment 2 Gris Ge 2022-12-07 04:09:28 UTC
Created attachment 1930704 [details]
Reproducer script

Comment 3 Gris Ge 2022-12-07 04:10:33 UTC
Created attachment 1930705 [details]
NetworkManager trace log

Issue also found on NetworkManager-1.41.6-31453.copr.07ef13b9cc.el9.x86_64

Comment 4 Thomas Haller 2022-12-16 13:57:04 UTC
When you add two (or more) IPv4 addresses from the same subnet, kernel will set the "secondary" flag to all but the primary address (btw, for IPv6, kernel doesn't do that).

But if you have addresses from separate subnets, then this doesn't happen.


NetworkManager follows that. If you add IPv4 addresses from different subnets, then their order/priority is undefined and not enforced by NetworkManager. The order is only enforced by addresses from the same subnet.

See here: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/5e0b867a49eb10a37383ccd3d674719392b742c0/src/libnm-platform/nm-platform.c#L4163

> Expected results:
>
> 192.168.15.5/24
> 192.168.19.4/24
> 192.168.199.3/24

Right. Different subnets. No order enforced.


For IPv6, that's different, and NetworkManager enforces the relative order for all addresses.

> Requesting 8.4 zstream as customer request nmstate fix in bug 
>
> https://bugzilla.redhat.com/show_bug.cgi?id=2132570#c8

Could you give more context why this behavior is requested? https://bugzilla.redhat.com/show_bug.cgi?id=2132570#c0 doesn't configure addresses from different subnets, so it's not clear whether you request that addresses from different subnets also have their order preserved, or whether there was just a a bug with addresses in the same subnet (I cannot reproduce the problem .

Kernel has no proper API to set the order, except removing and readding the addresses in the right order. But removing+readding is rather problematic, because the address is gone for a moment. For that reason, I think this behavior should not be extended.

Comment 5 Gris Ge 2022-12-20 10:03:54 UTC
Thanks for the explanation!

Closing as not a bug. I will change nmstate to ignore the order of ipv4 address on when applying.

Comment 6 Fernando F. Mancera 2022-12-20 10:26:53 UTC
As mentioned above, closing as not a bug. Thank you!