Skip to content

Commit f59bbdf

Browse files
Fan Duklassert
authored andcommitted
xfrm: Simplify SA looking up when using wildcard source
__xfrm4/6_state_addr_check is a four steps check, all we need to do is checking whether the destination address match when looking SA using wildcard source address. Passing saddr from flow is worst option, as the checking needs to reach the fourth step while actually only one time checking will do the work. So, simplify this process by only checking destination address when using wildcard source address for looking up SAs. Signed-off-by: Fan Du <fan.du@windriver.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 6f11563 commit f59bbdf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/xfrm/xfrm_state.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
824824
x->props.reqid == tmpl->reqid &&
825825
(mark & x->mark.m) == x->mark.v &&
826826
!(x->props.flags & XFRM_STATE_WILDRECV) &&
827-
xfrm_state_addr_check(x, daddr, saddr, encap_family) &&
827+
xfrm_addr_equal(&x->id.daddr, daddr, encap_family) &&
828828
tmpl->mode == x->props.mode &&
829829
tmpl->id.proto == x->id.proto &&
830830
(tmpl->id.spi == x->id.spi || !tmpl->id.spi))

0 commit comments

Comments
 (0)