From: "Julien DHERSIN" <dhersin@gmail.com>
To: "Pablo Neira Ayuso" <pablo@netfilter.org>
Cc: Netfilter Development <netfilter-devel@lists.netfilter.org>
Subject: Re: libnetfilter_queue man page
Date: Fri, 2 Mar 2007 14:15:45 +0100 [thread overview]
Message-ID: <2e25cc380703020515h3c1724aclf5381c94a500d199@mail.gmail.com> (raw)
In-Reply-To: <45E578EC.2060803@netfilter.org>
Thanks for your answers.
But, I still have some troubles with this library.
My following code doesn't seem to work. Have you any idea ?
static int read_pkt (struct nfq_data *nfa) {
int payload_len;
struct ip6_hdr * ip6_hdrs;
char * payload;
struct in6_addr * ip6_dest;
char dst[16]; /* char dst[INET6_ADDRSTRLEN]; */
payload_len = nfq_get_payload(nfa, &payload);
if (payload_len == -1)
printf("Error : nfq_get_payload\n");
printf("Length : %d\n", payload_len);
ip6_hdrs = malloc(payload_len);
if(!ip6_hdrs)
printf("Error : malloc\n");
if(!memcpy(ip6_hdrs, payload, payload_len))
printf("Error : memcpy\n");
if (!inet_ntop(AF_INET6, &(ip6_hdrs)->ip6_dst, dst, sizeof(dst)))
fprintf(stdout, "dest: %s\n", dst);
free(ip6_hdrs);
}
And I didn't find any way to cast my payload to cmsg structure (in
order to use the routine defined in RFC3542). Then, I would use some
functions such as inet6_rth_init() to add options in the Hop-by-hop
extension. But maybe I'm on the wrong way.
Thanks for your help.
cu,
Julien
2007/2/28, Pablo Neira Ayuso <pablo@netfilter.org>:
> Julien DHERSIN wrote:
> > But, I still have a question : I would like to add an extension in
> > filtered IPv6
> > multicast packets headers. Do you think, I can do this in the userspace
> > using libnetfilter queue ? And, how precisely does it work ? Is it
> > something like this :
>
> Yes, you can process packets from userspace via libnetfilter_queue.
>
> > 1. Activate the hook NF_IP6_LOCAL_OUT with an iptables rule
>
> ip6tables -I OUTPUT -j NFQUEUE
>
> > 2. Launch my software with libnetfilter_queue
> > 3. Modify the header
> > 4. Return the whole packet to netfilter
>
> Correct.
>
> > Do I have tocreate a specific kernel module ?
>
> Not necessarily, you can do it from userspace, anyway this question also
> depends on your needs.
>
> --
> The dawn of the fourth age of Linux firewalling is coming; a time of
> great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
>
next prev parent reply other threads:[~2007-03-02 13:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-27 8:05 libnetfilter_queue man page Julien DHERSIN
2007-02-28 12:43 ` Pablo Neira Ayuso
2007-03-02 13:15 ` Julien DHERSIN [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-03-01 21:00 Jay Manni
[not found] <1139235549.30902.3.camel@localhost.localdomain>
2006-02-08 14:19 ` Harald Welte
2006-02-08 17:12 ` Brad Fisher
2006-02-08 18:18 ` Brad Fisher
2006-02-21 17:03 ` Gregor Maier
2006-02-21 18:10 ` Brad Fisher
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=2e25cc380703020515h3c1724aclf5381c94a500d199@mail.gmail.com \
--to=dhersin@gmail.com \
--cc=netfilter-devel@lists.netfilter.org \
--cc=pablo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).