Compare commits

..

2 Commits

Author SHA1 Message Date
Vladimir Dubrovin
fe53378596 maxseg / TCP_MAXSEG support added
Some checks failed
C/C++ CI / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
2025-11-29 15:05:29 +03:00
Vladimir Dubrovin
5450ca4cdf Fixed: invalid config value initializers 2025-11-29 14:46:01 +03:00
4 changed files with 42 additions and 22 deletions

View File

@ -93,27 +93,31 @@ char *rotations[] = {
struct extparam conf = { struct extparam conf = {
{0, 0}, {0, 0}, /* threadinit */
{1, 5, 30, 60, 180, 1800, 15, 60, 15, 5, 0, 0}, {1, 5, 30, 60, 180, 1800, 15, 60, 15, 5, 0, 0}, /* timeouts */
NULL, NULL, /* struct ace * acl; */
NULL, NULL, /* char * conffile; */
NULL, NULL, NULL, NULL, /* struct bandlim * bandlimiter, *bandlimiterout; */
NULL, NULL, /* struct connlim * connlimiter; */
NULL, NULL, /* struct trafcount * trafcounter; */
NULL, NULL, /* struct srvparam *services; */
0, 0, /* int stacksize, */
-1, 0, 0, 0, 0, -1, 0, 0, 0, 0, /* counterd, haveerror, rotate, paused, archiverc, */
0, 500, 0, 0, 0, 0, 0, 0, 2, 0, 500, 0, 0, 0, 0, 0, 0, 2, /* demon, maxchild, backlog, needreload, timetoexit, version, noforce, bandlimver, parentretries; */
0, 0, 0, 6, 600, /* int authcachetype, authcachetime; */
6, 600, 1048576, /* int filtermaxsize; */
1048576, 0, 0, 0, /* int gracetraf, gracenum, gracedelay */
NULL, NULL, 0, /* int maxseg */
NONE, NONE, NULL, NULL, /* unsigned char *logname, **archiver; */
NULL, NONE, NONE, /* ROTATION logtype, countertype; */
NULL, /* char * counterfile; */
#ifndef NOIPV6 #ifndef NOIPV6
{AF_INET},{AF_INET6},{AF_INET}, {AF_INET},
{AF_INET6},
{AF_INET},
#else #else
{AF_INET},{AF_INET}, {AF_INET},
{AF_INET},
#endif #endif
NULL, NULL,
NULL, NULL,

View File

@ -466,6 +466,11 @@ static int h_rotate(int argc, unsigned char **argv){
return 0; return 0;
} }
static int h_maxseg(int argc, unsigned char **argv){
conf.maxseg = atoi((char *)argv[1]);
return 0;
}
static int h_logformat(int argc, unsigned char **argv){ static int h_logformat(int argc, unsigned char **argv){
unsigned char * old = conf.logformat; unsigned char * old = conf.logformat;
conf.logformat = (unsigned char *)mystrdup((char *)argv[1]); conf.logformat = (unsigned char *)mystrdup((char *)argv[1]);
@ -1645,11 +1650,12 @@ struct commands commandhandlers[]={
{commandhandlers+61, "force", h_force, 1, 1}, {commandhandlers+61, "force", h_force, 1, 1},
{commandhandlers+62, "noforce", h_noforce, 1, 1}, {commandhandlers+62, "noforce", h_noforce, 1, 1},
{commandhandlers+63, "parentretries", h_parentretries, 2, 2}, {commandhandlers+63, "parentretries", h_parentretries, 2, 2},
{commandhandlers+64, "auto", h_proxy, 1, 0}, {commandhandlers+64, "auto", h_proxy, 1, 0},
{commandhandlers+65, "backlog", h_backlog, 2, 2}, {commandhandlers+65, "backlog", h_backlog, 2, 2},
{commandhandlers+66, "tlspr", h_proxy, 1, 0}, {commandhandlers+66, "tlspr", h_proxy, 1, 0},
{commandhandlers+67, "maxseg", h_maxseg, 2, 2},
#ifndef NORADIUS #ifndef NORADIUS
{commandhandlers+67, "radius", h_radius, 3, 0}, {commandhandlers+68, "radius", h_radius, 3, 0},
#endif #endif
{specificcommands, "", h_noop, 1, 0} {specificcommands, "", h_noop, 1, 0}
}; };

View File

@ -170,6 +170,9 @@ struct socketoptions sockopts[] = {
#endif #endif
#ifdef TCP_FASTOPEN_CONNECT #ifdef TCP_FASTOPEN_CONNECT
{TCP_FASTOPEN_CONNECT, "TCP_FASTOPEN_CONNECT"}, {TCP_FASTOPEN_CONNECT, "TCP_FASTOPEN_CONNECT"},
#endif
#ifdef TCP_MAXSEG
{TCP_MAXSEG, "TCP_MAXSEG"},
#endif #endif
{0, NULL} {0, NULL}
}; };
@ -193,6 +196,12 @@ void setopts(SOCKET s, int opts){
int i, opt, set; int i, opt, set;
for(i = 0; opts >= (opt = (1<<i)); i++){ for(i = 0; opts >= (opt = (1<<i)); i++){
set = 1; set = 1;
#ifdef TCP_MAXSEG
if(sockopts[i].opt == TCP_MAXSEG){
if(!conf.maxseg) continue;
set = conf.maxseg;
}
#endif
if(opts & opt) setsockopt(s, *sockopts[i].optname == 'T'? IPPROTO_TCP: if(opts & opt) setsockopt(s, *sockopts[i].optname == 'T'? IPPROTO_TCP:
#ifdef SOL_IP #ifdef SOL_IP
*sockopts[i].optname == 'I'? SOL_IP: *sockopts[i].optname == 'I'? SOL_IP:

View File

@ -651,6 +651,7 @@ struct extparam {
int authcachetype, authcachetime; int authcachetype, authcachetime;
int filtermaxsize; int filtermaxsize;
int gracetraf, gracenum, gracedelay; int gracetraf, gracenum, gracedelay;
int maxseg;
unsigned char *logname, **archiver; unsigned char *logname, **archiver;
ROTATION logtype, countertype; ROTATION logtype, countertype;
char * counterfile; char * counterfile;