From: JC <bikkit@gmail.com>
To: netfilter-devel@lists.netfilter.org, netfilter@lists.netfilter.org
Subject: netfilter hook function error...
Date: Wed, 21 Sep 2005 01:13:43 +0100 [thread overview]
Message-ID: <a60102c3050920171352ae872c@mail.gmail.com> (raw)
my hook function code, called at :
unsigned int in_hook(unsigned int hooknum,
struct sk_buff **skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
print_string("Packet reached IN_HOOK.");
struct iphdr *my_ipheader;
//u32 this_address;
if (out)
{
if(out->name)
{
print_string("out is: ");
print_string(out->name);
// compare the out device with the list of rules
// TODO: replace by matches_rule()
if (strcmp(out->name, "eth1") == 0)
{
print_string("packet matches rule");
if(skb == NULL)
{
return -1;
}
my_ipheader = skb->nh->iph;
print_string("printk-ing saddr...");
//this_address = *my_ipheader->saddr;
//printk("the ip is : %d.%d.%d.%d\n",NIPQUAD(*my_ipheader->saddr));
}
}
else
{
print_string("out is null");
}
}
return NF_QUEUE; /* Drop ALL packets */
}
line 150 is my_ipheader = skb->nh->iph;
on compile, I get this error:
[root@whatever spider]# make -C /usr/src/kernels/`uname -r`-i686
SUBDIRS=$PWD modules
make: Entering directory `/usr/src/kernels/2.6.12-1.1447_FC4-i686'
CC [M] /home/jc/code/spider/spider.o
/home/jc/code/spider/spider.c: In function 'in_hook':
/home/jc/code/spider/spider.c:126: warning: ISO C90 forbids mixed
declarations and code
/home/jc/code/spider/spider.c:134: warning: passing argument 1 of
'print_string' discards qualifiers from pointer target type
/home/jc/code/spider/spider.c:150: error: request for member 'nh' in
something not a structure or union
I've seen that statement being made more than a number of times, so
what am I doing wrong??
I need to change the saddr (source address) in that if to another one
(basicly, NATing it). How will I commit that change to the skb and
then send it back into the stack?
thanx in advance...
John
next reply other threads:[~2005-09-21 0:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-21 0:13 JC [this message]
2005-09-21 1:14 ` netfilter hook function error JC
2005-09-21 5:51 ` Patrick Schaaf
2005-09-21 6:09 ` JC
[not found] <4330b900.50a87b17.7179.ffffad17SMTPIN_ADDED@mx.gmail.com>
2005-09-21 1:49 ` JC
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=a60102c3050920171352ae872c@mail.gmail.com \
--to=bikkit@gmail.com \
--cc=netfilter-devel@lists.netfilter.org \
--cc=netfilter@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.