]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip-address: Fix filtering by negated address flags
authorPhil Sutter <phil@nwl.cc>
Thu, 15 Nov 2018 13:28:59 +0000 (14:28 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 19 Nov 2018 19:38:24 +0000 (11:38 -0800)
commit133db49b499dea048a40ff62b5649521d4b22dcd
tree94a66cbdfa47c7de8d5ab639ce069329e4096756
parent87e3ec0e2fb420256a92ca3bcc6f8aa2d5f7ea86
ip-address: Fix filtering by negated address flags

When disabling a flag, one needs to AND with the inverse not the flag
itself. Otherwise specifying for instance 'home -nodad' will effectively
clear the flags variable.

While being at it, simplify the code a bit by merging common parts of
negated and non-negated case branches. Also allow for the "special
cases" to be inverted, too.

Fixes: f73ac674d0abf ("ip: change flag names to an array")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipaddress.c
man/man8/ip-address.8.in