Skip to contentSkip to conversation

libipq packet id

DISCUSSION Moshe Ashkenazi 4 participants 8 messages Sep 26, 2002 – Sep 29, 2002 netfilter

lore
Share & tools
lore
#0 lore raw

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace, and its work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

Moshe Ashkenazi,

#1 lore raw
Quoted 8 lines · Moshe Ashkenazi

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace, and its work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

This information is not passed to userspace.

Signature · 2 lines
James Morris
<[email protected]>
#2 lore raw

So how can I modify the packet base on the rule which queue it to userspace.
W/o knowing the rule number?

Moshe Ashkenazi,
Technology Integration & Performance, QA
Check Point Software Technologies LTD.
TEL +972-3-7534865 FAX +972-3-7534893

-----Original Message-----
From: James Morris [mailto:[email protected]]
Sent: Thursday, September 26, 2002 4:38 PM
To: Moshe Ashkenazi
Cc: [email protected]
Subject: Re: libipq packet id

Quoted 3 lines · Moshe Ashkenazi

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace, and

its

Quoted 5 lines

work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

This information is not passed to userspace.

Signature · 2 lines
James Morris
<[email protected]>
#3 lore raw
Quoted 3 lines · Moshe Ashkenazi

So how can I modify the packet base on the rule which queue it to userspace.
W/o knowing the rule number?

Classify the packet again. Why trust the kernel? The sysadmin may be playing tricks with you, even unintentionally. By reclassifying in userlevel, you avoid that problem.

Never trust your input.

best regards
Patrick

#4 lore raw
In reply to James Morris
Quoted 4 lines · James Morris
Quoted 2 lines · Moshe Ashkenazi

Hi, All -

Quoted 8 lines
Quoted 6 lines

I'm using libipq to retrieve packet from netfilter in userspace, and its work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

This information is not passed to userspace.

What about the mark and hook values in the struct ipq_packet_msg_t. That looks like a possibility to get some info from userspace about the rule.

Joost

Quoted 6 lines

--
James Morris
<[email protected]>

#5 lore raw

If have those two rules:

1    QUEUE      icmp --  anywhere             anywhere           
2    QUEUE      tcp  --  anywhere             anywhere           tcp

dpt:ftp

mark return always zero and hook return 1 even the second rule queue the packet (I did ftp)

Moshe Ashkenazi,

-----Original Message-----
From: Joost Remijn [mailto:[email protected]]
Sent: Thursday, September 26, 2002 5:04 PM
To: James Morris
Cc: Moshe Ashkenazi; [email protected]
Subject: Re: libipq packet id

Quoted 5 lines · James Morris
Quoted 3 lines · Moshe Ashkenazi

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace, and

its

Quoted 7 lines
Quoted 5 lines

work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

This information is not passed to userspace.

What about the mark and hook values in the struct ipq_packet_msg_t. That looks like a possibility to get some info from userspace about the rule.

Joost

Quoted 6 lines

--
James Morris
<[email protected]>

#6 lore raw

But did you actually mark the packet. Check the iptables manpage to see how to mark a packet.

Joost

Quoted 52 lines · Moshe Ashkenazi

If have those two rules:

1    QUEUE      icmp --  anywhere             anywhere
2    QUEUE      tcp  --  anywhere             anywhere           tcp

dpt:ftp

mark return always zero and hook return 1 even the second rule queue the packet (I did ftp)

Moshe Ashkenazi,

-----Original Message-----
From: Joost Remijn [mailto:[email protected]]
Sent: Thursday, September 26, 2002 5:04 PM
To: James Morris
Cc: Moshe Ashkenazi; [email protected]
Subject: Re: libipq packet id

Quoted 5 lines · James Morris
Quoted 3 lines · Moshe Ashkenazi

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace, and

its

Quoted 7 lines
Quoted 5 lines

work cool.

My question is how can I know on userspace mode from which netfilter rule the packet arrive?

This information is not passed to userspace.

What about the mark and hook values in the struct ipq_packet_msg_t. That looks like a possibility to get some info from userspace about the rule.

Joost

Quoted 6 lines

--
James Morris
<[email protected]>

#7 lore raw

After adding new rule which mark the packet, I succeed to see the mark number on user space, so base on the mark value I can know on user space from which netfilter rule the packet came from.

Thanks, for the help

Moshe Ashkenazi,

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joost Remijn
Sent: Thursday, September 26, 2002 5:51 PM
To: Moshe Ashkenazi
Cc: 'James Morris'; [email protected]
Subject: RE: libipq packet id

But did you actually mark the packet. Check the iptables manpage to see how to mark a packet.

Joost

Quoted 7 lines · Moshe Ashkenazi

If have those two rules:

1    QUEUE      icmp --  anywhere             anywhere
2    QUEUE      tcp  --  anywhere             anywhere           tcp

dpt:ftp

mark return always zero and hook return 1 even the second rule queue

the

Quoted 14 lines

packet (I did ftp)

Moshe Ashkenazi,

-----Original Message-----
From: Joost Remijn [mailto:[email protected]]
Sent: Thursday, September 26, 2002 5:04 PM
To: James Morris
Cc: Moshe Ashkenazi; [email protected]
Subject: Re: libipq packet id

Quoted 7 lines
Quoted 5 lines · James Morris
Quoted 3 lines · Moshe Ashkenazi

Hi, All -

I'm using libipq to retrieve packet from netfilter in userspace,

and

Quoted 4 lines

its

Quoted 3 lines
Quoted 3 lines

work cool.

My question is how can I know on userspace mode from which

netfilter

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

rule the packet arrive?

This information is not passed to userspace.

What about the mark and hook values in the struct ipq_packet_msg_t. That looks like a possibility to get some info from userspace about

the

Quoted 13 lines

rule.

Joost

Quoted 6 lines

--
James Morris
<[email protected]>