Bug 1785039

Summary: nmcli command to add ipv4.gateway does not work when DEFROUTE=no and throws no error
Product: Red Hat Enterprise Linux 7 Reporter: Richard Hyman <rhyman>
Component: NetworkManagerAssignee: Thomas Haller <thaller>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: low Docs Contact:
Priority: low    
Version: 7.5CC: atragler, bgalvani, gscott, jmaxwell, lrintel, pasik, rkhan, sukulkar, thaller, vbenes
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: NetworkManager-1.18.6-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 20:30:25 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:    
Bug Blocks: 1797742    

Description Richard Hyman 2019-12-18 23:19:08 UTC
Description of problem:

nmcli command to add ipv4.gateway does not work when DEFROUTE=no and throws no error

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

RHEL 7.5
3.10.0-862.14.4.el7.x86_64
NetworkManager-1.10.2-16.el7_5.x86_64                       

How reproducible:

very

Steps to Reproduce:
1. create an interface (ifcfg file manually or with nmcli)
2. nmcli connection modify vlan1006 ipv4.never-default yes
3. nmcli con mod vlan1006 ipv4.gateway 192.168.100.1 


Actual results:

No output error is shown and ipv4 gateway is not added. Troubleshooting showed you had to change never-default to "no" for the gateway to be added.

Expected results:

Customer would expect this to throw an error. Not sure if this is a bug or RFE. I am explaining to customer that likely this is because of how default routes used to work with /etc/sysconfig/gateway and setting gateway with DEFROUTE=yes however this is deprecated so it does make sense this should throw an error. 

Additional info:

Comment 6 Thomas Haller 2020-04-08 14:13:18 UTC
dropping from RPL-8.3, it's already on the RPL-7.9.

Comment 7 Thomas Haller 2020-04-22 12:40:53 UTC
upstream fix on review: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/475

Comment 9 Thomas Haller 2020-04-22 20:38:50 UTC
now nmcli is changed.

when you set ipv4.gateway (ipv6.gateway) on the command line, then it also will set ipvx.never-default to no.

that means,

  nmcli connection modify "$PROFILE" ipv4.never-default yes ipv4.gateway 192.168.1.1

results in never-default "no"... because the latter setting of gateway wins. At first that might seem odd, but in general, if you specify an option (or overlapping options like in this case) multiple times, then the last one wins. That is now fixed.

Comment 14 errata-xmlrpc 2020-09-29 20:30:25 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 (Moderate: NetworkManager security and bug fix 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/RHSA-2020:4003