Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
freediameter
Commits
c251b72f
Commit
c251b72f
authored
Feb 05, 2010
by
Sebastien Decugis
Browse files
Fix invalid use of SCTP_STATUS
parent
f4d0a903
Changes
1
Hide whitespace changes
Inline
Side-by-side
freeDiameter/sctp.c
View file @
c251b72f
...
...
@@ -965,24 +965,11 @@ int fd_sctp_get_local_ep(int sock, struct fd_list * list)
/* Now get the primary address, the add function will take care of merging with existing entry */
{
struct
sctp_status
status
;
socklen_t
sz
=
sizeof
(
status
);
int
ret
;
memset
(
&
status
,
0
,
sizeof
(
status
));
/* Attempt to use SCTP_STATUS message to retrieve the primary address */
CHECK_SYS_DO
(
ret
=
getsockopt
(
sock
,
IPPROTO_SCTP
,
SCTP_STATUS
,
&
status
,
&
sz
),
/* continue */
);
if
(
sz
!=
sizeof
(
status
))
ret
=
-
1
;
sz
=
sizeof
(
sSS
);
if
(
ret
<
0
)
{
/* Fallback to getsockname -- not recommended by draft-ietf-tsvwg-sctpsocket-19#section-7.4 */
CHECK_SYS
(
getsockname
(
sock
,
(
sSA
*
)
&
status
.
sstat_primary
.
spinfo_address
,
&
sz
));
}
CHECK_FCT
(
fd_ep_add_merge
(
list
,
(
sSA
*
)
&
status
.
sstat_primary
.
spinfo_address
,
sz
,
EP_FL_PRIMARY
)
);
sSS
ss
;
socklen_t
sl
=
sizeof
(
sSS
);
CHECK_SYS
(
getsockname
(
sock
,
(
sSA
*
)
&
ss
,
&
sl
));
CHECK_FCT
(
fd_ep_add_merge
(
list
,
(
sSA
*
)
&
ss
,
sl
,
EP_FL_PRIMARY
)
);
}
return
0
;
...
...
@@ -1029,11 +1016,24 @@ next:
/* Now get the primary address, the add function will take care of merging with existing entry */
{
sSS
ss
;
socklen_t
sl
=
sizeof
(
sSS
);
CHECK_SYS
(
getpeername
(
sock
,
(
sSA
*
)
&
ss
,
&
sl
));
CHECK_FCT
(
fd_ep_add_merge
(
list
,
(
sSA
*
)
&
ss
,
sl
,
EP_FL_PRIMARY
)
);
struct
sctp_status
status
;
socklen_t
sz
=
sizeof
(
status
);
int
ret
;
memset
(
&
status
,
0
,
sizeof
(
status
));
/* Attempt to use SCTP_STATUS message to retrieve the primary address */
CHECK_SYS_DO
(
ret
=
getsockopt
(
sock
,
IPPROTO_SCTP
,
SCTP_STATUS
,
&
status
,
&
sz
),
/* continue */
);
if
(
sz
!=
sizeof
(
status
))
ret
=
-
1
;
sz
=
sizeof
(
sSS
);
if
(
ret
<
0
)
{
/* Fallback to getsockname -- not recommended by draft-ietf-tsvwg-sctpsocket-19#section-7.4 */
CHECK_SYS
(
getpeername
(
sock
,
(
sSA
*
)
&
status
.
sstat_primary
.
spinfo_address
,
&
sz
));
}
CHECK_FCT
(
fd_ep_add_merge
(
list
,
(
sSA
*
)
&
status
.
sstat_primary
.
spinfo_address
,
sz
,
EP_FL_PRIMARY
)
);
}
/* Done! */
...
...
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