All of lore.kernel.org
 help / color / mirror / Atom feed
* Modifying a packet's length using netfilter queue
@ 2015-04-13 13:14 Kees-Jan Hermans
  0 siblings, 0 replies; 2+ messages in thread
From: Kees-Jan Hermans @ 2015-04-13 13:14 UTC (permalink / raw)
  To: netfilter

Hello everyone. I am new to this list, and I'd like to know if I can make a packet, captured through netfilter queueing, bigger. I have created the following function:

#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_queue/libnetfilter_queue.h>

struct nfq_data {
  struct nfattr **data;
};

void nfq_set_payload_length
  (struct nfq_data *nfad, unsigned length)
{
  //.. could be an error here if length + NFA_LENGTH(0) > 0xffff..
  (nfad->data[NFQA_PAYLOAD-1])->nfa_len = (length + NFA_LENGTH(0));
}

In order to be able to modify the length of a captured packet (in NFQNL_COPY_PACKET mode). Everything about the packet will be in order - recalculated checksums etc). Is this an acceptable approach?

KJ

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Modifying a packet's length using netfilter queue
@ 2015-04-14  8:43 Kees-Jan Hermans
  0 siblings, 0 replies; 2+ messages in thread
From: Kees-Jan Hermans @ 2015-04-14  8:43 UTC (permalink / raw)
  To: netfilter

Hello everyone. I am new to this list, and I'd like to know if I can make a packet, captured through netfilter queueing, bigger. I have created the following function:

#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_queue/libnetfilter_queue.h>

struct nfq_data {
 struct nfattr **data;
};

void nfq_set_payload_length
 (struct nfq_data *nfad, unsigned length)
{
 //.. could be an error here if length + NFA_LENGTH(0) > 0xffff..
 (nfad->data[NFQA_PAYLOAD-1])->nfa_len = (length + NFA_LENGTH(0));
}

In order to be able to modify the length of a captured packet (in NFQNL_COPY_PACKET mode). Everything about the packet will be in order - recalculated checksums etc). Is this an acceptable approach?

KJ

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-14  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-13 13:14 Modifying a packet's length using netfilter queue Kees-Jan Hermans
2015-04-14  8:43 Kees-Jan Hermans

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.