All of lore.kernel.org
 help / color / mirror / Atom feed
* nf_reinject(ing) and the lack of skbuff in ipq_read
@ 2004-12-06 17:11 Nicholas Sherwood
  0 siblings, 0 replies; only message in thread
From: Nicholas Sherwood @ 2004-12-06 17:11 UTC (permalink / raw)
  To: netfilter

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-06 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-06 17:11 nf_reinject(ing) and the lack of skbuff in ipq_read Nicholas Sherwood

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.