New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the match for client prefix/mirror prefix should check for #52

poeml opened this Issue Jun 5, 2015 · 0 comments


None yet
1 participant

poeml commented Jun 5, 2015

                                                                                                      [          ]

Issue migrated (2015-06-05) from old issue tracker

Title    the match for client prefix/mirror prefix should check for
             containment, not string match
 Priority  bug                       Status            resolved
Superseder                          Nosy List          poeml
 Assigned  poeml                    Keywords

msg177 (view) Author: poeml Date: 2010-04-22.23:38:11

We had a case where a client should be redirected to a local mirror, which lives in the same network
prefix, but it didn't work. The clients prefix is:

mb iplookup (AS27895)

The mirror which should be chosen is:

mb iplookup (AS27895)

So the narrowst prefix that contains is, but the IP is also contained
in, which is the narrowst prefix containing the mirror IP.

The problem is that mod_mirrorbrain has this data as strings and does an (exact) string match:

/* same prefix? /
else if (strcmp(new->prefix, prefix) == 0) {
*(void *
)apr_array_push(mirrors_same_prefix) = new;

We should probably switch to checking for containment of the IP in the mirrors prefix. That could be
done using the Apache Portable Runtime functions apr_ipsubnet_create() and apr_ipsubnet_test(). They
have the benefit of dealing with IPv6 as well as IPv4 (and mapped addresses), and they are likely fast.

We'd have to call those functions for each mirror for each client, but I looked at them and the added
overhead should be comparably small. If it turns out to be noticeable, it'd be possible to store the
network block address of each mirror in the database as a number in its entry or so...

msg178 (view) Author: poeml Date: 2010-04-23.01:56:18

A fix has been committed to trunk (r8040).

msg179 (view) Author: poeml Date: 2010-04-23.02:02:40

I'll keep this open and marked "in testing", upon positive confirmation that the
fix does its job.

msg203 (view) Author: poeml Date: 2010-09-01.15:53:42

I'm counting this as successfully resolved. The fix is in productive use since
quite a while now; it'll be in the upcoming 2.13.0 release.


         Date         User  Action                      Args
2010-09-01 15:53:43 poeml set    status: testing -> resolved
                                   messages: + msg203
2010-04-23 02:02:40 poeml set    status: in-progress -> testing
                                   messages: + msg179
2010-04-23 01:56:19 poeml set    messages: + msg178
                                   title: mod_asn: the match for client prefix/
                                   mirror prefix should check for containment,
2010-04-22 23:39:11 poeml set    not string match -> the match for client
                                   prefix/mirror prefix should check for
                                   containment, not string match
2010-04-22 23:38:56 poeml set    keyword: - mod_asn
2010-04-22 23:38:12 poeml create

(end of migrated issue)

@poeml poeml added bug resolved labels Jun 5, 2015

@poeml poeml closed this Jun 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment