public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap•net>
To: Patrick McHardy <kaber@trash•net>
Cc: netdev@vger•kernel.org, David Miller <davem@davemloft•net>,
	"Paul E. McKenney" <paulmck@linux•vnet.ibm.com>,
	Netfilter Development Mailinglist
	<netfilter-devel@vger•kernel.org>,
	Jan Engelhardt <jengelh@medozas•de>
Subject: Re: Passive OS fingerprint xtables match.
Date: Sun, 7 Jun 2009 19:12:18 +0400	[thread overview]
Message-ID: <20090607151218.GA31757@ioremap.net> (raw)
In-Reply-To: <4A290767.6080202@trash.net>

Hi Patrick.

I've added mentioned cleanups except the one described below.

On Fri, Jun 05, 2009 at 01:54:15PM +0200, Patrick McHardy (kaber@trash•net) wrote:

> >+	tcp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(struct tcphdr), 
> >&_tcph);
> >+	if (!tcp)
> >+		return false;
> >+
> >+	if (!tcp->syn)
> >+		return false;
> >+
> >+	totlen = ntohs(ip->tot_len);
> >+	df = ntohs(ip->frag_off) & IP_DF;
> >+	window = ntohs(tcp->window);
> >+
> >+	if (tcp->doff * 4 > sizeof(struct tcphdr)) {
> >+		optsize = tcp->doff * 4 - sizeof(struct tcphdr);
> 
> tcp_optlen()?

TCP header is potentially copied above and transport header may be not
set, so I work with that part of skb without assuming it was previously
set by lower layers.

> >+		if (info->flags & XT_OSF_LOG) {
> >+			if (info->loglevel != XT_OSF_LOGLEVEL_ALL_KNOWN)
> >+				nf_log_packet(p->hooknum, 0, skb, p->in, 
> >p->out, NULL,
> >+					"window: %u, mss: %u, totlen: %u, 
> >df: %d, ttl: %u : ",
> >+					window, mss, totlen, df, ip->ttl);
> 
> nf_log_packet() can pass the entire packet to userspace. Header-field
> extraction should be done by whatever is logging in userspace. This
> looks very much like debugging anyways, where is the actual message?

Message itself is 'printed' couple of lines below, but apparently it is
not needed for nf_log_packet, only for the printk()-based debug, so I
dropped that part.

-- 
	Evgeniy Polyakov

  parent reply	other threads:[~2009-06-07 15:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 16:22 Passive OS fingerprint xtables match Evgeniy Polyakov
2009-06-05 11:54 ` Patrick McHardy
2009-06-05 13:10   ` Jan Engelhardt
2009-06-05 13:30     ` Patrick McHardy
2009-06-05 13:44       ` Jan Engelhardt
2009-06-07 15:12   ` Evgeniy Polyakov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-06-07 15:17 Evgeniy Polyakov
2009-06-08 15:06 ` Patrick McHardy
2009-06-08 17:25   ` Evgeniy Polyakov
2009-03-26 14:14 Evgeniy Polyakov
2009-03-26 14:18 ` Patrick McHardy
2009-03-26 14:59   ` Evgeniy Polyakov
2009-03-26 15:08     ` Patrick McHardy
2009-03-26 15:41       ` Evgeniy Polyakov
2009-03-26 15:47         ` Patrick McHardy
2009-03-30  6:20           ` Evgeniy Polyakov
2009-05-01 20:15             ` Evgeniy Polyakov
2009-03-10 15:13 Evgeniy Polyakov
2009-03-10 16:01 ` Evgeniy Polyakov
2009-03-10 16:07 ` Jan Engelhardt
2009-03-11 21:43   ` Evgeniy Polyakov
2009-03-10 21:01 ` Jesper Dangaard Brouer
2009-03-10 21:54   ` Evgeniy Polyakov
2009-03-16 14:40   ` Patrick McHardy
2009-03-11  9:54 ` Pablo Neira Ayuso
2009-03-11 10:00   ` Evgeniy Polyakov
2009-03-16 14:42     ` Patrick McHardy
2009-02-12 17:12 Evgeniy Polyakov
2009-02-12 17:42 ` Paul E. McKenney
2009-02-12 17:51   ` Evgeniy Polyakov
2009-02-12 20:41     ` Paul E. McKenney
2009-02-18 14:55   ` Patrick McHardy
2009-02-12 18:22 ` Jan Engelhardt
2009-02-12 18:57   ` Evgeniy Polyakov
2009-02-12 20:12     ` Jan Engelhardt
2009-02-13 13:03       ` Evgeniy Polyakov
2009-02-13 13:51         ` Jan Engelhardt
2009-02-13 14:22           ` Evgeniy Polyakov
2009-02-13 14:41             ` Jan Engelhardt
2009-02-15 17:32               ` Evgeniy Polyakov
2009-02-18 15:02         ` Patrick McHardy
2009-02-18 15:07           ` Evgeniy Polyakov
2009-02-18 15:30             ` Jan Engelhardt
2009-02-19 11:56               ` Evgeniy Polyakov
2009-02-18 15:00       ` Patrick McHardy
2009-02-18 15:28         ` Jan Engelhardt
2009-02-18 15:14 ` Patrick McHardy
2009-01-29 17:20 Evgeniy Polyakov
2009-01-30  1:05 ` Paul E. McKenney
2009-02-09 16:09 ` Patrick McHardy
2009-02-13 12:49   ` Evgeniy Polyakov
2009-01-27 22:55 Evgeniy Polyakov
2009-01-29  3:36 ` Paul E. McKenney
2009-01-29 15:03   ` Evgeniy Polyakov

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=20090607151218.GA31757@ioremap.net \
    --to=zbr@ioremap$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=jengelh@medozas$(echo .)de \
    --cc=kaber@trash$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=netfilter-devel@vger$(echo .)kernel.org \
    --cc=paulmck@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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