Bug 1655638

Summary: ip -6 route replace adds route instead of replacing it
Product: Red Hat Enterprise Linux 7 Reporter: Phil <beaaegicfqmq6rykaqaakty3lqcg6btv>
Component: iprouteAssignee: Andrea Claudi <aclaudi>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: atragler, rkhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-05 15:57:24 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 Phil 2018-12-03 15:33:49 UTC
Description of problem:

ip -6 route replace default via … should replace the ipv6 default route. Instead, it adds the new default route to the table.

Version-Release number of selected component (if applicable):
kernel 3.10.0-957.el7.x86_64
iproute 4.11.0-14.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. ip -6 route ls default
default via $mydefgw_A dev eth0 metric 1 pref medium
2. ip -6 route replace default via $mydefgw_B
3. ip -6 route ls default
default via $mydefgw_A dev eth0 metric 1 pref medium
default via $mydefgw_B dev eth1 metric 1024 pref medium

Actual results:
two default routes

Expected results:
one default route

Additional info:

Comment 2 Andrea Claudi 2019-06-06 13:16:51 UTC
Since this issue is not critical, I'm moving it to RHEL-7.8.

Comment 3 Andrea Claudi 2019-12-05 15:57:24 UTC
(In reply to Phil from comment #0)
> Description of problem:
> 
> ip -6 route replace default via … should replace the ipv6 default route.
> Instead, it adds the new default route to the table.
> 
> Version-Release number of selected component (if applicable):
> kernel 3.10.0-957.el7.x86_64
> iproute 4.11.0-14.el7.x86_64
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1. ip -6 route ls default
> default via $mydefgw_A dev eth0 metric 1 pref medium
> 2. ip -6 route replace default via $mydefgw_B

With the above command you are effectively requesting to add a new different default route via $mydefgw_B, not to replace the previous one (I know, replace command is a bit misleading).
To replace the default route you must make sure to select it indicating additional params you may have specified during its creation. In your case:

ip -6 route replace default via $mydefgw_B metric 1 pref medium

> 3. ip -6 route ls default
> default via $mydefgw_A dev eth0 metric 1 pref medium
> default via $mydefgw_B dev eth1 metric 1024 pref medium
> 
> Actual results:
> two default routes
> 
> Expected results:
> one default route
> 
> Additional info: