Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
ff4a0ae3
Commit
ff4a0ae3
authored
Jun 25, 2019
by
Andreas Traczyk
Committed by
Sébastien Blin
Jun 26, 2019
Browse files
ip_utils: remove HAVE_IPV6 preprocessor define
Change-Id: I106596ab11dc80ec4d2e8b294d36847fac98ced9
parent
50ded1ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ip_utils.cpp
View file @
ff4a0ae3
...
@@ -123,11 +123,7 @@ IpAddr
...
@@ -123,11 +123,7 @@ IpAddr
ip_utils
::
getAnyHostAddr
(
pj_uint16_t
family
)
ip_utils
::
getAnyHostAddr
(
pj_uint16_t
family
)
{
{
if
(
family
==
pj_AF_UNSPEC
())
{
if
(
family
==
pj_AF_UNSPEC
())
{
#if HAVE_IPV6
family
=
pj_AF_INET6
();
family
=
pj_AF_INET6
();
#else
family
=
pj_AF_INET
();
#endif
}
}
return
IpAddr
(
family
);
return
IpAddr
(
family
);
}
}
...
@@ -136,23 +132,19 @@ IpAddr
...
@@ -136,23 +132,19 @@ IpAddr
ip_utils
::
getLocalAddr
(
pj_uint16_t
family
)
ip_utils
::
getLocalAddr
(
pj_uint16_t
family
)
{
{
if
(
family
==
pj_AF_UNSPEC
())
{
if
(
family
==
pj_AF_UNSPEC
())
{
#if HAVE_IPV6
family
=
pj_AF_INET6
();
family
=
pj_AF_INET6
();
#else
family
=
pj_AF_INET
();
#endif
}
}
IpAddr
ip_addr
{};
IpAddr
ip_addr
{};
pj_status_t
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
pj_status_t
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
if
(
status
==
PJ_SUCCESS
)
{
if
(
status
==
PJ_SUCCESS
)
{
return
ip_addr
;
return
ip_addr
;
}
}
#if HAVE_IPV6
JAMI_WARN
(
"Could not get preferred address familly (%s)"
,
(
family
==
pj_AF_INET6
())
?
"IPv6"
:
"IPv4"
);
JAMI_WARN
(
"Could not get preferred address familly (%s)"
,
(
family
==
pj_AF_INET6
())
?
"IPv6"
:
"IPv4"
);
family
=
(
family
==
pj_AF_INET
())
?
pj_AF_INET6
()
:
pj_AF_INET
();
family
=
(
family
==
pj_AF_INET
())
?
pj_AF_INET6
()
:
pj_AF_INET
();
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
if
(
status
==
PJ_SUCCESS
)
return
ip_addr
;
if
(
status
==
PJ_SUCCESS
)
{
#endif
return
ip_addr
;
}
JAMI_ERR
(
"Could not get local IP"
);
JAMI_ERR
(
"Could not get local IP"
);
return
ip_addr
;
return
ip_addr
;
}
}
...
...
src/sip/sipaccount.cpp
View file @
ff4a0ae3
...
@@ -185,10 +185,7 @@ SIPAccount::newOutgoingCall(const std::string& toUrl,
...
@@ -185,10 +185,7 @@ SIPAccount::newOutgoingCall(const std::string& toUrl,
call
->
setSecure
(
isTlsEnabled
());
call
->
setSecure
(
isTlsEnabled
());
if
(
isIP2IP
())
{
if
(
isIP2IP
())
{
bool
ipv6
=
false
;
bool
ipv6
=
IpAddr
::
isIpv6
(
toUrl
);
#if HAVE_IPV6
ipv6
=
IpAddr
::
isIpv6
(
toUrl
);
#endif
to
=
ipv6
?
IpAddr
(
toUrl
).
toString
(
false
,
true
)
:
toUrl
;
to
=
ipv6
?
IpAddr
(
toUrl
).
toString
(
false
,
true
)
:
toUrl
;
family
=
ipv6
?
pj_AF_INET6
()
:
pj_AF_INET
();
family
=
ipv6
?
pj_AF_INET6
()
:
pj_AF_INET
();
...
@@ -767,18 +764,14 @@ void SIPAccount::doRegister2_()
...
@@ -767,18 +764,14 @@ void SIPAccount::doRegister2_()
bool
ipv6
=
false
;
bool
ipv6
=
false
;
if
(
isIP2IP
())
{
if
(
isIP2IP
())
{
JAMI_DBG
(
"doRegister isIP2IP."
);
JAMI_DBG
(
"doRegister isIP2IP."
);
#if HAVE_IPV6
ipv6
=
ip_utils
::
getInterfaceAddr
(
interface_
).
isIpv6
();
ipv6
=
ip_utils
::
getInterfaceAddr
(
interface_
).
isIpv6
();
#endif
}
else
if
(
!
hostIp_
)
{
}
else
if
(
!
hostIp_
)
{
setRegistrationState
(
RegistrationState
::
ERROR_GENERIC
,
PJSIP_SC_NOT_FOUND
);
setRegistrationState
(
RegistrationState
::
ERROR_GENERIC
,
PJSIP_SC_NOT_FOUND
);
JAMI_ERR
(
"Hostname not resolved."
);
JAMI_ERR
(
"Hostname not resolved."
);
return
;
return
;
}
}
else
{
#if HAVE_IPV6
else
ipv6
=
hostIp_
.
isIpv6
();
ipv6
=
hostIp_
.
isIpv6
();
#endif
}
// Init TLS settings if the user wants to use TLS
// Init TLS settings if the user wants to use TLS
if
(
tlsEnable_
)
{
if
(
tlsEnable_
)
{
...
@@ -1316,8 +1309,6 @@ std::string SIPAccount::getLoginName()
...
@@ -1316,8 +1309,6 @@ std::string SIPAccount::getLoginName()
#endif
#endif
}
}
std
::
string
SIPAccount
::
getFromUri
()
const
std
::
string
SIPAccount
::
getFromUri
()
const
{
{
std
::
string
scheme
;
std
::
string
scheme
;
...
@@ -1340,10 +1331,8 @@ std::string SIPAccount::getFromUri() const
...
@@ -1340,10 +1331,8 @@ std::string SIPAccount::getFromUri() const
if
(
hostname_
.
empty
())
if
(
hostname_
.
empty
())
hostname
=
std
::
string
(
pj_gethostname
()
->
ptr
,
pj_gethostname
()
->
slen
);
hostname
=
std
::
string
(
pj_gethostname
()
->
ptr
,
pj_gethostname
()
->
slen
);
#if HAVE_IPV6
if
(
IpAddr
::
isIpv6
(
hostname
))
if
(
IpAddr
::
isIpv6
(
hostname
))
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
#endif
const
std
::
string
uri
=
"<"
+
scheme
+
username
+
"@"
+
hostname
+
transport
+
">"
;
const
std
::
string
uri
=
"<"
+
scheme
+
username
+
"@"
+
hostname
+
transport
+
">"
;
if
(
not
displayName_
.
empty
())
if
(
not
displayName_
.
empty
())
...
@@ -1372,10 +1361,8 @@ std::string SIPAccount::getToUri(const std::string& username) const
...
@@ -1372,10 +1361,8 @@ std::string SIPAccount::getToUri(const std::string& username) const
if
(
username
.
find
(
'@'
)
==
std
::
string
::
npos
)
if
(
username
.
find
(
'@'
)
==
std
::
string
::
npos
)
hostname
=
hostname_
;
hostname
=
hostname_
;
#if HAVE_IPV6
if
(
not
hostname
.
empty
()
and
IpAddr
::
isIpv6
(
hostname
))
if
(
not
hostname
.
empty
()
and
IpAddr
::
isIpv6
(
hostname
))
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
#endif
return
"<"
+
scheme
+
username
+
(
hostname
.
empty
()
?
""
:
"@"
)
+
hostname
+
transport
+
">"
;
return
"<"
+
scheme
+
username
+
(
hostname
.
empty
()
?
""
:
"@"
)
+
hostname
+
transport
+
">"
;
}
}
...
@@ -1394,17 +1381,14 @@ std::string SIPAccount::getServerUri() const
...
@@ -1394,17 +1381,14 @@ std::string SIPAccount::getServerUri() const
}
}
std
::
string
host
;
std
::
string
host
;
#if HAVE_IPV6
if
(
IpAddr
::
isIpv6
(
hostname_
))
if
(
IpAddr
::
isIpv6
(
hostname_
))
host
=
IpAddr
(
hostname_
).
toString
(
false
,
true
);
host
=
IpAddr
(
hostname_
).
toString
(
false
,
true
);
else
else
#endif
host
=
hostname_
;
host
=
hostname_
;
return
"<"
+
scheme
+
host
+
transport
+
">"
;
return
"<"
+
scheme
+
host
+
transport
+
">"
;
}
}
pj_str_t
pj_str_t
SIPAccount
::
getContactHeader
(
pjsip_transport
*
t
)
SIPAccount
::
getContactHeader
(
pjsip_transport
*
t
)
{
{
...
@@ -1463,12 +1447,10 @@ SIPAccount::getContactHeader(pjsip_transport* t)
...
@@ -1463,12 +1447,10 @@ SIPAccount::getContactHeader(pjsip_transport* t)
}
}
}
}
#if HAVE_IPV6
/* Enclose IPv6 address in square brackets */
/* Enclose IPv6 address in square brackets */
if
(
IpAddr
::
isIpv6
(
address
))
{
if
(
IpAddr
::
isIpv6
(
address
))
{
address
=
IpAddr
(
address
).
toString
(
false
,
true
);
address
=
IpAddr
(
address
).
toString
(
false
,
true
);
}
}
#endif
const
char
*
scheme
=
"sip"
;
const
char
*
scheme
=
"sip"
;
const
char
*
transport
=
""
;
const
char
*
transport
=
""
;
...
@@ -1884,11 +1866,9 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool)
...
@@ -1884,11 +1866,9 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool)
}
}
std
::
string
via_addrstr
(
via_addr
->
ptr
,
via_addr
->
slen
);
std
::
string
via_addrstr
(
via_addr
->
ptr
,
via_addr
->
slen
);
#if HAVE_IPV6
/* Enclose IPv6 address in square brackets */
/* Enclose IPv6 address in square brackets */
if
(
IpAddr
::
isIpv6
(
via_addrstr
))
if
(
IpAddr
::
isIpv6
(
via_addrstr
))
via_addrstr
=
IpAddr
(
via_addrstr
).
toString
(
false
,
true
);
via_addrstr
=
IpAddr
(
via_addrstr
).
toString
(
false
,
true
);
#endif
JAMI_WARN
(
"IP address change detected for account %s "
JAMI_WARN
(
"IP address change detected for account %s "
"(%.*s:%d --> %s:%d). Updating registration "
"(%.*s:%d --> %s:%d). Updating registration "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment