[mirrorbrain] SUSE Hackweek - mirrorbrain ipv6 feature set

From: Dominique Leuenberger / DimStar <dimstar_at_opensuse.org>
Date: Wed, 01 Mar 2017 13:45:07 +0100
Dear Mirror brain users / Devs,

as part of SUSE's Hackweek, I have been busy with MirrorBrain, mostly
around the topic of ipv6.

The starting point was that an ipv6 client can be allocated to a
country, but mirrorbrain has no IP Prefix matching or ASN matching for
such a client (ASN *might* have worked for mirrors where the v4 and v6
pairing are in the same ASN, which is not a guaranteed given). Further
to the problem came that IPv6-only clients received IPv4 mirrors
assigned. The biggest problem there is that MB would not have a chance
to know if a client would be dual-stack or V6 only.

As part of my hackweek, I restructured the DB a little bit to achieve
most of the things I was after - and I'd like to ask the MB-community
for their feedback before I clean up my branch and submit it for
inclusion into mirrorbrain proper.

Changes to the DB Schema:
* ASN and PREFIX are deleted from the 'server' table
* A new table is introduced

CREATE TABLE serverpfx (
       "pfxid" serial PRIMARY KEY,
       "serverid" integer NOT NULL,
       "prefix" iprange NOT NULL,
       "asn" integer NOT NULL
);

pfxid is just there so I can use a SQLobject in the mb admin tool - it
just needs an index field. Serverid is used for a join between the
tables (server.id = serverpfx.serverid)

Any server can thus be assigned to an ipv4 and ipv6 prefix and the ASN
is not fixed per network. It can differ

The basic query out of mod_mirrorbrain to the DB is changed to be:

SELECT id, identifier, region, country, lat, lng, \
       asn, prefix, score, baseurl, region_only, country_only, \
       as_only, prefix_only, other_countries, file_maxsize \
FROM server \
JOIN serverpfx on id = serverid \
WHERE id::smallint = any( \
                        (SELECT mirrors  \
                         FROM filearr  \
                         WHERE path = %s)::smallint[])  \
AND family(serverpfx.prefix) = family(ipaddress(%s)) \
AND enabled AND status_baseurl AND score > 0

This change query has as an immediate effect that clients are only
assigned a server that runs the same protocol as they do: ipv clients
toipv4 servers, ipv6 clients to ipv6 servers. It's just 'the other way
around' to guess what would be the right thing.

In theory, an admin can add any dummy IPv6 Prefix to any ipv4-only
server and add it to the pool of mirrors for v6 clients - but that
brings us back to the point where a v6-only client gets an unreachable
server

During my hackweek I also updated the mb admin tool to cope with the
changed DB schema (mb update -a -p for exmaple, mb show, mb new and mb
delete are all handled)

I have no doubt that I miss a bunch of things - but that's where you
all come into play to review what I did - and/or tell me away that this
was all just a waste of time.

You can find my branch at 
  https://github.com/DimStar77/mirrorbrain/tree/ipv6-prefixes

I'm looking forward to your comments,
Dominique



_______________________________________________
mirrorbrain mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain/

Note: To remove yourself from this mailing list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-request_at_mirrorbrain.org
Received on Wed Mar 01 2017 - 16:23:26 GMT

This archive was generated by hypermail 2.3.0 : Thu Mar 02 2017 - 09:17:04 GMT