Multiple SQUID problems, luci-app-squid issue

I just discovered why my squid setup was claiming that an address was already in use :

I have multiple interfaces but I don't want squid listening on some. So I have setup squid to only listen on two of them :

http_port 192.168.xx.xx:xxxx
http_port 192.168.xxx.x:xxxx

BUT, luci squid interface also has a Port entry and this entry is added at the end of squid.conf like this

http_port xxxx

This entry is then in conflict with my setup because it mean listen on ALL interfaces, port xxxx. But I already listen on that port in my config.

My config is right because squid accept differents syntax for http_port:

> # TAG: http_port
> #       Usage:  port [mode] [options]
> #               hostname:port [mode] [options]
> #               1.2.3.4:port [mode] [options]

But luci refuse to set anything else that a port number like 192.168.1.1:3128
You can't even put this form in /etc/config/squid because then, the service refuse to start even if the config is valid for squid (but not for luci)

So, a modification of luci-app-squid is needed to allow all forms of syntax. Or just remove the Port entry in luci and let the config file do all the stuff

squid log at start :

2023/11/04 16:46:06| Accepting HTTP Socket connections at local=192.168.xx.xx:xxxx remote=[::] FD 11 flags=9
2023/11/04 16:46:06| Accepting HTTP Socket connections at local=192.168.xxx.x:xxxx remote=[::] FD 12 flags=9
2023/11/04 16:46:06| Accepting HTTP Socket connections at local=[::]:xxxx remote=[::] FD 13 flags=9
2023/11/04 16:46:06| ERROR: listen( FD 13, [::] [ job3], 256): (98) Address in use

Another problem for squid in openwrt 23.05.00 (only this version), when starting or stopping the service, squid errors in the log:

Tue Oct 24 00:28:10 2023 kern.info kernel: [ 1638.336414] squid[4325]: segfault at 0 ip 00007ff5b99723db sp 00007ffc8b0190d8 error 4 in libc.so[7ff5b9930000+4c000]
Tue Oct 24 00:28:10 2023 kern.info kernel: [ 1638.336439] Code: 43 04 f0 0f b1 33 44 8b 43 08 48 89 e9 31 d2 48 89 df 41 80 f0 80 e8 da d6 ff ff f0 ff 4b 04 a9 fb ff ff ff 74 c1 5a 5b 5d c3 <8b> 17 89 d0 25 ff ff ff 7f 3d ff ff ff 7f 74 17 3d fe ff ff 7f 74

Not a good idea, to use both and LuCI for confguration. Simply drop LuCI for squid, and do everything in squid.conf.
Usage of LuCI here obviously for the simple and basic config. Which is not your case.

I don't use both style of config, I only use my settings in 'advanced settings' and I'm forced by luci to enter a port, I don't have a choice. If I don't, the port 3128 is added, which I don't want, plus squid then listen on all interfaces 0.0.0.0:3128

Squid is all but simple to setup, luci or not. All the config is already in squid.conf, there is no usefull luci gui settings. Thats why I believe that the only one setting that is important (http_port) should not be in luci as it is because it's incompatible with squid syntax for http_port. Either openwrt add all options for http_port or they remove it and let the advanced settings do it's job.

I tried to use only squid without luci but then the service doesn't start, it need a valid /etc/config/squid

Not always. I am using squid always without Luci, just the package or even compiled from src, with modules, not included in standard Make. Or dropping redundant modules, to save space. And then to do everything manually. Incl. /etc/init.d/squid, or the firewall. But, as you noted correctly, not easy to set up squid in general. Because of the few users, I am skeptical, any changes to actual openwrt install to be done.Although, you can give it a try yourself.
In your case, simply delete /etc/config/squid, delete /etc/init.d/squid do all settings in squid.conf, and create basic /etc/init.d/squid OR simply "'echo 'squid' >> /etc/rc.local'' . And not to forget to check/update firewall rules. You might want to delete /etc/rc.d/Snnsquid or /etc/rc.d/Knnsquid, too, when using squids package. AND check/delete firewall rules. BTW, this has the advantage to stay much closer to various squid guides, written for real linux.