Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
1351f423
Commit
1351f423
authored
6 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_hep: Adds hostname resolution support for capture_address"
parents
179c7948
8f55f7c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_hep.c
+23
-1
23 additions, 1 deletion
res/res_hep.c
with
23 additions
and
1 deletion
res/res_hep.c
+
23
−
1
View file @
1351f423
...
...
@@ -367,6 +367,27 @@ static void hepv3_data_dtor(void *obj)
}
}
/*! \brief Pulls first resolved address and returns it */
static
int
ast_sockaddr_resolve_first_af
(
struct
ast_sockaddr
*
addr
,
const
char
*
name
,
int
flag
,
int
family
)
{
struct
ast_sockaddr
*
addrs
;
int
addrs_cnt
;
addrs_cnt
=
ast_sockaddr_resolve
(
&
addrs
,
name
,
flag
,
family
);
if
(
addrs_cnt
<=
0
)
{
return
1
;
}
if
(
addrs_cnt
>
1
)
{
ast_debug
(
1
,
"Multiple addresses resolving %s, using the first one only
\n
"
,
name
);
}
ast_sockaddr_copy
(
addr
,
&
addrs
[
0
]);
ast_free
(
addrs
);
return
0
;
}
/*! \brief Allocate the HEPv3 run-time data */
static
struct
hepv3_runtime_data
*
hepv3_data_alloc
(
struct
hepv3_global_config
*
config
)
{
...
...
@@ -379,10 +400,11 @@ static struct hepv3_runtime_data *hepv3_data_alloc(struct hepv3_global_config *c
data
->
sockfd
=
-
1
;
if
(
!
ast_sockaddr_
parse
(
&
data
->
remote_addr
,
config
->
capture_address
,
PARSE_PORT_REQUIRE
))
{
if
(
ast_sockaddr_
resolve_first_af
(
&
data
->
remote_addr
,
config
->
capture_address
,
PARSE_PORT_REQUIRE
,
AST_AF_UNSPEC
))
{
ast_log
(
AST_LOG_WARNING
,
"Failed to create address from %s
\n
"
,
config
->
capture_address
);
ao2_ref
(
data
,
-
1
);
return
NULL
;
}
data
->
sockfd
=
socket
(
ast_sockaddr_is_ipv6
(
&
data
->
remote_addr
)
?
AF_INET6
:
AF_INET
,
SOCK_DGRAM
,
0
);
...
...
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