Mailing List Archive

freshclam and getaddrinfo()
Hi.

Starting from the last upgrade (0.96.3 on debian) freshclam randomly chooses
between ipv6/ipv4 connecting to the name that has addresses in both
protocols.

freshclam uses getaddrinfo() for resolving mirror dns name (wwwconnect in
manager.c), but then it randomizes the list returned as a result.
This way it breaks the algorithm of ipv6 address selection from rfc3484
implemented in getaddrinfo().

What is the reason for doing this?


Regards,
Jacek
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
Re: freshclam and getaddrinfo() [ In reply to ]
On Mon, 4 Oct 2010 14:31:21 +0200
Jacek Zapala <jacek@it.pl> wrote:

> Hi.
>
> Starting from the last upgrade (0.96.3 on debian) freshclam randomly
> chooses between ipv6/ipv4 connecting to the name that has addresses
> in both protocols.
>
> freshclam uses getaddrinfo() for resolving mirror dns name
> (wwwconnect in manager.c), but then it randomizes the list returned
> as a result. This way it breaks the algorithm of ipv6 address
> selection from rfc3484 implemented in getaddrinfo().

It is not intended to mix IPv4 and IPv6. It should be possible to
randomize only IPv4 and IPv6 separately.

Is the problem that your IPv6 link is slower than IPv4, or that you
don't have an IPv6 connection at all?

>
> What is the reason for doing this?

Because otherwise the list returned by getaddrinfo() is always in
sorted order (on Linux at least), so it would only use the first mirror.

See this:
https://wwws.clamav.net/bugzilla/show_bug.cgi?id=2021#c1

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
Re: freshclam and getaddrinfo() [ In reply to ]
* Török Edwin (edwin@clamav.net) [101004 14:45] wrote:
> On Mon, 4 Oct 2010 14:31:21 +0200
> Jacek Zapala <jacek@it.pl> wrote:
>
> > Hi.
> >
> > Starting from the last upgrade (0.96.3 on debian) freshclam randomly
> > chooses between ipv6/ipv4 connecting to the name that has addresses
> > in both protocols.
> >
> > freshclam uses getaddrinfo() for resolving mirror dns name
> > (wwwconnect in manager.c), but then it randomizes the list returned
> > as a result. This way it breaks the algorithm of ipv6 address
> > selection from rfc3484 implemented in getaddrinfo().
>
> It is not intended to mix IPv4 and IPv6. It should be possible to
> randomize only IPv4 and IPv6 separately.
>
> Is the problem that your IPv6 link is slower than IPv4, or that you
> don't have an IPv6 connection at all?

No, I have good IPv6 connection to my local mirror
clamavmirror.ipartners.pl, but I found it strange to behave randomly.

And sometimes it's better to choose IPv6 address over the IPv4 one, but
this is not always true.

I know we currently setup freshclam to use either IPv6 address set
(db.ipv6.clamav.net) or the IPv4 one, but I think some day we will just add
IPv6 addresses to db.<country>.clamav.net and leave making the decision up to
the operating system (and getaddrinfo).

> See this:
> https://wwws.clamav.net/bugzilla/show_bug.cgi?id=2021#c1

Should randomizing only IPv4 addresses be the solution?

Jacek

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
Re: freshclam and getaddrinfo() [ In reply to ]
On Mon, 4 Oct 2010 15:14:06 +0200
Jacek Zapala <jacek@it.pl> wrote:

> * Török Edwin (edwin@clamav.net) [101004 14:45] wrote:
> > On Mon, 4 Oct 2010 14:31:21 +0200
> > Jacek Zapala <jacek@it.pl> wrote:
> >
> > > Hi.
> > >
> > > Starting from the last upgrade (0.96.3 on debian) freshclam
> > > randomly chooses between ipv6/ipv4 connecting to the name that
> > > has addresses in both protocols.
> > >
> > > freshclam uses getaddrinfo() for resolving mirror dns name
> > > (wwwconnect in manager.c), but then it randomizes the list
> > > returned as a result. This way it breaks the algorithm of ipv6
> > > address selection from rfc3484 implemented in getaddrinfo().
> >
> > It is not intended to mix IPv4 and IPv6. It should be possible to
> > randomize only IPv4 and IPv6 separately.
> >
> > Is the problem that your IPv6 link is slower than IPv4, or that you
> > don't have an IPv6 connection at all?
>
> No, I have good IPv6 connection to my local mirror
> clamavmirror.ipartners.pl, but I found it strange to behave randomly.
>
> And sometimes it's better to choose IPv6 address over the IPv4 one,
> but this is not always true.
>
> I know we currently setup freshclam to use either IPv6 address set
> (db.ipv6.clamav.net) or the IPv4 one, but I think some day we will
> just add IPv6 addresses to db.<country>.clamav.net and leave making
> the decision up to the operating system (and getaddrinfo).
>
> > See this:
> > https://wwws.clamav.net/bugzilla/show_bug.cgi?id=2021#c1
>
> Should randomizing only IPv4 addresses be the solution?

Probably yes, please open a bug and mark it as enhancement.

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net