[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.00.0902270414290.14912@fbirervta.pbzchgretzou.qr>
Date: Fri, 27 Feb 2009 04:16:19 +0100 (CET)
From: Jan Engelhardt <jengelh@...ozas.de>
To: Stephen Hemminger <shemminger@...tta.com>
cc: Patrick McHardy <kaber@...sh.net>,
David Miller <davem@...emloft.net>,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] iptables: new strict host model match
On Friday 2009-02-27 02:52, Stephen Hemminger wrote:
>+static bool strict_mt(const struct sk_buff *skb, const struct xt_match_param *par)
>+{
>+ struct in_device *in_dev;
>+ bool ret;
>+
>+ rcu_read_lock();
>+ in_dev = __in_dev_get_rcu(skb->dev);
>+ ret = (in_dev && inet_addr_onlink(in_dev, ip_hdr(skb)->daddr, 0));
>+ rcu_read_unlock();
>+
>+ return ret;
>+}
This looks easy enough to also do for IPv6. Would you?
>+static struct xt_match strict_mt_reg __read_mostly = {
>+ .name = "strict",
>+ .family = NFPROTO_IPV4,
>+ .match = strict_mt,
>+ .matchsize = 0,
>+ .me = THIS_MODULE,
>+};
The match seems to make the most sense where an input device
is available, so
.hooks = (1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD)
should probably be added.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists