Skip to contentSkip to conversation

Port information.

DISCUSSION Emmanuel Guiton 2 participants 2 messages Jan 19, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi!

I'm creating a target for which I specify "-p tcp --dport XX" from the user-space program. How can I know the port number from the check function in the target? Where is it stored? I guess I can't access it via the "const struct ipt_entry *e".

Emmanuel

#1 lore raw
Quoted 4 lines · Emmanuel Guiton

I'm creating a target for which I specify "-p tcp --dport XX" from the user-space program. How can I know the port number from the check function in the target? Where is it stored? I guess I can't access it via the "const struct ipt_entry *e".

You probably can get it from the ipt_entry, but this is not something I would recommend attempting as it requires iterating over the included matches to find the information you require. For some information see the check_entry() function.

What you can do in more sane manners is to add a target argument allowing the required information to be specified to your target in addition to the tcp match.

Regards
Henrik