Bug 1634274

Summary: ip-address can add IPv4 with nodad option
Product: Red Hat Enterprise Linux 8 Reporter: yiche <yiche>
Component: iprouteAssignee: Andrea Claudi <aclaudi>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: aclaudi, atragler, jaster
Target Milestone: pre-dev-freeze   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iproute-5.3.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:43:54 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: 1679662, 1752857    
Bug Blocks:    

Description yiche 2018-09-29 14:09:02 UTC
Description of problem:
nodad option should be IPv6 only and shouldn't be added success with a IPv4 address,people may get confused.

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

How reproducible:
always

Steps to Reproduce:
1.ip link add dumy0 type dummy
2.ip -4 addr add 192.168.1.1 dev dumy0 nodad
3.ip a

Actual results:
dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 22:87:91:b4:38:d9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/32 scope global nodad dumy0

Expected results:
ip tool should gives error.

Additional info:

Comment 2 Phil Sutter 2018-11-16 15:14:33 UTC
This is not a regression, consistent with upstream and no customer request. Hence moving this ticket to RHEL8.

Comment 4 Andrea Claudi 2019-06-24 15:36:52 UTC
This happens for 'home' and 'mngtmpaddr', too. Will fix all of these in a patch series upstream.

Comment 5 Andrea Claudi 2019-06-24 17:15:50 UTC
Patch posted upstream: https://patchwork.ozlabs.org/project/netdev/list/?series=115819

Comment 6 Andrea Claudi 2019-06-29 10:27:22 UTC
Merged upstream as:

commit 8ae99cc46d7713069ee626a4ce4335aaeca9892f
Author: Andrea Claudi <aclaudi>
Date:   Tue Jun 25 12:29:55 2019 +0200

    ip address: do not set nodad option for IPv4 addresses

commit e4448b6c7de934f26654d4db84119c0423923719
Author: Andrea Claudi <aclaudi>
Date:   Tue Jun 25 12:29:56 2019 +0200

    ip address: do not set home option for IPv4 addresses

commit 68c46872ce4394376c8b5e804be4f5a2bbd43828
Author: Andrea Claudi <aclaudi>
Date:   Tue Jun 25 12:29:57 2019 +0200

    ip address: do not set mngtmpaddr option for IPv4 addresses

Comment 8 Jaroslav Aster 2019-11-12 17:55:07 UTC
Hi Andrea,

I tested this bug and I would like to ask whether or not iproute acts correct from your POV.

# ip link add test type dummy
# ip addr add 172.29.5.1/24 dev test nodad
Warning: nodad option can be set only for IPv6 addresses
# echo $?
0
# ip addr show dev test | grep 172.29.5.1
    inet 172.29.5.1/24 scope global test

iproute returns zero, even if I set option which is not valid for ipv4 and, at the same time, ipv4 address is set on the interface. I would expect non-zero return and not setting ipv4 address on the interface. What do you thing?

Comment 9 Andrea Claudi 2019-11-22 13:34:12 UTC
(In reply to Jaroslav Aster from comment #8)
> Hi Andrea,
> 
> I tested this bug and I would like to ask whether or not iproute acts
> correct from your POV.
> 
> # ip link add test type dummy
> # ip addr add 172.29.5.1/24 dev test nodad
> Warning: nodad option can be set only for IPv6 addresses
> # echo $?
> 0
> # ip addr show dev test | grep 172.29.5.1
>     inet 172.29.5.1/24 scope global test
> 
> iproute returns zero, even if I set option which is not valid for ipv4 and,
> at the same time, ipv4 address is set on the interface. I would expect
> non-zero return and not setting ipv4 address on the interface. What do you
> thing?

This is debatable, but before my commit specifying nodad on an ipv4 address simply ignore it and set the address; now iproute displays a warning message, but set the address as before.
Changing this behaviour can break existing script setup, and I would avoid that if possible.

Comment 13 errata-xmlrpc 2020-04-28 16:43:54 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, 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/RHBA-2020:1785