winlin

fix #141, support tun0(vpn network device) ip retrieve. 0.9.179.

@@ -930,15 +930,11 @@ void retrieve_local_ipv4_ips() @@ -930,15 +930,11 @@ void retrieve_local_ipv4_ips()
930 while (p != NULL) { 930 while (p != NULL) {
931 sockaddr* addr = p->ifa_addr; 931 sockaddr* addr = p->ifa_addr;
932 932
  933 + // retrieve ipv4 addr
933 // ignore the tun0 network device, 934 // ignore the tun0 network device,
934 // which addr is NULL. 935 // which addr is NULL.
935 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/141 936 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/141
936 - if (!addr) {  
937 - continue;  
938 - }  
939 -  
940 - // retrieve ipv4 addr  
941 - if (addr->sa_family == AF_INET) { 937 + if (addr && addr->sa_family == AF_INET) {
942 in_addr* inaddr = &((sockaddr_in*)addr)->sin_addr; 938 in_addr* inaddr = &((sockaddr_in*)addr)->sin_addr;
943 939
944 char buf[16]; 940 char buf[16];