[asterisk-dev] how to debug the udp daemon of asterisk

Arif Hossain freefall1986 at gmail.com
Wed Mar 14 09:38:57 CDT 2012


On Wed, 2012-03-14 at 22:10 +0800, Ronald Cepres wrote:
> Did you try the asterisk cli command "sip set debug on" command
> already? 

yep. I'm trying to debug a little lower level. if the packet is not a
valid sip packet, it will fail in the sanity check, so should not be
shown in sip debugging mode. what i'm trying to achieve is to feed
garbage packet to the underlying udp daemon which handles incoming udp
packet. 

i have a "netfilter_queue" app which modifies incoming udp
packets.(actually they are obfuscated sip packet, the netfilter_queue
app tries to de-obfuscate it.). the problem i'm having is the nothing
comes up in asterisk cli. there can be two reasons behind it:

1. There is something wrong with the obfuscation algorithm, so the
packet is lost inside asterisk during sanity checks.

2. There is something wrong with netfilter_queue app which prevents a
successful packet delivery.

for debugging i've straced my netfilter_queue app. which reports that it
does deliver the modified packet without error. it shows a sendmsg()
syscall which returns a positive value indicating the packet is accepted
by transport layer of the os without error. as its udp datagram i cant
check for any acks. only thing i can check is to whether a datagram is
indeed received by the udp daemon of asterisk. if something is wrong
with the obfuscation algorithm then this will not show up in asterisk
cli. but if i strace asterisk it should show a return from recv() or
read() syscall. 

i'm trying to single out my problem. i've loaded my netfilter_queue app
in gdb and i'm quiet sure that my obfuscation algorithm is not
malfunctioning. but it leaves another option. maybe the netfilter-queue
subsystem is faulty and eating my data. i'm using devel version of those
libraries. so an existence of bug is not unlikely. if i can see that
asterisk is indeed receiving packet then i can sure that nothing wrong
the netfilter-queue. then i will recheck my algorithm. 

now to do that i need to directly talk with asterisk through udp sockets
and make it responding to it whatever the hell i put into the socket.
i've tried wit netcat but with no luck. actually i dont know enough
about asterisk to debug such low level. if i can get logs/ about a
"received" udp packet or strace asterisk to see a return from recv() or
read() syscall then i can do further testing.

I hope  i have explained the situation elaborately. if anything else
nedded to be known please ask.
-- 
"You have a voice"
                                        ----The King's Speech

Public Key : $ gpg --keyserver keyserver.ubuntu.com --recv-key C88CFC23
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120314/afdc3aeb/attachment.pgp>


More information about the asterisk-dev mailing list