Commit 0f0450f5 authored by Youness Alaoui's avatar Youness Alaoui
Browse files

use sizeof struct sockaddr instead of sizeof sockadddr_storage for doing the...

use sizeof struct sockaddr instead of sizeof sockadddr_storage for doing the bind.. this fixes stund on BSD systems. Thanks to Tom Murphy for the fix
parent ce57d660
...@@ -116,7 +116,7 @@ int listen_socket (int fam, int type, int proto, unsigned int port) ...@@ -116,7 +116,7 @@ int listen_socket (int fam, int type, int proto, unsigned int port)
break; break;
} }
if (bind (fd, (struct sockaddr *)&addr, sizeof (addr))) if (bind (fd, (struct sockaddr *)&addr, sizeof (struct sockaddr)))
{ {
perror ("Error opening IP port"); perror ("Error opening IP port");
goto error; goto error;
...@@ -213,7 +213,7 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent) ...@@ -213,7 +213,7 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent)
struct msghdr mh = struct msghdr mh =
{ {
.msg_name = (struct sockaddr *)&addr, .msg_name = (struct sockaddr *)&addr,
.msg_namelen = sizeof (addr), .msg_namelen = sizeof (struct sockaddr),
.msg_iov = &iov, .msg_iov = &iov,
.msg_iovlen = 1, .msg_iovlen = 1,
.msg_control = ctlbuf, .msg_control = ctlbuf,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment