Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
34d60446
Commit
34d60446
authored
May 04, 2018
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stund: Pass sockaddr_storage size for both families
parent
3a9d9281
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
stun/tools/stund.c
stun/tools/stund.c
+2
-7
No files found.
stun/tools/stund.c
View file @
34d60446
...
...
@@ -100,15 +100,12 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
struct
sockaddr_in6
in6
;
struct
sockaddr_storage
storage
;
}
addr
;
int
len
;
if
(
fd
==
-
1
)
{
perror
(
"Error opening IP port"
);
return
-
1
;
}
if
(
fd
<
3
)
goto
error
;
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
storage
.
ss_family
=
fam
;
...
...
@@ -120,7 +117,6 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
{
case
AF_INET
:
addr
.
in
.
sin_port
=
htons
(
port
);
len
=
sizeof
(
struct
sockaddr_in
);
break
;
case
AF_INET6
:
...
...
@@ -128,14 +124,13 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
setsockopt
(
fd
,
SOL_IPV6
,
IPV6_V6ONLY
,
&
yes
,
sizeof
(
yes
));
#endif
addr
.
in6
.
sin6_port
=
htons
(
port
);
len
=
sizeof
(
struct
sockaddr_in6
);
break
;
default:
assert
(
0
);
/* should never be reached */
}
if
(
bind
(
fd
,
&
addr
.
addr
,
len
))
if
(
bind
(
fd
,
&
addr
.
addr
,
sizeof
(
struct
sockaddr_storage
)
))
{
perror
(
"Error opening IP port"
);
goto
error
;
...
...
@@ -192,7 +187,7 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent)
StunValidationStatus
validation
;
StunAgent
*
agent
=
NULL
;
addr_len
=
sizeof
(
struct
sockaddr_
in
);
addr_len
=
sizeof
(
struct
sockaddr_
storage
);
len
=
recvfrom
(
sock
,
buf
,
sizeof
(
buf
),
0
,
&
addr
.
addr
,
&
addr_len
);
if
(
len
==
(
size_t
)
-
1
)
return
-
1
;
...
...
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