[Nice] Filtering out stun/non-application packets

Tom Kaminski ttkaminski at gmail.com
Mon Feb 8 08:54:56 PST 2010


I'm using the libnice-0.0.10 library and after a stream component is
connected, I get some packets on the recv callback that I assume are
STUN packets.  Obviously I do not want to pass these to my application
so I need a good way to filter them out.  What is the recommended way
to do this?  Here are some options:

1. Identify the UDP packet as a stun packet, let everything else
through.  I tried to do this, but for some reason the packet I'm
receiving doesn't match the signature of a STUN packet.  I'm getting a
32 byte packet, but it doesn't contain the magic cookie field of
0x2112A442 according to the RFC.  Not sure what kind of packet this
is.

2. Identify the UDP packet as a application data packet, only let
these through.  This would require a magic cookie field to be added to
my application packets.  I'd rather not do this, but I could if
necessary.

3. A combination of both 1 & 2.

In the unit tests, it looks for a specific signature in the expected
payload to determine if it is a application data packet (method 2).
Is this the recommended approach?

Tom


More information about the Nice mailing list