View | Details | Raw Unified | Return to bug 235411
Collapse All | Expand All

(-)b/sys/netpfil/pf/pf_ioctl.c (-20 / +24 lines)
Lines 4002-4007 shutdown_pf(void) Link Here
4002
	return (error);
4002
	return (error);
4003
}
4003
}
4004
4004
4005
static pfil_return_t
4006
pf_check_return(int chk, struct mbuf **m)
4007
{
4008
4009
	switch (chk) {
4010
	case PF_PASS:
4011
		if (*m == NULL)
4012
			return (PFIL_CONSUMED);
4013
		else
4014
			return (PFIL_PASS);
4015
		break;
4016
	default:
4017
		if (*m != NULL) {
4018
			m_freem(*m);
4019
			*m = NULL;
4020
		}
4021
		return (PFIL_DROPPED);
4022
	}
4023
}
4024
4005
#ifdef INET
4025
#ifdef INET
4006
static pfil_return_t
4026
static pfil_return_t
4007
pf_check_in(struct mbuf **m, struct ifnet *ifp, int flags,
4027
pf_check_in(struct mbuf **m, struct ifnet *ifp, int flags,
Lines 4010-4021 pf_check_in(struct mbuf **m, struct ifnet *ifp, int flags, Link Here
4010
	int chk;
4030
	int chk;
4011
4031
4012
	chk = pf_test(PF_IN, flags, ifp, m, inp);
4032
	chk = pf_test(PF_IN, flags, ifp, m, inp);
4013
	if (chk && *m) {
4014
		m_freem(*m);
4015
		*m = NULL;
4016
	}
4017
4033
4018
	return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
4034
	return (pf_check_return(chk, m));
4019
}
4035
}
4020
4036
4021
static pfil_return_t
4037
static pfil_return_t
Lines 4025-4036 pf_check_out(struct mbuf **m, struct ifnet *ifp, int flags, Link Here
4025
	int chk;
4041
	int chk;
4026
4042
4027
	chk = pf_test(PF_OUT, flags, ifp, m, inp);
4043
	chk = pf_test(PF_OUT, flags, ifp, m, inp);
4028
	if (chk && *m) {
4029
		m_freem(*m);
4030
		*m = NULL;
4031
	}
4032
4044
4033
	return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
4045
	return (pf_check_return(chk, m));
4034
}
4046
}
4035
#endif
4047
#endif
4036
4048
Lines 4049-4060 pf_check6_in(struct mbuf **m, struct ifnet *ifp, int flags, Link Here
4049
	CURVNET_SET(ifp->if_vnet);
4061
	CURVNET_SET(ifp->if_vnet);
4050
	chk = pf_test6(PF_IN, flags, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp);
4062
	chk = pf_test6(PF_IN, flags, (*m)->m_flags & M_LOOP ? V_loif : ifp, m, inp);
4051
	CURVNET_RESTORE();
4063
	CURVNET_RESTORE();
4052
	if (chk && *m) {
4053
		m_freem(*m);
4054
		*m = NULL;
4055
	}
4056
4064
4057
	return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
4065
	return (pf_check_return(chk, m));
4058
}
4066
}
4059
4067
4060
static pfil_return_t
4068
static pfil_return_t
Lines 4066-4077 pf_check6_out(struct mbuf **m, struct ifnet *ifp, int flags, Link Here
4066
	CURVNET_SET(ifp->if_vnet);
4074
	CURVNET_SET(ifp->if_vnet);
4067
	chk = pf_test6(PF_OUT, flags, ifp, m, inp);
4075
	chk = pf_test6(PF_OUT, flags, ifp, m, inp);
4068
	CURVNET_RESTORE();
4076
	CURVNET_RESTORE();
4069
	if (chk && *m) {
4070
		m_freem(*m);
4071
		*m = NULL;
4072
	}
4073
4077
4074
	return (chk == PF_PASS ? PFIL_PASS : PFIL_DROPPED);
4078
	return (pf_check_return(chk, m));
4075
}
4079
}
4076
#endif /* INET6 */
4080
#endif /* INET6 */
4077
4081

Return to bug 235411