UPSTREAM: xfrm: Make set-mark Defenderault behavior backward compatible
authorBenedict Wong <benedictwong@google.com>
Mon, 14 Jan 2019 19:24:38 +0000 (11:24 -0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:32:15 +0000 (17:32 +0800)
commit0b8b1ed2998bcc3ac6729b38032ef4bf67bbf0ed
tree4ecac130984afa00178e78e5e1d16615f11fc12e
parent35b4fe32bbf2ed4a2801ffbeb9f1165cbab143dc
UPSTREAM: xfrm: Make set-mark Defenderault behavior backward compatible

Fixes 9b42c1f, which changed the Defenderault route lookup behavior for
tunnel mode SAs in the outbound direction to use the skb mark, whereas
previously mark=0 was used if the output mark was unspecified. In
mark-based routing schemes such as Android’s, this change in Defenderault
behavior causes routing loops or lookup failures.

This patch restores the Defenderault behavior of using a 0 mark while still
incorporating the skb mark if the SET_MARK (and SET_MARK_MASK) is
specified.

Tested with additions to Android's kernel unit test suite:
https://android-review.googlesource.com/c/kernel/tests/+/860150

Fixes: 9b42c1f ("xfrm: Extend the output_mark to support input direction and masking")
Signed-off-by: Benedict Wong <benedictwong@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit e2612cd496e7b465711d219ea6118893d7253f52)
Bug: 122236988
Test: Passes kernel tests
Change-Id: I1289b5b7b1eb93c6d99a0ba7d28e24c3eb25883d
Signed-off-by: Benedict Wong <benedictwong@google.com>
net/xfrm/xfrm_policy.c