All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Sherwood <nickzor@gmail.com>
To: netfilter@lists.netfilter.org
Subject: nf_reinject(ing) and the lack of skbuff in ipq_read
Date: Mon, 6 Dec 2004 12:11:23 -0500	[thread overview]
Message-ID: <5ce4d70b0412060911260a7819@mail.gmail.com> (raw)

Ok so I need to capture some packets in userspace to mess with them,
particularly switch the order in which they are sent out. Ok I can
capture them in my program with libipq. Now I need to store them and
reinject them LATER. Here's the problem; when I capture them using
ipq_read and ipq_get_packet I get a buffer of type ipq_packet_msg.
This type looks like this:

----/usr/include/linux/netfilter_ipv4/ip_queue.h----

/* Messages sent from kernel */
typedef struct ipq_packet_msg {
       unsigned long packet_id;        /* ID of queued packet */
       unsigned long mark;             /* Netfilter mark value */
       long timestamp_sec;             /* Packet arrival time (seconds) */
       long timestamp_usec;            /* Packet arrvial time (+useconds) */
       unsigned int hook;              /* Netfilter hook we rode in on */
       char indev_name[IFNAMSIZ];      /* Name of incoming interface */
       char outdev_name[IFNAMSIZ];     /* Name of outgoing interface */
       unsigned short hw_protocol;     /* Hardw  Dec 3 2004, 10:43 AM
Average number of posts peare protocol (network order) */
       unsigned short hw_type;         /* Hardware type */
       unsigned char hw_addrlen;       /* Hardware address length */
       unsigned char hw_addr[8];       /* Hardware address */
       size_t data_len;                /* Length of packet data */
       unsigned char payload[0];       /* Optional packet data */
} ipq_packet_msg_t;


To reinject a packet, presumably by using the nf_reinject function
(see include/linux/netfilter.h) I require as inputs an sk_buff and an
nf_info, two structs usually associated with packets in the netfilter
context. But all I have is that ipq_packet_msg buffer which has the
packet and a few random tidbits of info.

Yes I've looked at Rusty's HOWTO on how to do everything in life and
then some, there just isn't very good documentation on queueing to
userspace, not to mention reinjecting packets back afterward. And once
again I do mean reinject, not just NF_ACCEPT something, I mean take it
out and put it back in.

I would really really appreciate anyone's input if they've done this
or if they know how to retrieve a packet's sk_buff/nf_info in
userspace, thanks!!!!!

-Nik


                 reply	other threads:[~2004-12-06 17:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=5ce4d70b0412060911260a7819@mail.gmail.com \
    --to=nickzor@gmail.com \
    --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.