Skip to content

Commit

Permalink
Merge branch 'master' into remove_quic_config
Browse files Browse the repository at this point in the history
  • Loading branch information
oncilla authored Jun 10, 2024
2 parents e7e4f86 + 9be9885 commit 35a63fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 3 additions & 1 deletion tools/topogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def add_arguments(parser):
parser.add_argument('-d', '--docker', action='store_true',
help='Create a docker compose configuration')
parser.add_argument('-n', '--network',
help='Network to create subnets in (E.g. "127.0.0.0/8"')
help='IPv4 network to create subnets in (E.g. "127.0.0.0/8"')
parser.add_argument('-n6', '--network-v6',
help='IPv6 network to create subnets in (E.g. "fd00:f00d:cafe::7f00:0000/104"')
parser.add_argument('-o', '--output-dir', default=GEN_PATH,
help='Output directory')
parser.add_argument('--random-ifids', action='store_true',
Expand Down
10 changes: 6 additions & 4 deletions tools/topology/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ def __init__(self, args):
logging.critical("Cannot use sig without docker!")
sys.exit(1)
self.default_mtu = None
self._read_defaults(self.args.network)
self._read_defaults()

def _read_defaults(self, network):
def _read_defaults(self):
"""
Configure default network.
"""
defaults = self.topo_config.get("defaults", {})
self.subnet_gen4 = SubnetGenerator(DEFAULT_NETWORK, self.args.docker)
self.subnet_gen6 = SubnetGenerator(DEFAULT6_NETWORK, self.args.docker)
self.subnet_gen4 = SubnetGenerator(self.args.network, self.args.docker) \
if self.args.network else SubnetGenerator(DEFAULT_NETWORK, self.args.docker)
self.subnet_gen6 = SubnetGenerator(self.args.network_v6, self.args.docker) \
if self.args.network_v6 else SubnetGenerator(DEFAULT6_NETWORK, self.args.docker)
self.default_mtu = defaults.get("mtu", DEFAULT_MTU)
self.dispatched_ports = defaults.get("dispatched_ports", DEFAULT_DISPATCHED_PORTS)

Expand Down
5 changes: 5 additions & 0 deletions tools/topology/defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
#: IPv6 min value
SCION_MIN_MTU = 1280

# Default IPv4 network
DEFAULT_NETWORK = "127.0.0.0/8"
DEFAULT_PRIV_NETWORK = "192.168.0.0/16"
DEFAULT_SCN_DC_NETWORK = "172.20.0.0/20"

# Default IPv6 network, our equivalent to 127.0.0.0/8
# https://en.wikipedia.org/wiki/Unique_local_address#Definition
DEFAULT6_MASK = "/104"
Expand Down
6 changes: 1 addition & 5 deletions tools/topology/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@
import yaml

# SCION
from topology.defines import DEFAULT6_NETWORK_ADDR

DEFAULT_NETWORK = "127.0.0.0/8"
DEFAULT_PRIV_NETWORK = "192.168.0.0/16"
DEFAULT_SCN_DC_NETWORK = "172.20.0.0/20"
from topology.defines import DEFAULT_NETWORK, DEFAULT_SCN_DC_NETWORK, DEFAULT6_NETWORK_ADDR

IPAddress = Union[IPv4Address, IPv6Address]
IPNetwork = Union[IPv4Network, IPv6Network]
Expand Down

0 comments on commit 35a63fe

Please sign in to comment.