Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_enc.c
Show First 20 Lines • Show All 279 Lines • ▼ Show 20 Lines | case HHOOK_TYPE_IPSEC_OUT: | ||||
break; | break; | ||||
default: | default: | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
switch (hhook_id) { | switch (hhook_id) { | ||||
#ifdef INET | #ifdef INET | ||||
case AF_INET: | case AF_INET: | ||||
ph = &V_inet_pfil_hook; | ph = V_inet_pfil_head; | ||||
break; | break; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
case AF_INET6: | case AF_INET6: | ||||
ph = &V_inet6_pfil_hook; | ph = V_inet6_pfil_head; | ||||
break; | break; | ||||
#endif | #endif | ||||
default: | default: | ||||
ph = NULL; | ph = NULL; | ||||
} | } | ||||
if (ph == NULL || !PFIL_HOOKED(ph)) | if (ph == NULL || (pdir == PFIL_OUT && !PFIL_HOOKED_OUT(ph)) || | ||||
(pdir == PFIL_IN && !PFIL_HOOKED_IN(ph))) | |||||
return (0); | return (0); | ||||
/* Make a packet looks like it was received on enc(4) */ | /* Make a packet looks like it was received on enc(4) */ | ||||
rcvif = (*ctx->mp)->m_pkthdr.rcvif; | rcvif = (*ctx->mp)->m_pkthdr.rcvif; | ||||
(*ctx->mp)->m_pkthdr.rcvif = ifp; | (*ctx->mp)->m_pkthdr.rcvif = ifp; | ||||
if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, 0, ctx->inp) != 0 || | if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, ctx->inp) != PFIL_PASS) { | ||||
*ctx->mp == NULL) { | |||||
*ctx->mp = NULL; /* consumed by filter */ | *ctx->mp = NULL; /* consumed by filter */ | ||||
return (EACCES); | return (EACCES); | ||||
} | } | ||||
(*ctx->mp)->m_pkthdr.rcvif = rcvif; | (*ctx->mp)->m_pkthdr.rcvif = rcvif; | ||||
enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, | enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, | ||||
IPSEC_ENC_AFTER_PFIL, ctx->af); | IPSEC_ENC_AFTER_PFIL, ctx->af); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |