diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-31 11:46:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-31 11:46:38 +0100 |
commit | 1333bbcf819c80c18644c8fc88463af7562f8bce (patch) | |
tree | 051da0cd426725a41e811e26fc91e62aad65324c /src/libutil/addr.c | |
parent | 8a0d5ee8dcb1b2a74faa536bff92800ef8569173 (diff) | |
download | rspamd-1333bbcf819c80c18644c8fc88463af7562f8bce.tar.gz rspamd-1333bbcf819c80c18644c8fc88463af7562f8bce.zip |
[Feature] Implement parsing of scoped IPv6 addresses
Diffstat (limited to 'src/libutil/addr.c')
-rw-r--r-- | src/libutil/addr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libutil/addr.c b/src/libutil/addr.c index ce97e486c..a6f1adaf8 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -493,7 +493,7 @@ gboolean rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target) { guchar t, *zero = NULL, *s, *d, *addr = target; - const guchar *p, *digit = NULL; + const guchar *p, *digit = NULL, *percent; gsize len4 = 0; guint n = 8, nibbles = 0, word = 0; @@ -513,6 +513,11 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target) p = text; } + /* Check IPv6 scope */ + if ((percent = memchr (p, '%', len)) != NULL && percent > p) { + len = percent - p; /* Ignore scope */ + } + for (/* void */; len; len--) { t = *p++; |