Ejemplo n.º 1
0
static bool
policy_mt(const struct sk_buff *skb, const struct xt_action_param *par)
{
	const struct xt_policy_info *info = par->matchinfo;
	int ret;

	if (info->flags & XT_POLICY_MATCH_IN)
		ret = match_policy_in(skb, info, par->match->family);
	else
		ret = match_policy_out(skb, info, par->match->family);

	if (ret < 0)
		ret = info->flags & XT_POLICY_MATCH_NONE ? true : false;
	else if (info->flags & XT_POLICY_MATCH_NONE)
		ret = false;

	return ret;
}
Ejemplo n.º 2
0
static bool
policy_mt(const struct sk_buff *skb, const struct net_device *in,
          const struct net_device *out, const struct xt_match *match,
          const void *matchinfo, int offset, unsigned int protoff,
          bool *hotdrop)
{
    const struct xt_policy_info *info = matchinfo;
    int ret;

    if (info->flags & XT_POLICY_MATCH_IN)
        ret = match_policy_in(skb, info, match->family);
    else
        ret = match_policy_out(skb, info, match->family);

    if (ret < 0)
        ret = info->flags & XT_POLICY_MATCH_NONE ? true : false;
    else if (info->flags & XT_POLICY_MATCH_NONE)
        ret = false;

    return ret;
}