From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] iptables: new strict host model match
Date: Mon, 02 Mar 2009 12:02:05 +0100 [thread overview]
Message-ID: <49ABBCAD.9030203@trash.net> (raw)
In-Reply-To: <20090226175247.5e56910f@nehalam>
Stephen Hemminger wrote:
> This is a simple little iptables match that can be used to create the Strong
> End System model, that router and other non-Linux customers expect. There
> are management and other applications that use ping and expect to only get
> a response when the interface with that address is up. Normally, a Linux
> system will respond to a packet that arrives for any of the system addresses
> independent of which link it arrives on.
>
> The module can be used on the INPUT chain like:
>
> # iptables -P INPUT DROP
> # iptables -A INPUT -m strict -j ACCEPT
The idea makes sense ..
> +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;
> +}
I'm not sure this is correct, I think it will only allow communication
with truely on-link addresses, meaning it won't accept routed packets
going to the interface address. Generally I don't think this can be
fully done in iptables since you'd still have to deal with ARP etc.
An IPv4 sysctl might be more appropriate.
Just for the IPv4 packets, I'm wondering if the intended result could
be achieved using the addrtype match. Something like:
-m addrtype --limit-iface-in --dst-type LOCAL
should check whether the destination address is local to the receiving
interface.
next prev parent reply other threads:[~2009-03-02 11:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 1:52 [PATCH] iptables: new strict host model match Stephen Hemminger
2009-02-27 3:16 ` Jan Engelhardt
2009-02-27 3:23 ` Stephen Hemminger
2009-02-27 8:30 ` Jozsef Kadlecsik
2009-02-28 1:53 ` Jan Engelhardt
2009-02-28 2:10 ` Stephen Hemminger
2009-02-28 8:27 ` Jan Engelhardt
2009-03-02 11:02 ` Patrick McHardy [this message]
2009-03-02 13:42 ` Jesper Dangaard Brouer
2009-03-02 13:46 ` Denys Fedoryschenko
2009-03-02 18:53 ` Stephen Hemminger
2009-03-02 22:12 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49ABBCAD.9030203@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).