Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
ff4a0ae3
Commit
ff4a0ae3
authored
5 years ago
by
Andreas Traczyk
Committed by
Sébastien Blin
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ip_utils: remove HAVE_IPV6 preprocessor define
Change-Id: I106596ab11dc80ec4d2e8b294d36847fac98ced9
parent
50ded1ab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ip_utils.cpp
+3
-11
3 additions, 11 deletions
src/ip_utils.cpp
src/sip/sipaccount.cpp
+3
-23
3 additions, 23 deletions
src/sip/sipaccount.cpp
with
6 additions
and
34 deletions
src/ip_utils.cpp
+
3
−
11
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
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sip/sipaccount.cpp
+
3
−
23
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 "
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment