Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
130
Issues
130
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
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
Options
Browse Files
Download
Email Patches
Plain Diff
ip_utils: remove HAVE_IPV6 preprocessor define
Change-Id: I106596ab11dc80ec4d2e8b294d36847fac98ced9
parent
50ded1ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
34 deletions
+6
-34
src/ip_utils.cpp
src/ip_utils.cpp
+3
-11
src/sip/sipaccount.cpp
src/sip/sipaccount.cpp
+3
-23
No files found.
src/ip_utils.cpp
View file @
ff4a0ae3
...
...
@@ -123,11 +123,7 @@ IpAddr
ip_utils
::
getAnyHostAddr
(
pj_uint16_t
family
)
{
if
(
family
==
pj_AF_UNSPEC
())
{
#if HAVE_IPV6
family
=
pj_AF_INET6
();
#else
family
=
pj_AF_INET
();
#endif
}
return
IpAddr
(
family
);
}
...
...
@@ -136,23 +132,19 @@ IpAddr
ip_utils
::
getLocalAddr
(
pj_uint16_t
family
)
{
if
(
family
==
pj_AF_UNSPEC
())
{
#if HAVE_IPV6
family
=
pj_AF_INET6
();
#else
family
=
pj_AF_INET
();
#endif
}
IpAddr
ip_addr
{};
pj_status_t
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
if
(
status
==
PJ_SUCCESS
)
{
return
ip_addr
;
}
#if HAVE_IPV6
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
();
status
=
pj_gethostip
(
family
,
ip_addr
.
pjPtr
());
if
(
status
==
PJ_SUCCESS
)
return
ip_addr
;
#endif
if
(
status
==
PJ_SUCCESS
)
{
return
ip_addr
;
}
JAMI_ERR
(
"Could not get local IP"
);
return
ip_addr
;
}
...
...
src/sip/sipaccount.cpp
View file @
ff4a0ae3
...
...
@@ -185,10 +185,7 @@ SIPAccount::newOutgoingCall(const std::string& toUrl,
call
->
setSecure
(
isTlsEnabled
());
if
(
isIP2IP
())
{
bool
ipv6
=
false
;
#if HAVE_IPV6
ipv6
=
IpAddr
::
isIpv6
(
toUrl
);
#endif
bool
ipv6
=
IpAddr
::
isIpv6
(
toUrl
);
to
=
ipv6
?
IpAddr
(
toUrl
).
toString
(
false
,
true
)
:
toUrl
;
family
=
ipv6
?
pj_AF_INET6
()
:
pj_AF_INET
();
...
...
@@ -767,18 +764,14 @@ void SIPAccount::doRegister2_()
bool
ipv6
=
false
;
if
(
isIP2IP
())
{
JAMI_DBG
(
"doRegister isIP2IP."
);
#if HAVE_IPV6
ipv6
=
ip_utils
::
getInterfaceAddr
(
interface_
).
isIpv6
();
#endif
}
else
if
(
!
hostIp_
)
{
setRegistrationState
(
RegistrationState
::
ERROR_GENERIC
,
PJSIP_SC_NOT_FOUND
);
JAMI_ERR
(
"Hostname not resolved."
);
return
;
}
#if HAVE_IPV6
else
}
else
{
ipv6
=
hostIp_
.
isIpv6
();
#endif
}
// Init TLS settings if the user wants to use TLS
if
(
tlsEnable_
)
{
...
...
@@ -1316,8 +1309,6 @@ std::string SIPAccount::getLoginName()
#endif
}
std
::
string
SIPAccount
::
getFromUri
()
const
{
std
::
string
scheme
;
...
...
@@ -1340,10 +1331,8 @@ std::string SIPAccount::getFromUri() const
if
(
hostname_
.
empty
())
hostname
=
std
::
string
(
pj_gethostname
()
->
ptr
,
pj_gethostname
()
->
slen
);
#if HAVE_IPV6
if
(
IpAddr
::
isIpv6
(
hostname
))
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
#endif
const
std
::
string
uri
=
"<"
+
scheme
+
username
+
"@"
+
hostname
+
transport
+
">"
;
if
(
not
displayName_
.
empty
())
...
...
@@ -1372,10 +1361,8 @@ std::string SIPAccount::getToUri(const std::string& username) const
if
(
username
.
find
(
'@'
)
==
std
::
string
::
npos
)
hostname
=
hostname_
;
#if HAVE_IPV6
if
(
not
hostname
.
empty
()
and
IpAddr
::
isIpv6
(
hostname
))
hostname
=
IpAddr
(
hostname
).
toString
(
false
,
true
);
#endif
return
"<"
+
scheme
+
username
+
(
hostname
.
empty
()
?
""
:
"@"
)
+
hostname
+
transport
+
">"
;
}
...
...
@@ -1394,17 +1381,14 @@ std::string SIPAccount::getServerUri() const
}
std
::
string
host
;
#if HAVE_IPV6
if
(
IpAddr
::
isIpv6
(
hostname_
))
host
=
IpAddr
(
hostname_
).
toString
(
false
,
true
);
else
#endif
host
=
hostname_
;
return
"<"
+
scheme
+
host
+
transport
+
">"
;
}
pj_str_t
SIPAccount
::
getContactHeader
(
pjsip_transport
*
t
)
{
...
...
@@ -1463,12 +1447,10 @@ SIPAccount::getContactHeader(pjsip_transport* t)
}
}
#if HAVE_IPV6
/* Enclose IPv6 address in square brackets */
if
(
IpAddr
::
isIpv6
(
address
))
{
address
=
IpAddr
(
address
).
toString
(
false
,
true
);
}
#endif
const
char
*
scheme
=
"sip"
;
const
char
*
transport
=
""
;
...
...
@@ -1884,11 +1866,9 @@ SIPAccount::checkNATAddress(pjsip_regc_cbparam *param, pj_pool_t *pool)
}
std
::
string
via_addrstr
(
via_addr
->
ptr
,
via_addr
->
slen
);
#if HAVE_IPV6
/* Enclose IPv6 address in square brackets */
if
(
IpAddr
::
isIpv6
(
via_addrstr
))
via_addrstr
=
IpAddr
(
via_addrstr
).
toString
(
false
,
true
);
#endif
JAMI_WARN
(
"IP address change detected for account %s "
"(%.*s:%d --> %s:%d). Updating registration "
...
...
Write
Preview
Markdown
is supported
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