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

This commit is contained in:
Vladimir Dubrovin 2025-11-29 15:05:29 +03:00
parent 5450ca4cdf
commit fe53378596
2 changed files with 18 additions and 3 deletions

View File

@ -466,6 +466,11 @@ static int h_rotate(int argc, unsigned char **argv){
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){
unsigned char * old = conf.logformat;
conf.logformat = (unsigned char *)mystrdup((char *)argv[1]);
@ -1648,8 +1653,9 @@ struct commands commandhandlers[]={
{commandhandlers+64, "auto", h_proxy, 1, 0},
{commandhandlers+65, "backlog", h_backlog, 2, 2},
{commandhandlers+66, "tlspr", h_proxy, 1, 0},
{commandhandlers+67, "maxseg", h_maxseg, 2, 2},
#ifndef NORADIUS
{commandhandlers+67, "radius", h_radius, 3, 0},
{commandhandlers+68, "radius", h_radius, 3, 0},
#endif
{specificcommands, "", h_noop, 1, 0}
};

View File

@ -170,6 +170,9 @@ struct socketoptions sockopts[] = {
#endif
#ifdef TCP_FASTOPEN_CONNECT
{TCP_FASTOPEN_CONNECT, "TCP_FASTOPEN_CONNECT"},
#endif
#ifdef TCP_MAXSEG
{TCP_MAXSEG, "TCP_MAXSEG"},
#endif
{0, NULL}
};
@ -193,6 +196,12 @@ void setopts(SOCKET s, int opts){
int i, opt, set;
for(i = 0; opts >= (opt = (1<<i)); i++){
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:
#ifdef SOL_IP
*sockopts[i].optname == 'I'? SOL_IP: