Re: [4/4] Network packet tracer module using kprobes interface.
From: Andi Kleen
Date: Thu Aug 12 2004 - 08:23:17 EST
> +static char config[256];
> +static unsigned short src_port, tgt_port;
> +module_param_string(netpktlog, config, 256, 0);
> +MODULE_PARM_DESC(netpktlog, " netpktlog=@<source-port>,<target-port>\n");
It would be better to use the new style module_parm here, then
it could be even modified from sysfs at runtime when you set suitable
permissions.
> + * with source port. Example insmod netpktlog.ko netpktlog=@62333,
> + * To trace network packets based on target port, insert module with
> + * target port. Example insmod netpktlog.ko netpktlog=@,254
> + */
> +
> +static void jnetif_rx(struct sk_buff *skb)
> +{
> + netfilter_ip(skb);
Are you sure this works? I'm not sure skb->nh.iph is initialized
at this point. At this point you have to skip the ethernet header
yourself.
> +static void j__kfree_skb(struct sk_buff *skb)
> +{
> + netfilter_ip(skb);
This may have the same problem depending on where it is called from.
Should be unlikely enough though that it could be ignored.
> + jprobe_return();
> +}
> +
> +static int jnetif_receive_skb(struct sk_buff *skb)
> +{
> + netfilter_ip(skb);
This function only sets skb->nh.iph
> +#include <net/udp.h>
> +
> +void tcp_send_dupack(struct sock *sk, struct sk_buff *skb);
This shouldn't be needed anymore, no?
> +
> +static inline void option_setup(char *opt)
[...] Not sure why you made these two functions inline?
-andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/