Usually we check ipsec_in_use as shortcut to avoid IPsec lookups,
authorbluhm <bluhm@openbsd.org>
Sun, 6 Mar 2022 15:24:50 +0000 (15:24 +0000)
committerbluhm <bluhm@openbsd.org>
Sun, 6 Mar 2022 15:24:50 +0000 (15:24 +0000)
commit0591e6d89100bb45ac89c92489429a186bfcae20
treef84c8af11029072313e90b0bed4861adc6f5e6e9
parent49904ff2a27a1b55f2f8203c2115a6677a83ecf4
Usually we check ipsec_in_use as shortcut to avoid IPsec lookups,
but that does not work when coming from tcp_output() as inp != NULL.
This seems to be done to block packets from sockets with options
in inp_seclevel.  But instead of doing the route lookup, go directly
to ipsp_spd_inp() where the socket policy checks are done.  Calling
rtable_l2() before the shortcut also costs a bit, do it when needed.
OK tobhe@
sys/netinet/ip_spd.c