# Something strange with c-icap, worked only by ipv6



## Deep-darky (Apr 22, 2022)

Hi everyone!

I install squid + c-icap + squidclamav on FreeBSD 13.0-RELEASE-p11, but
squid didn't connect to c-icap server on localhost:1344. When I check server with telnet I see:

```
root@host:~ # telnet localhost 1344
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
Connected to localhost.
Escape character is '^]'.
```
So, when i try to use c-icap-client I see that:

```
root@host:/root# c-icap-client -s squidclamav
Connection to 'localhost:1344' failed/timedout
Failed to connect to icap server.....
```


```
root@host:/root# c-icap-client -i 127.0.0.1 -s squidclamav
Connection to '127.0.0.1:1344' failed/timedout
Failed to connect to icap server.....
```


```
root@host:/root# c-icap-client -i ::1 -s squidclamav
ICAP server:::1, ip:::1, port:1344

OPTIONS:
Allow 204: Yes
Allow 206: No
Preview: 1024
Keep alive: Yes

ICAP HEADERS:
ICAP/1.0 200 OK
Methods: RESPMOD, REQMOD
Service: C-ICAP/0.5.10 server - SquidClamav/Antivirus service
ISTag: "CI0001-1-squidclamav-10"
Transfer-Preview: * Options-TTL: 3600
Date: Thu, 21 Apr 2022 03:25:06 GMT
Preview: 1024
Allow: 204
X-Include: X-Client-IP, X-Server-IP, X-Authenticated-User, X-Authenticated-Groups
Encapsulated: null-body=0
```
Listening ports:

```
root@host:~ # sockstat -ln | grep 1344
0        c-icap     907   5  tcp6   *:1344                *:*
0        c-icap     906   5  tcp6   *:1344                *:*
0        c-icap     799   5  tcp6   *:1344                *:*
```

Check localhost addresses:

/etc/hosts file:

```
::1 localhost localhost.[mydomain]
127.0.0.1 localhost localhost.[mydomain]
```
Ping localhost:

```
root@host:/etc# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.088 ms
```
Everything fine!

And squid.conf also works only when I declared icap server as:

```
icap_service service_avi_req reqmod_precache icap://[::1]:1344/squidclamav bypass=on
icap_service service_avi_resp respmod_precache icap://[::1]:1344/squidclamav bypass=off
```
After all I try to exchange squidclamav with virus_scan service - the same result.

I twice recompiled c-icap with and without ipv6 support, nothing change!


Seems like c-icap server  on my computer works only by ipv6 and doesn't work by ipv4. Can anyone help me?


Thanks and best wishes!


----------



## Deep-darky (Apr 22, 2022)

I find solution, this is not obviously, but:
if I set port in c-icap.conf like:

```
Port 1344
```
I have only ipv6 working
if I set:

```
Port 127.0.0.1:1344
```
ipv4 also working.
To staff:  you may remove this post or if this information is needed for others publish it...
Thanks a lot!!!


----------

