mirror of
https://repo.or.cz/socat.git
synced 2025-07-10 22:13:00 +00:00
Print info on implicit SO_REUSEADDR
This commit is contained in:
parent
3339885f5b
commit
e6aa3d1787
3 changed files with 12 additions and 3 deletions
10
xio-socket.c
10
xio-socket.c
|
@ -2327,7 +2327,7 @@ int xiobind(
|
|||
Socat option so-reuseaddr:
|
||||
Option not applied: set it to 1
|
||||
Option applied with a value: set it to the value
|
||||
Option applied eith empty value "so-reuseaddr=": do not call setsockopt() for
|
||||
Option applied with empty value "so-reuseaddr=": do not call setsockopt() for
|
||||
SO_REUSEADDR
|
||||
Return 0 on success, or -1 with errno when an error occurred.
|
||||
*/
|
||||
|
@ -2335,6 +2335,7 @@ int xiosock_reuseaddr(int fd, int ipproto, struct opt *opts)
|
|||
{
|
||||
union integral val;
|
||||
union integral notnull;
|
||||
int result;
|
||||
int _errno;
|
||||
|
||||
val.u_int = 0;
|
||||
|
@ -2345,7 +2346,12 @@ int xiosock_reuseaddr(int fd, int ipproto, struct opt *opts)
|
|||
notnull.u_bool = true;
|
||||
}
|
||||
#endif /* WITH_TCP */
|
||||
retropt_2integrals(opts, OPT_SO_REUSEADDR, &val, ¬null);
|
||||
result = retropt_2integrals(opts, OPT_SO_REUSEADDR, &val, ¬null);
|
||||
if (ipproto == IPPROTO_TCP && result < 0) {
|
||||
Info("Setting SO_REUSADDR on TCP listen socket implicitly");
|
||||
val.u_int = 1;
|
||||
notnull.u_bool = true;
|
||||
}
|
||||
if (notnull.u_bool) {
|
||||
if (Setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val.u_int, sizeof(int))
|
||||
!= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue