Bug 1914772

Summary: changing auto-route-table-id won't take effect directly
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Fernando F. Mancera <ferferna>
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: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:34:46 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: 2040683    
Bug Blocks:    

Description Mingyu Shi 2021-01-11 08:07:39 UTC
Description of problem:
If an iface with dhcp is running, changing its auto-route-table-id won't take effect directly. It means though config is changed, the routes from DHCP is still installed in old table.

Version-Release number of selected component (if applicable):
nmstate-1.0.1-0.1.el8.noarch
nispor-1.0.1-2.el8.x86_64
NetworkManager-1.30.0-0.5.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
# use dnsmasq as an example
cat << EOF > /etc/dnsmasq.d/nmstate.conf 
interface=veth0_ep
dhcp-range=192.168.199.10,192.168.199.250,255.255.255.0,48h
dhcp-option=option:classless-static-route,198.51.100.0/24,192.168.199.1
dhcp-option=option:dns-server,192.168.199.251
EOF

ip link add veth0 type veth peer veth0_ep
echo "---
interfaces:
- name: veth0
  type: ethernet
  state: up
  ipv4:
    enabled: true
    auto-route-table-id: 1000
    dhcp: true
- name: veth0_ep
  type: ethernet
  state: up
  ipv4:
    enabled: true
    address:
    - ip: 192.168.199.1
      prefix-length: 24" | nmstatectl set

systemctl restart dnsmasq

# do following when veth0 gets dhcp result
ip route ls table 1000
echo "---
interfaces:
- name: veth0
  type: ethernet
  state: up
  ipv4:
    enabled: true
    auto-route-table-id: 1001
    dhcp: true" | nmstatectl set
ip route ls table 1000
ip route ls table 1001


Actual results:
DHCP routes are still installed in table 1000

Expected results:
Installed in 1001

Additional info:
As NM profile was changed, running 'nmcli con up veth0' will take it effect.

Comment 1 Fernando F. Mancera 2021-05-06 12:28:45 UTC
Hi Mingyu, do you mean if you run 'nmcli con up veth0' it will take effect, but if not it won't? Sorry, the reproducer is not clear to me, thank you!

Comment 2 Mingyu Shi 2021-05-12 03:56:52 UTC
(In reply to Fernando F. Mancera from comment #1)
> Hi Mingyu, do you mean if you run 'nmcli con up veth0' it will take effect,
> but if not it won't? Sorry, the reproducer is not clear to me, thank you!

Yes, please refer the following result:

> Steps to Reproduce:
> # use dnsmasq as an example
> cat << EOF > /etc/dnsmasq.d/nmstate.conf 
> interface=veth0_ep
> dhcp-range=192.168.199.10,192.168.199.250,255.255.255.0,48h
> dhcp-option=option:classless-static-route,198.51.100.0/24,192.168.199.1
> dhcp-option=option:dns-server,192.168.199.251
> EOF
> 
> ip link add veth0 type veth peer veth0_ep
> echo "---
> interfaces:
> - name: veth0
>   type: ethernet
>   state: up
>   ipv4:
>     enabled: true
>     auto-route-table-id: 1000
>     dhcp: true
> - name: veth0_ep
>   type: ethernet
>   state: up
>   ipv4:
>     enabled: true
>     address:
>     - ip: 192.168.199.1
>       prefix-length: 24" | nmstatectl set
> 
> systemctl restart dnsmasq
> 
> # do following when veth0 gets dhcp result
> ip route ls table 1000

# ip route ls table 1000
default via 192.168.199.1 dev veth0 proto dhcp metric 101 
192.168.199.0/24 dev veth0 proto kernel scope link src 192.168.199.178 metric 101 
198.51.100.0/24 via 192.168.199.1 dev veth0 proto dhcp metric 101

> echo "---
> interfaces:
> - name: veth0
>   type: ethernet
>   state: up
>   ipv4:
>     enabled: true
>     auto-route-table-id: 1001
>     dhcp: true" | nmstatectl set
> ip route ls table 1000
> ip route ls table 1001

# ip route ls table 1000
default via 192.168.199.1 dev veth0 proto dhcp metric 101 
192.168.199.1 dev veth0 proto dhcp scope link metric 101 
198.51.100.0/24 via 192.168.199.1 dev veth0 proto dhcp metric 101
# ip route ls table 1001
192.168.199.0/24 dev veth0 proto kernel scope link src 192.168.199.178 metric 101

In above, changed auto-route-table-id from 1000 to 1001, but you can see the table 1001 was with only one link local route entry, the routes from DHCP server were still in table 1000

> 
> 
> Actual results:
> DHCP routes are still installed in table 1000
> 
> Expected results:
> Installed in 1001
> 
> Additional info:
> As NM profile was changed, running 'nmcli con up veth0' will take it effect.

After running "nmcli con up veth0", the routes all went to table 1001 and the table 1000 is empty now
[11:44:57@mshi-rhel-850-20210328d2 /etc/yum.repos.d]0# nmcli con up veth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[11:45:07@mshi-rhel-850-20210328d2 /etc/yum.repos.d]0# ip route ls table 1000
[11:45:10@mshi-rhel-850-20210328d2 /etc/yum.repos.d]0# ip route ls table 1001
default via 192.168.199.1 dev veth0 proto dhcp metric 103 
192.168.199.0/24 dev veth0 proto kernel scope link src 192.168.199.178 metric 103 
198.51.100.0/24 via 192.168.199.1 dev veth0 proto dhcp metric 103

Comment 3 Fernando F. Mancera 2022-01-14 13:54:46 UTC
This issue was a NetworkManager problem, they fixed it on main branch and there is a build with the fix now. It can be tested by QA. Thank you for reporting this. https://bugzilla.redhat.com/show_bug.cgi?id=2040683

Comment 7 Mingyu Shi 2022-02-06 07:53:59 UTC
Verified with versions:
nmstate-1.2.1-0.2.alpha2.el8.x86_64
nispor-1.2.2-1.el8.x86_64
NetworkManager-1.36.0-0.3.el8.x86_64

Comment 9 errata-xmlrpc 2022-05-10 13:34:46 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/RHEA-2022:1772