Page MenuHomeVyOS Platform

Webproxy/Squid not working with IPv6 listen-address
Closed, ResolvedPublicBUG

Description

Hi,

while testing some services with IPv6 link-local addresses (for T4110) I found a problem with Webproxy/Squid using IPv6 at all (doesn't matter if link local, ULA or global).

vyos@vyos# set interfaces ethernet eth0 address fd42:1983:1::1/64
vyos@vyos# set service webproxy listen-address fd42:1983:1::1 disable-transparent
[edit]
vyos@vyos# commit
[edit]

There is no error message but squid is not working:

vyos@vyos# sudo netstat -lnp |grep 3128
[edit]
vyos@vyos# ps ax |grep squid
  11593 pts/0    S+     0:00 grep squid
[edit]
vyos@vyos# squid -k check
2021/12/29 11:19:11| FATAL: Bungled /etc/squid/squid.conf line 36: http_port fd42:1983:1::1:3128 
2021/12/29 11:19:11| Squid Cache (Version 4.13): Terminated abnormally.
CPU Usage: 0.006 seconds = 0.004 user + 0.002 sys
Maximum Resident Size: 52576 KB
Page faults with physical i/o: 0

The problem is not "bracketizing" the IPv6 address in /etc/squid/squid.conf:

vyos@vyos# grep "http_port" /etc/squid/squid.conf
http_port fd42:1983:1::1:3128
http_port 127.0.0.1:3128

After patching "data/templates/squid/squid.conf.tmpl" it's working.

vyos@vyos# diff /usr/share/vyos/templates/squid/squid.conf.tmpl.orig  /usr/share/vyos/templates/squid/squid.conf.tmpl
91c91
< http_port {{ address }}:{{ config.port if config.port is defined else default_port }} {{ 'intercept' if config.disable_transparent is not defined }}
---
> http_port {{ address | bracketize_ipv6 }}:{{ config.port if config.port is defined else default_port }} {{ 'intercept' if config.disable_transparent is not defined }}

Now the config is correct and squid is working:

vyos@vyos# grep "http_port" /etc/squid/squid.conf
http_port [fd42:1983:1::1]:3128
http_port 127.0.0.1:3128

vyos@vyos# ps ax |grep squid
  13552 ?        Ss     0:00 /usr/sbin/squid --foreground -sYC
  13556 ?        S      0:00 (squid-1) --kid squid-1 --foreground -sYC

vyos@vyos# sudo netstat -lnp |grep 3128
tcp        0      0 127.0.0.1:3128          0.0.0.0:*               LISTEN      13556/(squid-1)
tcp6       0      0 fd42:1983:1::1:3128     :::*                    LISTEN      13556/(squid-1)

Unfortunately I don't know how to post a pull request on github for that :(

BTW: there seems no syntax-check for listen-address:

vyos@vyos# set service webproxy listen-address blahblah disable-transparent
[edit]
vyos@vyos# commit
[edit]
# no error!
vyos@vyos# grep "http_port" /etc/squid/squid.conf
http_port 10.10.18.6:3128
http_port blahblah:3128
http_port [fd42:1983:1::1]:3128
http_port 127.0.0.1:3128

Details

Difficulty level
Easy (less than an hour)
Version
1.4-rolling-202112281820
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)