From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: Re: [PATCH] pkttype match mismatches on locally generated packets
Date: Mon, 17 Jul 2006 18:08:49 -0700 [thread overview]
Message-ID: <20060718010849.GA1221@linuxace.com> (raw)
In-Reply-To: <20060718010642.GA1203@linuxace.com>
[-- Attachment #1: Type: text/plain, Size: 632 bytes --]
On Mon, Jul 17, 2006 at 06:06:42PM -0700, Phil Oester wrote:
> Locally generated broadcast and multicast packets have pkttype set to
> PACKET_LOOPBACK instead of PACKET_BROADCAST or PACKET_MULTICAST. This
> causes the pkttype match to fail to match packets of either type.
>
> The below patch remedies this by using the daddr as a hint as to
> broadcast|multicast. While not pretty, this seems like the only way
> to solve the problem short of just noting this as a limitation of the match.
>
> This resolves bug #484
>
> Phil
>
> Signed-off-by: Phil Oester <kernel@linuxace.com>
And this time the patch is attached...
Phil
[-- Attachment #2: patch-pkttype --]
[-- Type: text/plain, Size: 844 bytes --]
--- linux-dellfw/net/netfilter/xt_pkttype.c 2006-06-17 21:49:35.000000000 -0400
+++ linux-po/net/netfilter/xt_pkttype.c 2006-07-17 20:56:39.000000000 -0400
@@ -9,6 +9,8 @@
#include <linux/skbuff.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
+#include <linux/in.h>
+#include <linux/ip.h>
#include <linux/netfilter/xt_pkttype.h>
#include <linux/netfilter/x_tables.h>
@@ -28,9 +30,17 @@
unsigned int protoff,
int *hotdrop)
{
+ u_int8_t type;
const struct xt_pkttype_info *info = matchinfo;
- return (skb->pkt_type == info->pkttype) ^ info->invert;
+ if (skb->pkt_type == PACKET_LOOPBACK)
+ type = (MULTICAST(skb->nh.iph->daddr)
+ ? PACKET_MULTICAST
+ : PACKET_BROADCAST);
+ else
+ type = skb->pkt_type;
+
+ return (type == info->pkttype) ^ info->invert;
}
static struct xt_match pkttype_match = {
next prev parent reply other threads:[~2006-07-18 1:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-18 1:06 [PATCH] pkttype match mismatches on locally generated packets Phil Oester
2006-07-18 1:08 ` Phil Oester [this message]
2006-07-20 16:20 ` 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=20060718010849.GA1221@linuxace.com \
--to=kernel@linuxace.com \
--cc=netfilter-devel@lists.netfilter.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.