tinyproxy / tinyproxy

tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
GNU General Public License v2.0
4.88k stars 668 forks source link

Upstream IPv6 prefix notation does not work #409

Open mss opened 2 years ago

mss commented 2 years ago

Tinyproxy version

tinyproxy/1.11.0-rc1-47-git-7f13fa8

Issue

The default config file contains these examples:

#  upstream none "10.0.0.0/8"
#  upstream none "192.168.0.0/255.255.254.0"

So I assumed the prefix notation would work for IPv6 as well. And I tried:

Upstream http 127.0.0.1:8080 "::1/128"
Upstream http 127.0.0.1:8080 "2a01:c22:8ce0:fff::/64"

And neither worked when tested with curl, eg.

curl -s -v -I 'http://[::1]' >/dev/null

The parser definition is conf.c is

        STDCONF (upstream,
                 "(" "(none)" WS STR ")|" \
                 "(" "(http|socks4|socks5)" WS \
                     "(" USERNAME /*username*/ ":" PASSWORD /*password*/ "@" ")?"
                     "(" IP "|" ALNUM ")"
                     ":" INT "(" WS STR ")?" ")", handle_upstream),

It should probably use the "(" IPMASK "|" IPV6MASK ")" (plus | ALNUM) as used in the allow/deny rules.

thedmdim commented 2 years ago

Have you solved this trouble?