From 22f059dc5e350b6d18a95265b8d4776d8adb9dca Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 12 Oct 2020 20:04:45 +0100 Subject: [PATCH] conf: simplify ipv4 regex use one matching group rather than 3. --- src/conf.c | 2 +- src/conf_regex.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index d40d3a3..0af3c6a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -964,7 +964,7 @@ static HANDLE_FUNC (handle_upstream) ip = get_string_arg (line, &match[mi]); if (!ip) return -1; - mi += 5; + mi += 3; port = (int) get_long_arg (line, &match[mi]); mi += 2; diff --git a/src/conf_regex.h b/src/conf_regex.h index 281e67b..c2d78f9 100644 --- a/src/conf_regex.h +++ b/src/conf_regex.h @@ -16,7 +16,7 @@ #define ALNUM "([-A-Za-z0-9._]+)" #define USERNAME "([^:]*)" #define PASSWORD "([^@]*)" -#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})" +#define IP "([0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)" #define IPMASK "(" IP "(/" DIGIT "+)?)" #define IPV6 "(" \ "(([0-9a-fA-F:]{2,39}))|" \