diff --git a/man/3proxy.cfg.5 b/man/3proxy.cfg.5 index ca92de7..6f9c25a 100644 --- a/man/3proxy.cfg.5 +++ b/man/3proxy.cfg.5 @@ -878,7 +878,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 d700d53..8ebd1b7 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; @@ -1741,7 +1746,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},