diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-07-07 21:31:02 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-07-07 21:31:02 +0000 |
commit | 07852fec4400363969a010259ed304d0abeee92b (patch) | |
tree | bb84548918a47eec368c2317e2847c09dbdc481a /pjlib/src/pj/ip_helper_generic.c | |
parent | 1e3d62ad8a16f5f14a1f5d74e5234f06f3d1471b (diff) |
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)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2112 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/ip_helper_generic.c')
-rw-r--r-- | pjlib/src/pj/ip_helper_generic.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pjlib/src/pj/ip_helper_generic.c b/pjlib/src/pj/ip_helper_generic.c index 6eaba54a..6a3d19e7 100644 --- a/pjlib/src/pj/ip_helper_generic.c +++ b/pjlib/src/pj/ip_helper_generic.c @@ -85,14 +85,17 @@ static pj_status_t if_enum_by_af(int af, continue; /* Skip when interface is down */ } +#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF if (it->ifa_flags & IFF_LOOPBACK) { TRACE_((THIS_FILE, " loopback interface")); continue; /* Skip loopback interface */ } +#endif if (ad==NULL) { TRACE_((THIS_FILE, " NULL address ignored")); - continue; /* reported to happen on Linux 2.6.25.9 */ + continue; /* reported to happen on Linux 2.6.25.9 + with ppp interface */ } if (ad->sa_family != af) { @@ -188,10 +191,12 @@ static pj_status_t if_enum_by_af(int af, continue; /* Skip when interface is down */ } +#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF if (itf->ifr_flags & IFF_LOOPBACK) { TRACE_((THIS_FILE, " loopback interface")); continue; /* Skip loopback interface */ } +#endif /* Ignore 0.0.0.0/8 address. This is a special address * which doesn't seem to have practical use. @@ -259,10 +264,12 @@ static pj_status_t if_enum_by_af(int af, unsigned *p_cnt, pj_sockaddr ifs[]) continue; /* Skip when interface is down */ } +#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF if (ifreq.ifr_flags & IFF_LOOPBACK) { TRACE_((THIS_FILE, " loopback interface")); continue; /* Skip loopback interface */ } +#endif /* Note: SIOCGIFADDR does not work for IPv6! */ if ((rc=ioctl(sock, SIOCGIFADDR, &ifreq)) != 0) { |