MCPcopy Create free account
hub / github.com/F-Stack/f-stack / enc_bpftap

Function enc_bpftap

freebsd/net/if_enc.c:209–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209static void
210enc_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.

Callers 1

enc_hhookFunction · 0.85

Calls 2

bpf_mtap2Function · 0.85
bpf_peers_presentFunction · 0.70

Tested by

no test coverage detected