Merge branch 'master' into x-forwarded-for
This commit is contained in:
commit
a875eda618
36
src/child.c
36
src/child.c
@ -206,27 +206,27 @@ static void child_main (struct child_s *ptr)
|
|||||||
* We have to wait for connections on multiple fds,
|
* We have to wait for connections on multiple fds,
|
||||||
* so use select.
|
* so use select.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
|
||||||
|
|
||||||
for (i = 0; i < vector_length(listen_fds); i++) {
|
|
||||||
int *fd = (int *) vector_getentry(listen_fds, i, NULL);
|
|
||||||
|
|
||||||
ret = socket_nonblocking(*fd);
|
|
||||||
if (ret != 0) {
|
|
||||||
log_message(LOG_ERR, "Failed to set the listening "
|
|
||||||
"socket %d to non-blocking: %s",
|
|
||||||
fd, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_SET(*fd, &rfds);
|
|
||||||
maxfd = max(maxfd, *fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!config.quit) {
|
while (!config.quit) {
|
||||||
|
|
||||||
int listenfd = -1;
|
int listenfd = -1;
|
||||||
|
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
|
||||||
|
for (i = 0; i < vector_length(listen_fds); i++) {
|
||||||
|
int *fd = (int *) vector_getentry(listen_fds, i, NULL);
|
||||||
|
|
||||||
|
ret = socket_nonblocking(*fd);
|
||||||
|
if (ret != 0) {
|
||||||
|
log_message(LOG_ERR, "Failed to set the listening "
|
||||||
|
"socket %d to non-blocking: %s",
|
||||||
|
fd, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
FD_SET(*fd, &rfds);
|
||||||
|
maxfd = max(maxfd, *fd);
|
||||||
|
}
|
||||||
|
|
||||||
ptr->status = T_WAITING;
|
ptr->status = T_WAITING;
|
||||||
|
|
||||||
clilen = sizeof(struct sockaddr_storage);
|
clilen = sizeof(struct sockaddr_storage);
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
#define BOOL "(yes|on|no|off)"
|
#define BOOL "(yes|on|no|off)"
|
||||||
#define INT "((0x)?[[:digit:]]+)"
|
#define INT "((0x)?[[:digit:]]+)"
|
||||||
#define ALNUM "([-a-z0-9._]+)"
|
#define ALNUM "([-a-z0-9._]+)"
|
||||||
|
#define USERNAME "([^:]*)"
|
||||||
|
#define PASSWORD "([^@]*)"
|
||||||
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
|
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
|
||||||
#define IPMASK "(" IP "(/[[:digit:]]+)?)"
|
#define IPMASK "(" IP "(/[[:digit:]]+)?)"
|
||||||
#define IPV6 "(" \
|
#define IPV6 "(" \
|
||||||
@ -259,7 +261,7 @@ struct {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
BEGIN "(upstream)" WS "(http|socks4|socks5)" WS
|
BEGIN "(upstream)" WS "(http|socks4|socks5)" WS
|
||||||
"(" ALNUM /*username*/ ":" ALNUM /*password*/ "@" ")?"
|
"(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
|
||||||
"(" IP "|" ALNUM ")"
|
"(" IP "|" ALNUM ")"
|
||||||
":" INT "(" WS STR ")?"
|
":" INT "(" WS STR ")?"
|
||||||
END, handle_upstream, NULL
|
END, handle_upstream, NULL
|
||||||
|
Loading…
Reference in New Issue
Block a user