Linux Netfilter discussions
 help / color / mirror / Atom feed
* Modify packets using netfilter
@ 2003-12-13 15:44 Jee J.Z.
  2003-12-13 15:49 ` Antony Stone
  0 siblings, 1 reply; 7+ messages in thread
From: Jee J.Z. @ 2003-12-13 15:44 UTC (permalink / raw)
  To: netfilter

Hi all,

I am wondering whether we can modify one or more bits in a packet using netfilter? Could anybody help? Thanks in advance!

Regards,
Jee

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

* Re: Modify packets using netfilter
  2003-12-13 15:44 Modify packets using netfilter Jee J.Z.
@ 2003-12-13 15:49 ` Antony Stone
  2003-12-13 16:45   ` Jee J.Z.
  0 siblings, 1 reply; 7+ messages in thread
From: Antony Stone @ 2003-12-13 15:49 UTC (permalink / raw)
  To: netfilter

On Saturday 13 December 2003 3:44 pm, Jee J.Z. wrote:

> Hi all,
>
> I am wondering whether we can modify one or more bits in a packet using
> netfilter? Could anybody help? Thanks in advance!

Which bits?

The mangle tables can do some, but not many.   Writing your own target to 
fiddle with other bits shouldn't be hard.

Antony.

-- 
G- GIT/E d- s+:--(-) a+ C++++$ UL++++$ P+(---)>++ L+++(++++)$ !E W(-) N(-) o? 
w-- O !M V+++(--) !PS !PE Y+ PGP+> t- tv@ b+++ DI++ D--- e++>+++ h++ r@? 5? 
!X- !R K--?

                                                     Please reply to the list;
                                                           please don't CC me.



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

* Re: Modify packets using netfilter
  2003-12-13 15:49 ` Antony Stone
@ 2003-12-13 16:45   ` Jee J.Z.
  2003-12-13 16:53     ` Antony Stone
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jee J.Z. @ 2003-12-13 16:45 UTC (permalink / raw)
  To: netfilter

Hi Antony and all,

Thanks for your reply. What I am trying to do is to get the whole packets including their payloads and store them into a self defined queue, and randomly modify some bits in each packet. I am using iptables userspace programming. Does anybody have some good idea how to achieve this? Thank you.

Regards,
Jee

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

* Re: Modify packets using netfilter
  2003-12-13 16:45   ` Jee J.Z.
@ 2003-12-13 16:53     ` Antony Stone
  2003-12-13 20:21     ` Eric Leblond
  2003-12-15  1:14     ` Josh Berry
  2 siblings, 0 replies; 7+ messages in thread
From: Antony Stone @ 2003-12-13 16:53 UTC (permalink / raw)
  To: netfilter

On Saturday 13 December 2003 4:45 pm, Jee J.Z. wrote:

> Hi Antony and all,
>
> Thanks for your reply. What I am trying to do is to get the whole packets
> including their payloads and store them into a self defined queue, and
> randomly modify some bits in each packet. I am using iptables userspace
> programming. Does anybody have some good idea how to achieve this? Thank
> you.

I am fascinated at the use of the word "randomly" in the above description.   
However, maybe someone here with more experience of netfilter programming 
than I have can help with your request.

Antony.

-- 
All matter in the Universe can be placed into one of two categories:

1. Things which need to be fixed.
2. Things which need to be fixed once you've had a few minutes to play with 
them.

                                                     Please reply to the list;
                                                           please don't CC me.



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

* Re: Modify packets using netfilter
  2003-12-13 16:45   ` Jee J.Z.
  2003-12-13 16:53     ` Antony Stone
@ 2003-12-13 20:21     ` Eric Leblond
  2003-12-13 23:11       ` Jee J.Z.
  2003-12-15  1:14     ` Josh Berry
  2 siblings, 1 reply; 7+ messages in thread
From: Eric Leblond @ 2003-12-13 20:21 UTC (permalink / raw)
  To: Jee J.Z.; +Cc: netfilter

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

Le sam 13/12/2003 à 17:45, Jee J.Z. a écrit :
> Hi Antony and all,
> 
> Thanks for your reply. What I am trying to do is to get the whole packets including their payloads and store them into a self defined queue, and randomly modify some bits in each packet. 
> I am using iptables userspace programming. Does anybody have some good idea how to achieve this? Thank you.

with libipq you can modify the payload of the packet :

Take from man page :
int ipq_set_verdict(const struct ipq_handle *h, ipq_id_t  id,  unsigned
       int verdict, size_t data_len, unsigned char *buf);

if data_len is not 0 and buf is not NULL, the header and payload of the
packet get replaced by the datas pointed by buf.

BR,
-- 
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)

[-- Attachment #2: Ceci est une partie de message numériquement signée. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Modify packets using netfilter
  2003-12-13 20:21     ` Eric Leblond
@ 2003-12-13 23:11       ` Jee J.Z.
  0 siblings, 0 replies; 7+ messages in thread
From: Jee J.Z. @ 2003-12-13 23:11 UTC (permalink / raw)
  To: netfilter

Hi Eric and all,

Thank you again. I have a few further questions:
1. How many packets can ip_queue queue for userspace? How can we change the
size of QUEUE?
2. Can we use ipq_read() and ipq_set_verdict() to access and process queued
packets in any order?
    More specifically, for example, I wish to ipq_read() a number of packets
from QUEUE before ipq_set_verdict() any of them, and then ipq_set_verdict()
in whichever order I want. It is possible?

Cheers,
Jee


----- Original Message ----- 
From: "Eric Leblond" <eric@regit.org>
To: "Jee J.Z." <jz105@york.ac.uk>
Cc: <netfilter@lists.netfilter.org>
Sent: Saturday, December 13, 2003 8:21 PM
Subject: Re: Modify packets using netfilter

Le sam 13/12/2003 à 17:45, Jee J.Z. a écrit :
> Hi Antony and all,
>
> Thanks for your reply. What I am trying to do is to get the whole packets
including their payloads and store them into a self defined queue, and
randomly modify some bits in each packet.
> I am using iptables userspace programming. Does anybody have some good
idea how to achieve this? Thank you.

with libipq you can modify the payload of the packet :

Take from man page :
int ipq_set_verdict(const struct ipq_handle *h, ipq_id_t  id,  unsigned
       int verdict, size_t data_len, unsigned char *buf);

if data_len is not 0 and buf is not NULL, the header and payload of the
packet get replaced by the datas pointed by buf.

BR,
-- 
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)



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

* Re: Modify packets using netfilter
  2003-12-13 16:45   ` Jee J.Z.
  2003-12-13 16:53     ` Antony Stone
  2003-12-13 20:21     ` Eric Leblond
@ 2003-12-15  1:14     ` Josh Berry
  2 siblings, 0 replies; 7+ messages in thread
From: Josh Berry @ 2003-12-15  1:14 UTC (permalink / raw)
  To: Jee J.Z.; +Cc: netfilter

Snort-Inline is able to do this: http://snort-inline.sourceforge.net.  You
can have it modify (it calls it replacing) packets.  The main caveat to
this is that you have to replace data with the same amount of data
example:

Replacing the string "hacker" with "hack" would not work.

> Hi Antony and all,
>
> Thanks for your reply. What I am trying to do is to get the whole packets
> including their payloads and store them into a self defined queue, and
> randomly modify some bits in each packet. I am using iptables userspace
> programming. Does anybody have some good idea how to achieve this? Thank
> you.
>
> Regards,
> Jee


Thanks,
Josh Berry, CTO
LinkNet-Solutions
469-831-8543
josh.berry@linknet-solutions.com



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

end of thread, other threads:[~2003-12-15  1:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-13 15:44 Modify packets using netfilter Jee J.Z.
2003-12-13 15:49 ` Antony Stone
2003-12-13 16:45   ` Jee J.Z.
2003-12-13 16:53     ` Antony Stone
2003-12-13 20:21     ` Eric Leblond
2003-12-13 23:11       ` Jee J.Z.
2003-12-15  1:14     ` Josh Berry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox