Changeset 2112


Ignore:
Timestamp:
Jul 7, 2008 9:31:02 PM (11 years ago)
Author:
bennylp
Message:

Configuration option to include/exclude loopback interface in enum_ip_interface(), and always include loopback address in the proxy sample (thanks Filippo Zangheri for the suggestion)

Location:
pjproject/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/config.h

    r2039 r2112  
    600600#       endif 
    601601#   endif 
     602#endif 
     603 
     604 
     605/** 
     606 * Specify whether #pj_enum_ip_interface() function should exclude 
     607 * loopback interfaces. 
     608 * 
     609 * Default: 1 
     610 */ 
     611#ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
     612#   define PJ_IP_HELPER_IGNORE_LOOPBACK_IF      1 
    602613#endif 
    603614 
  • pjproject/trunk/pjlib/src/pj/ip_helper_generic.c

    r2106 r2112  
    8686        } 
    8787 
     88#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    8889        if (it->ifa_flags & IFF_LOOPBACK) { 
    8990            TRACE_((THIS_FILE, "  loopback interface")); 
    9091            continue; /* Skip loopback interface */ 
    9192        } 
     93#endif 
    9294 
    9395        if (ad==NULL) { 
    9496            TRACE_((THIS_FILE, "  NULL address ignored")); 
    95             continue; /* reported to happen on Linux 2.6.25.9 */ 
     97            continue; /* reported to happen on Linux 2.6.25.9  
     98                         with ppp interface */ 
    9699        } 
    97100 
     
    189192        } 
    190193 
     194#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    191195        if (itf->ifr_flags & IFF_LOOPBACK) { 
    192196            TRACE_((THIS_FILE, "  loopback interface")); 
    193197            continue; /* Skip loopback interface */ 
    194198        } 
     199#endif 
    195200 
    196201        /* Ignore 0.0.0.0/8 address. This is a special address 
     
    260265        } 
    261266 
     267#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    262268        if (ifreq.ifr_flags & IFF_LOOPBACK) { 
    263269            TRACE_((THIS_FILE, "  loopback interface")); 
    264270            continue; /* Skip loopback interface */ 
    265271        } 
     272#endif 
    266273 
    267274        /* Note: SIOCGIFADDR does not work for IPv6! */ 
  • pjproject/trunk/pjlib/src/pj/ip_helper_win32.c

    r2039 r2112  
    4141#include <pj/string.h> 
    4242 
    43 #ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    44 #   define PJ_IP_HELPER_IGNORE_LOOPBACK_IF      1 
    45 #endif 
    46  
    4743typedef DWORD (WINAPI *PFN_GetIpAddrTable)(PMIB_IPADDRTABLE pIpAddrTable,  
    4844                                           PULONG pdwSize,  
  • pjproject/trunk/pjsip-apps/src/samples/proxy.h

    r2039 r2112  
    272272    } 
    273273 
    274     /* No need to add this, this should have been added above. 
     274    /* Add loopback address. */ 
     275#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    275276    global.name[global.name_cnt].host = pj_str("127.0.0.1"); 
    276277    global.name[global.name_cnt].port = global.port; 
    277278    global.name_cnt++; 
    278     */ 
     279#endif 
    279280 
    280281    global.name[global.name_cnt].host = *pj_gethostname(); 
Note: See TracChangeset for help on using the changeset viewer.