]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
xfrm: enable to set non-wildcard mark 0 on SAs and SPs
authorChristophe Gouault <christophe.gouault@6wind.com>
Tue, 8 Oct 2013 12:56:54 +0000 (05:56 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 9 Oct 2013 22:29:05 +0000 (15:29 -0700)
ip xfrm considers that the user-defined mark is "any" as soon as
(mark.v & mark.m == 0), which prevents from specifying non-wildcard
marks that include the value 0 (typically 0/0xffffffff).

Yet, matching exactly mark 0 is useful for instance to separate
vti policies from global policies.

Always configure the user mark if mark.m != 0.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
ip/xfrm_policy.c
ip/xfrm_state.c

index 36e33c982efdbfd4f93abb7263509af4a422d549..a8d8b98bafd93b9fad476d17ac341fbf6ba45b77 100644 (file)
@@ -373,7 +373,7 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
                          (void *)tmpls_buf, tmpls_len);
        }
 
-       if (mark.m & mark.v) {
+       if (mark.m) {
                int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK,
                                  (void *)&mark, sizeof(mark));
                if (r < 0) {
index f4ad4cb15108cf71d4970342676e7f69416ba388..c4d2bf6768021c1d76a16c92ab5b67cd55381dc1 100644 (file)
@@ -528,7 +528,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
                exit(1);
        }
 
-       if (mark.m & mark.v) {
+       if (mark.m) {
                int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK,
                                  (void *)&mark, sizeof(mark));
                if (r < 0) {