1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-06-05 10:06:50 +00:00

Again fixes a few disable problems

This commit is contained in:
Gerhard 2025-02-20 10:29:49 +01:00
parent 6a53c955d3
commit 34b09a44ee
3 changed files with 8 additions and 0 deletions

View file

@ -131,6 +131,8 @@ Features:
Building: Building:
Disabling certain features during configure could break build process. Disabling certain features during configure could break build process.
Again fixes a few disable problems.
Porting: Porting:
Fix for old FreeBSD. Fix for old FreeBSD.

View file

@ -390,18 +390,22 @@ int _xioopen_ipapp_connect(struct single *sfd,
} else if (needbind && bindport) { } else if (needbind && bindport) {
/* Bind by sourceport option */ /* Bind by sourceport option */
switch ((*themp)->ai_family) { switch ((*themp)->ai_family) {
#if WITH_IP4
case PF_INET: case PF_INET:
bindaddr.ip4.sin_family = (*themp)->ai_family; bindaddr.ip4.sin_family = (*themp)->ai_family;
bindaddr.ip4.sin_port = htons(bindport); bindaddr.ip4.sin_port = htons(bindport);
bindaddrp = &bindaddr; bindaddrp = &bindaddr;
bindlen = sizeof(bindaddr.ip4); bindlen = sizeof(bindaddr.ip4);
break; break;
#endif
#if WITH_IP6
case PF_INET6: case PF_INET6:
bindaddr.ip6.sin6_family = (*themp)->ai_family; bindaddr.ip6.sin6_family = (*themp)->ai_family;
bindaddr.ip6.sin6_port = htons(bindport); bindaddr.ip6.sin6_port = htons(bindport);
bindaddrp = &bindaddr; bindaddrp = &bindaddr;
bindlen = sizeof(bindaddr.ip6); bindlen = sizeof(bindaddr.ip6);
break; break;
#endif
} }
} }

View file

@ -2349,11 +2349,13 @@ int xiosock_reuseaddr(int fd, int ipproto, struct opt *opts)
} }
#endif /* WITH_TCP */ #endif /* WITH_TCP */
result = retropt_2integrals(opts, OPT_SO_REUSEADDR, &val, &notnull); result = retropt_2integrals(opts, OPT_SO_REUSEADDR, &val, &notnull);
#if WITH_TCP
if (ipproto == IPPROTO_TCP && result < 0) { if (ipproto == IPPROTO_TCP && result < 0) {
Info("Setting SO_REUSADDR on TCP listen socket implicitly"); Info("Setting SO_REUSADDR on TCP listen socket implicitly");
val.u_int = 1; val.u_int = 1;
notnull.u_bool = true; notnull.u_bool = true;
} }
#endif /* WITH_TCP */
if (notnull.u_bool) { if (notnull.u_bool) {
if (Setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val.u_int, sizeof(int)) if (Setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val.u_int, sizeof(int))
!= 0) { != 0) {