[Devel] [PATCH RH7 1/2] ms/xfrm: fix a warning in xfrm_policy_insert_list

2020-12-18 Thread Vasily Averin
From: Xin Long This waring can be triggered simply by: # ip xfrm policy update src 192.168.1.1/24 dst 192.168.1.2/24 dir in \ priority 1 mark 0 mask 0x10 #[1] # ip xfrm policy update src 192.168.1.1/24 dst 192.168.1.2/24 dir in \ priority 2 mark 0 mask 0x1 #[2] # ip xfrm policy

[Devel] [PATCH RH7 2/2] ms/xfrm: policy: match with both mark and mask on user interfaces

2020-12-18 Thread Vasily Averin
From: Xin Long In commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"), it would take 'priority' to make a policy unique, and allow duplicated policies with different 'priority' to be added, which is not expected by userland, as Tobias reported in strongswan. To fix this duplic

[Devel] [PATCH RH7 3/4] ms/netfilter: nft_set_rbtree: check for inactive element after flag mismatch

2020-12-18 Thread Vasily Averin
From: Pablo Neira Ayuso Otherwise, we hit bogus ENOENT when removing elements. Fixes: e701001e7cbe ("netfilter: nft_rbtree: allow adjacent intervals with dynamic updates") Reported-by: Václav Zindulka Signed-off-by: Pablo Neira Ayuso (cherry-picked from commit 05b7639da55fb9866a1f4b7e899

[Devel] [PATCH RH7 4/4] ms/netfilter: nft_set_rbtree: bogus lookup/get on consecutive elements in named sets

2020-12-18 Thread Vasily Averin
From: Pablo Neira Ayuso The existing rbtree implementation might store consecutive elements where the closing element and the opening element might overlap, eg. [ a, a+1) [ a+1, a+2) This patch removes the optimization for non-anonymous sets in the exact matching case, where it is assum

[Devel] [PATCH RH7 1/4] ms/netfilter: nft_rbtree: allow adjacent intervals with dynamic updates

2020-12-18 Thread Vasily Averin
From: Pablo Neira Ayuso This patch fixes dynamic element updates for adjacent intervals in the rb-tree representation. Since elements are sorted in the rb-tree, in case of adjacent nodes with the same key, the assumption is that an interval end node must be placed before an interval opening. In

[Devel] [PATCH RH7 2/4] ms/netfilter: nft_set_rbtree: handle element re-addition after deletion

2020-12-18 Thread Vasily Averin
From: Pablo Neira Ayuso The existing code selects no next branch to be inspected when re-inserting an inactive element into the rb-tree, looping endlessly. This patch restricts the check for active elements to the EEXIST case only. Fixes: e701001e7cbe ("netfilter: nft_rbtree: allow adjacent inte