mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-22 18:15:41 +08:00
Fix compilation issues
This commit is contained in:
parent
c1beceb24b
commit
3dc698eccd
@ -431,15 +431,15 @@ int doconnect(struct clientparam * param){
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef SO_BINDTODEVICE
|
||||
#if defined SO_BINDTODEVICE
|
||||
if(param->srv->obindtodevice) {
|
||||
if(so._setsockopt(param->remsock, SOL_SOCKET, SO_BINDTODEVICE, param->srv->obindtodevice, strlen(param->srv->obindtodevice) + 1))
|
||||
return 12;
|
||||
}
|
||||
#elseif IP_BOUND_IF
|
||||
#elif defined IP_BOUND_IF
|
||||
if(param->srv->obindtodevice) {
|
||||
int idx;
|
||||
idx = if_nametoindex(param->srv->obindtodevice)
|
||||
idx = if_nametoindex(param->srv->obindtodevice);
|
||||
if(!idx || so._setsockopt(param->remsock, IPPROTO_IP, IP_BOUND_IF, &idx, sizeof(idx)))
|
||||
return 12;
|
||||
#ifndef NOIPV6
|
||||
|
@ -610,22 +610,22 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
opt = 1;
|
||||
so._setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *)&opt, sizeof(int));
|
||||
#endif
|
||||
#ifdef SO_BINDTODEVICE
|
||||
#if defined SO_BINDTODEVICE
|
||||
if(srv.ibindtodevice && so._setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, srv.ibindtodevice, strlen(srv.ibindtodevice) + 1)) {
|
||||
dolog(&defparam, "failed to bind device");
|
||||
return -12;
|
||||
}
|
||||
#elseif IP_BOUND_IF
|
||||
#elif defined IP_BOUND_IF
|
||||
if(srv.ibindtodevice){
|
||||
int idx;
|
||||
idx = if_nametoindex(srv.ibindtodevice);
|
||||
if(!idx || setsockopt(sockfd, IPPROTO_IP, IP_BOUND_IF, &idx, sizeof(idx))) {
|
||||
dolog(&defparam, "failed to bind device");
|
||||
if(!idx || setsockopt(sock, IPPROTO_IP, IP_BOUND_IF, &idx, sizeof(idx))) {
|
||||
dolog(&defparam, (unsigned char *)"failed to bind device");
|
||||
return -12;
|
||||
}
|
||||
#ifndef NOIPV6
|
||||
if(so._setsockopt(param->remsock, IPPROTO_IPV6, IPV6_BOUND_IF, &idx, sizeof(idx))) {
|
||||
dolog(&defparam, "failed to bind device");
|
||||
if(so._setsockopt(sock, IPPROTO_IPV6, IPV6_BOUND_IF, &idx, sizeof(idx))) {
|
||||
dolog(&defparam, (unsigned char *)"failed to bind device");
|
||||
return -12;
|
||||
}
|
||||
#endif
|
||||
|
@ -31,6 +31,9 @@ extern "C" {
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#ifdef IP_BOUND_IF
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
#define SASIZETYPE socklen_t
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET (-1)
|
||||
|
@ -28,7 +28,11 @@ void * tcppmchild(struct clientparam* param) {
|
||||
}
|
||||
if(action != PASS) RETURN(19);
|
||||
}
|
||||
RETURN (param->redirectfunc?param->redirectfunc(param):mapsocket(param, conf.timeouts[CONNECTION_L]));
|
||||
if(param->redirectfunc){
|
||||
return (*param->redirectfunc)(param);
|
||||
}
|
||||
|
||||
RETURN (mapsocket(param, conf.timeouts[CONNECTION_L]));
|
||||
CLEANRET:
|
||||
|
||||
dolog(param, param->hostname);
|
||||
|
Loading…
Reference in New Issue
Block a user