From 4bf9eecddf6c352dcc01b55193c352e318f6f69d Mon Sep 17 00:00:00 2001 From: yazhog Date: Mon, 10 Aug 2026 13:09:24 +0300 Subject: [PATCH] fix: allow extip parents without a port --- man/3proxy.cfg.5 | 2 +- src/conf.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/man/3proxy.cfg.5 b/man/3proxy.cfg.5 index 94784be..efc0c87 100644 --- a/man/3proxy.cfg.5 +++ b/man/3proxy.cfg.5 @@ -817,7 +817,7 @@ with probability of 0.7) for outgoing web connections. Chains are only applied t .br type is one of: .br -\fBextip\fR does not actually redirect the request; it sets the external address for this request to \fI\fR. It can be chained with another parent type. It's useful to set the external IP based on ACL or make it random. When built with \fBWITH_LOCAL_PORT_RANGE\fR on Linux 6.3 or newer, \fI\fR may be an inclusive IPv4 local port range \fIFIRST-LAST\fR. The range is applied to outgoing sockets for requests matching this parent; DNS resolver traffic is not affected. For example, \fBparent 1000 extip 192.0.2.10 20000-30000\fR. +\fBextip\fR does not actually redirect the request; it sets the external address for this request to \fI\fR. It can be chained with another parent type. It's useful to set the external IP based on ACL or make it random. Its \fI\fR argument is optional and defaults to 0. When built with \fBWITH_LOCAL_PORT_RANGE\fR on Linux 6.3 or newer, \fI\fR may be an inclusive IPv4 local port range \fIFIRST-LAST\fR. The range is applied to outgoing sockets for requests matching this parent; DNS resolver traffic is not affected. For example, \fBparent 1000 extip 192.0.2.10 20000-30000\fR. .br \fBtcp\fR simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication. .br diff --git a/src/conf.c b/src/conf.c index e1970b6..ce33907 100644 --- a/src/conf.c +++ b/src/conf.c @@ -814,6 +814,11 @@ static int h_parent(int argc, unsigned char **argv){ free(chains); return(4); } + if(argc < 5 && chains->type != R_EXTIP) { + fprintf(stderr, "Chaining error: port is required for parent type %s\n", argv[2]); + free(chains); + return(3); + } #ifdef WITH_UN if(!strncmp((char *)argv[3], "unix:", 5)){ make_un(argv[3] + 5, (struct sockaddr_un*)&chains->addr); @@ -838,7 +843,7 @@ static int h_parent(int argc, unsigned char **argv){ *cidr = '/'; chains->cidr = atoi(cidr + 1); } - { + if(argc > 4) { char *end; unsigned long port; @@ -1723,7 +1728,7 @@ struct commands commandhandlers[]={ {NULL, "system", h_system, 2, 2}, {NULL, "pidfile", h_pidfile, 2, 2}, {NULL, "monitor", h_monitor, 2, 2}, - {NULL, "parent", h_parent, 5, 0}, + {NULL, "parent", h_parent, 4, 0}, {NULL, "allow", h_ace, 1, 0}, {NULL, "deny", h_ace, 1, 0}, {NULL, "redirect", h_ace, 3, 0},