Skip to contentSkip to conversation

iptable userspace mangling

DISCUSSION Scott MacKay 2 participants 5 messages Apr 16, 2003 – May 5, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hello!
A quick question, not immediatly seeing an answer
on the website...if I mangle a packet in a userspace module, changing TCP payload and size, do I need to do anything other than recalc the tcp and ip checksum?

-Scott

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

#1 lore raw

iptables extensions

Hiyas,
I don't know if there is a 'request' area for
development or not, but would there be any way to get a new function added to the extensions library? While printing the field (->print()) is yippie skippie, I would really like it of the string representation of the field could be dumped into a character buffer, maybe using a function like:
static const void sprint(const struct ipt_ip *ip,ipt_entry_match *match, char *sbuffer, int sbuffer_len);
Basically would do what print() does, but dump the results into a character buffer, to examine/deliver in a means other than printf().

-Scott

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

#2 lore raw

Re: iptables extensions

Quoted 6 lines · Scott MacKay

Hiyas,
I don't know if there is a 'request' area for
development or not, but would there be any way to get a new function added to the extensions library? While printing the field (->print()) is yippie skippie, I would really like it of the string representation of

Quoted 8 lines

the field could be dumped into a character buffer, maybe using a function like:
static const void sprint(const struct ipt_ip *ip,ipt_entry_match *match, char *sbuffer, int sbuffer_len);
Basically would do what print() does, but dump the results into a character buffer, to examine/deliver in a means other than printf().

As the iptables userspace was not designed to be used (as a library) by other applications, there is no support for doing so.

With good luck, we will eventually see libiptables show up in the far future...

Quoted 1 line

-Scott

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#3 lore raw

Re: iptables extensions

Quoted 7 lines · --- Harald Welte
Quoted 2 lines · Scott MacKay

Basically would do what print() does, but dump the results into a character buffer, to

examine/deliver in

Quoted 1 line

a means other than printf().

Quoted 8 lines

As the iptables userspace was not designed to be used (as a library) by
other applications, there is no support for doing so.

With good luck, we will eventually see libiptables show up in the far
future...

Understandable, though I would guess this kind of extension would be more 'grunt work' (given that the format & code behind the format is already done for printf), needing only to have a generic-o safe buffer filler and add in a new function for each of the existing items already coded. Since there is a good chance that I will have a need for something like this, my general preference to not have to re-code on new releases and instead contribute something which others may like, combined with my lack of experience generating patchfiles, if I were to code this in would there be any devel teamies that could review and accept/reject it in the code base?

-Scott

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

#4 lore raw

extending ipq_packet_msg_t

In reply to Harald Welte

I was curious, what is required to add fields into the ipq_packte_msg_t structure (passed to userspace QUEUE)?

I wanted to obtain the physical dev names from the ebtables patch for userspace queue targets (so forwards rules go from indev "eth0" to outdev "eth1" instead of "br0" to "br0"). One way would be to alter netfilter/ip_queue.c and strcpy the skb's nf_bridge->physindev->name and nf_bridge->phyoutdev->name over the indev_name and outdev_name.
If I wanted to add fields, however, are there any special concerns aside from recompiling iptables and kernel?
(this would be for 2.4.20 kernel)

-Scott

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com