On 07/07/2008 13:47, Benny Prijono wrote: > On Mon, Jul 7, 2008 at 12:32 PM, Filippo Zangheri <filippo.zangheri at yahoo.it> > wrote: > >> Debugging info: >> >> (gdb) run >> Starting program: >> /home/filippo/tesi/pjsip/debug/pjproject-0.9.0/pjsip-apps/bin/samples/stateful_proxy-i686-pc-linux-gnu >> [Thread debugging using libthread_db enabled] >> [New Thread -1211930944 (LWP 23669)] >> 13:29:34.620 os_core_unix.c pjlib 0.9.0-release for POSIX initialized >> 13:29:34.621 pjlib select() I/O Queue created (0xb7bf4098) >> 13:29:34.621 sip_endpoint.c Module "mod-msg-print" registered >> 13:29:34.621 sip_endpoint.c Module "mod-tsx-layer" registered >> 13:29:34.621 sip_endpoint.c Module "mod-stateful-util" registered >> 13:29:34.651 udp0x80a2b60 SIP UDP transport started, published address >> is 82.59.213.185:5060 >> 13:29:34.651 sip_endpoint.c Module "mod-msg-logger" registered >> >> Program received signal SIGSEGV, Segmentation fault. >> [Switching to Thread -1211930944 (LWP 23669)] >> 0x08077908 in if_enum_by_af (af=2, p_cnt=0xbfe7a298, ifs=0xbfe7a2e0) at >> ../src/pj/ip_helper_generic.c:93 >> 93 if (ad->sa_family != af) { >> (gdb) >> > > That would be very strange. Is "ad" NULL or something? While you're there, > it would be great if you could make sense on what's happening. The > if_enum_by_af() is quite straightforward so I think it shouldn't be too > difficult to understand. Yes, I have evidence of 'ad' being NULL. I added the following check right after the declaration of that pointer: if (ad == NULL) continue; And the segfault disappears. The only different behaviour is that loopback address 127.0.0.1 is not listed in host alias addresses: $ ./stateful_proxy-i686-pc-linux-gnu 14:36:53.997 os_core_unix.c pjlib 0.9.0-release for POSIX initialized 14:36:53.998 pjlib select() I/O Queue created (0xb7c1c098) 14:36:53.998 sip_endpoint.c Module "mod-msg-print" registered 14:36:53.998 sip_endpoint.c Module "mod-tsx-layer" registered 14:36:53.998 sip_endpoint.c Module "mod-stateful-util" registered 14:36:54.019 udp0x80a2b60 SIP UDP transport started, published address is 82.59.213.185:5060 14:36:54.019 sip_endpoint.c Module "mod-msg-logger" registered 14:36:54.039 stateful_proxy Proxy started, listening on port 5060 14:36:54.039 stateful_proxy Local host aliases: 14:36:54.039 stateful_proxy 82.59.213.185:5060 14:36:54.039 stateful_proxy 192.168.2.20:5060 14:36:54.039 stateful_proxy asus-laptop:5060 14:36:54.039 stateful_proxy localhost:5060 14:36:54.039 sip_endpoint.c Module "mod-stateful-proxy" registered 14:36:54.039 sip_endpoint.c Module "mod-transaction-user" registered Menu: q quit d dump status dd dump detailed status q 14:36:58.025 sip_endpoint.c Module "mod-transaction-user" unregistered 14:36:58.025 sip_endpoint.c Module "mod-stateful-util" unregistered 14:36:58.025 sip_endpoint.c Module "mod-stateful-proxy" unregistered 14:36:58.025 sip_transactio Stopping transaction layer module 14:36:58.026 sip_transactio Transaction layer module destroyed 14:36:58.026 sip_endpoint.c Module "mod-tsx-layer" unregistered 14:36:58.026 sip_endpoint.c Module "mod-msg-print" unregistered 14:36:58.026 sip_endpoint.c Module "mod-msg-logger" unregistered 14:36:58.029 sip_endpoint.c Endpoint 0x808b584 destroyed Now, facts are: * getifaddrs(&ifap) = 0 (OK); * it = ifap != NULL (OK); * ad = it->ifa_addr = NULL (not OK); So it seems that getifaddrs() fills up a struct ifaddrs whose ifa_addr member is NULL. By the way, I can't find the implementation of that function. Where is it? Thanks! -- Filippo Zangheri GPG key ID: 0x6C1F2F2F -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080707/2964d45a/attachment.bin