Skip to contentSkip to conversation

libnetfilter_queue question

DISCUSSION Victor Julien 2 participants 4 messages May 19, 2010 – May 27, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm using libnetfilter_queue for inline mode in the Suricata IDS/IPS (www.openinfosecfoundation.org). I'm using a callback that makes the packet(s) available to the detection engine. In some special cases the call back could fail (only malloc failure atm).

I was wondering what the proper response would be to such an event. I'm assuming nfq_handle_packet() would return an (non zero) error code in that case.

Should I verdict the packet? (drop to be safe)

Cheers,
Victor

Signature · 5 lines
---------------------------------------------
Victor Julien
http://www.inliniac.net/
PGP: http://www.inliniac.net/victorjulien.asc
---------------------------------------------
#1 lore raw

Hi Victor,

Quoted 7 lines · Victor Julien

Hi all,

I'm using libnetfilter_queue for inline mode in the Suricata IDS/IPS (www.openinfosecfoundation.org). I'm using a callback that makes the packet(s) available to the detection engine. In some special cases the call back could fail (only malloc failure atm).

Quoted 5 lines

I was wondering what the proper response would be to such an event. I'm assuming nfq_handle_packet() would return an (non zero) error code in that case.

Should I verdict the packet? (drop to be safe)

Yes, clearly ! If you don't do this the packet will get stuck inside the kernel and nothing will released it (and free associated structures).

The only other mean to free queued packet is to unregister from the NF queue.

BR,

Signature · 3 lines
Eric Leblond <[email protected]>
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
#2 lore raw
Quoted 14 lines · Eric Leblond

Hi Victor,

Quoted 11 lines · Victor Julien

Hi all,

I'm using libnetfilter_queue for inline mode in the Suricata IDS/IPS (www.openinfosecfoundation.org). I'm using a callback that makes the packet(s) available to the detection engine. In some special cases the call back could fail (only malloc failure atm).

I was wondering what the proper response would be to such an event. I'm assuming nfq_handle_packet() would return an (non zero) error code in that case.

Quoted 7 lines
Quoted 1 line

Should I verdict the packet? (drop to be safe)

Yes, clearly ! If you don't do this the packet will get stuck inside the kernel and nothing will released it (and free associated structures).

The only other mean to free queued packet is to unregister from the NF queue.

Thanks Eric, I will implement the verdict in case of error.

Cheers,
Victor

Signature · 10 lines
---------------------------------------------
Victor Julien
http://www.inliniac.net/
PGP: http://www.inliniac.net/victorjulien.asc
---------------------------------------------

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 15 lines · Victor Julien
Quoted 14 lines · Eric Leblond

Hi Victor,

Quoted 11 lines · Victor Julien

Hi all,

I'm using libnetfilter_queue for inline mode in the Suricata IDS/IPS (www.openinfosecfoundation.org). I'm using a callback that makes the packet(s) available to the detection engine. In some special cases the call back could fail (only malloc failure atm).

I was wondering what the proper response would be to such an event. I'm assuming nfq_handle_packet() would return an (non zero) error code in that case.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Should I verdict the packet? (drop to be safe)

Yes, clearly ! If you don't do this the packet will get stuck inside the kernel and nothing will released it (and free associated structures).

The only other mean to free queued packet is to unregister from the NF queue.

Thanks Eric, I will implement the verdict in case of error.

Actually, after giving it some more thought I was wondering if the verdict would need to be issued in the failing callback function itself.

As far as I understand, nfq_handle_packet can process multiple packets after a single recv.

What would be the appropriate place to issue the verdict?

Signature · 10 lines
---------------------------------------------
Victor Julien
http://www.inliniac.net/
PGP: http://www.inliniac.net/victorjulien.asc
---------------------------------------------

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html