| 207 | } |
| 208 | |
| 209 | static void |
| 210 | enc_bpftap(struct ifnet *ifp, struct mbuf *m, const struct secasvar *sav, |
| 211 | int32_t hhook_type, uint8_t enc, uint8_t af) |
| 212 | { |
| 213 | struct enchdr hdr; |
| 214 | |
| 215 | if (hhook_type == HHOOK_TYPE_IPSEC_IN && |
| 216 | (enc & V_bpf_mask_in) == 0) |
| 217 | return; |
| 218 | else if (hhook_type == HHOOK_TYPE_IPSEC_OUT && |
| 219 | (enc & V_bpf_mask_out) == 0) |
| 220 | return; |
| 221 | if (bpf_peers_present(ifp->if_bpf) == 0) |
| 222 | return; |
| 223 | hdr.af = af; |
| 224 | hdr.spi = sav->spi; |
| 225 | hdr.flags = 0; |
| 226 | if (sav->alg_enc != SADB_EALG_NONE) |
| 227 | hdr.flags |= M_CONF; |
| 228 | if (sav->alg_auth != SADB_AALG_NONE) |
| 229 | hdr.flags |= M_AUTH; |
| 230 | bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), m); |
| 231 | } |
| 232 | |
| 233 | /* |
| 234 | * One helper hook function is used by any hook points. |
no test coverage detected