All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: prasanna@in.ibm.com
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org, ak@muc.de,
	akpm@osdl.org, suparna@in.ibm.com
Subject: Re: [3/3] kprobes-netpktlog-268-rc3.patch
Date: Thu, 05 Aug 2004 13:17:16 +0200	[thread overview]
Message-ID: <m33c31ygub.fsf@averell.firstfloor.org> (raw)
In-Reply-To: <2pNvS-1CQ-1@gated-at.bofh.it> (Prasanna S. Panchamukhi's message of "Thu, 05 Aug 2004 12:20:04 +0200")

Prasanna S Panchamukhi <prasanna@in.ibm.com> writes:
> +
> +static struct jprobe netpkt[] = {
> +	{
> +		{.addr = (kprobe_opcode_t *) netif_rx},
> +		.entry = (kprobe_opcode_t *) jnetif_rx

[...] Perhaps it would be better to resolve this using kallsyms. 
This way you could support the user passing a list of functions
they want to be traced. and you wouldn't need to add all these 
EXPORT_SYMBOLS.

> +
> +	printk("Filtering of network packets enabled...\n");

Nit - it doesn't filter anything.

> +
> +static inline void netfilter_ip(struct sk_buff *skb)
> +{
> +	struct ipt_log_info info;
> +	struct iphdr *iph;
> +	/* Log IP options */
> +	info.logflags = IPT_LOG_IPOPT;
> +
> +	/*
> +	 * Check if the protocol is IP before dumping the packet.
> +	 */
> +	if (skb->protocol == htons(ETH_P_IP) )
> +	{
> +		iph = (struct iphdr *) skb->data;
> +
> +		if ((src_ip == 0 && iph->daddr == tgt_ip)
> +			|| (tgt_ip == 0 && iph->saddr == src_ip)
> +			|| (iph->saddr == src_ip && iph->daddr == tgt_ip))

This looks a bit fragile. I don't think skb->data == iphdr is guaranteed
everywhere (I'm surprised it works for your dupack hook for example, Does it
really?). Better is to use skb->nh.iph, but that is also not true
everywhere. Better would be probably to let this be passed
by the individual hook function.

Also a Lindent run on the file couldn't hurt.

-Andi


       reply	other threads:[~2004-08-05 11:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2pNvS-1CQ-1@gated-at.bofh.it>
2004-08-05 11:17 ` Andi Kleen [this message]
2004-08-05 10:11 [3/3] kprobes-netpktlog-268-rc3.patch Prasanna S Panchamukhi

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=m33c31ygub.fsf@averell.firstfloor.org \
    --to=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    --cc=suparna@in.ibm.com \
    --cc=torvalds@osdl.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.