Opened 5 months ago

Last modified 3 months ago

#27647 assigned enhancement

When randomly choosing IPv4 or IPv6, set IPv6 probability based on IPv6 weight

Reported by: teor Owned by: neel
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client ipv6
Cc: neel@… Actual Points:
Parent ID: #17835 Points:
Reviewer: Sponsor:


We can't make 50% of clients use IPv6 until most relays have IPv6. Otherwise, we would overload the IPv6 Guards. Right now, about 25% of Guard consensus weight has IPv6:

When we are randomly choosing IPv4 or IPv6, we need to set the initial IPv6 probability based on the IPv6 Guard consensus weight. (Or the number of IPv6 bridges, if we're using bridges.)

With IPv4-only, IPv6-only, and DualStack Entry nodes, the formulas are:

IPv4-capable-weight = IPv4-only + DualStack
IPv6-capable-weight = IPv6-only + DualStack
Total-weight = IPv4-only + IPv6-only + DualStack

IPv4-capable-fraction = IPv4-capable-weight / Total-weight
IPv6-capable-fraction = IPv6-capable-weight / Total-weight

IPv4-probability = IPv4-capable-fraction / (IPv4-capable-fraction + IPv6-capable-fraction)
IPv6-probability = IPv6-capable-fraction / (IPv4-capable-fraction + IPv6-capable-fraction)

We should update these probabilities whenever we get a new consensus, new bridge lines, or new bridge descriptors.

Child Tickets

#28653enhancementnewSpecify IPv4 and IPv6 weight calculations in dir-spec.txt

Change History (5)

comment:1 Changed 5 months ago by teor

(Currently, relays can't be IPv6-only, but bridges can be configured as IPv6-only.)

comment:2 Changed 5 months ago by neel

Owner: set to neel
Status: newassigned

comment:3 Changed 4 months ago by neel

Where should I look for this patch?

comment:4 Changed 3 months ago by teor

When the consensus is received, tor parses it, and assigns bandwidth weights to each relay. Each relay has an IPv4 address, and an optional IPv6 address. Some relays can be entry nodes, depending on their flags.

When bridges are configured, tor parses the config, and weights each bridge equally. Each bridge has one or two IP addresses. Each bridge is an entry node.

Once the entry nodes have up-to-date weights and addresses, you can calculate the entry node weight for IPv4 and IPv6.

We'll also need some documentation for this weight calculation, probably in dir-spec.txt.

comment:5 Changed 3 months ago by teor

Type: defectenhancement
Note: See TracTickets for help on using tickets.