Skip to content

Commit

Permalink
change last-mile router port forwarding
Browse files Browse the repository at this point in the history
removing dispatcher from snet and infra libraries

intermediate commit remove dispatcher

fix dataplane port parsing

adapt end2end

braccept UTs

integration no probe

add port range

fix port range

remove ref to dispatcher & reliable socket

fix epic failing test

remove dispatcher and reliable:
- still integration test failing due to lack of
  support for SCMP handling and more

comments, leftovers, small fixes

more minor

after rebasing

pass

add stateless dispatcher

intermediate commit

- Still things missing, e.g., update topology to include stateless dispatcher

update topology with reduced dispatcher config

add error handling and debug verbose to endHost resolution in BR

add reduced forwarding dispatcher

integration and utils

integration tests

lint + chown container

fix docker check, only for linux dev

lint

modify HP and tests

lint

fix broken rebase

lint

pass

change dispatcher configuration

bugfix: QUIC address for client with :0 port

slayers: unmap IPv4-mapped IPv6 addresses (scionproto#4377)

The Go standard library can produce IPv4-mapped IPv6 addresses when
resolving IP addresses. These IP addresses need to be unmapped before
putting them on the wire.

Before this patch, we could observe the following with tshark:

    Len=1304 SCION 1-ff00:0:110,[::ffff:172.20.2.2] -> 1-ff00:0:111,[::ffff:172.20.3.2] UDP 32769 -> 32768 1208

The regression was introduced in scionproto#4346, which removed the unmapping behavior
in slayers.PackAddr. This patch restores the behavior to ensure only
unmapped IPv4 addresses make it on the wire.

Handling the unmapping in the code that generates the addresses and only
checking this in slayers would seem ideal, but these calls are often
very far away from the place that would then trigger an error. Thus
handling this in slayers seems like a compromise that saves us and the
users of the slayers package a lot of trouble.

add packet reflection safeguard in shim

add compatible IP_PKTINFO code for windows

fix validateNextHopAddr

fix isSCMPInfo

add endhost port range configuration

port range

comment udpportRange

add fixme

allow unspecified address fon SCIONNetwork.Listen

retriving nextHop from path and local Interface information

add dispatching logic for SCMP at BR

remove dispatcher shim support for Windows

remove br dispatcher configuration from integration tests

add test for old and new br configuration with(out) shim dispatcher

comments and minor fixes

remove utils_chown container

remove docker utils from script

pass

pass

pass refactor topology endhost_port_range

comment for router
  • Loading branch information
JordiSubira committed Mar 1, 2024
1 parent 9d2cd86 commit a627bc1
Show file tree
Hide file tree
Showing 212 changed files with 2,920 additions and 10,626 deletions.
5 changes: 0 additions & 5 deletions .golangcilint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,3 @@ issues:
- path: pkg/scrypto/cms
linters: [goheader]

# Exceptions to errcheck for some old-ish convey tests.
- linters: [errcheck]
path: "^pkg/sock/reliable/reconnect/conn_io_test.go$|\
^pkg/sock/reliable/reconnect/network_test.go$|\
^pkg/sock/reliable/reconnect/reconnecter_test.go$"
39 changes: 27 additions & 12 deletions acceptance/hidden_paths/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ class Test(base.TestTopogen):

http_server_port = 9099

_testers = {
"2": "tester_1-ff00_0_2",
"3": "tester_1-ff00_0_3",
"4": "tester_1-ff00_0_4",
"5": "tester_1-ff00_0_5",
}
_ases = {
"2": "1-ff00:0:2",
"3": "1-ff00:0:3",
"4": "1-ff00:0:4",
"5": "1-ff00:0:5",
}

def setup_prepare(self):
super().setup_prepare()

Expand All @@ -59,6 +72,15 @@ def setup_prepare(self):
"4": "172.20.0.65",
"5": "172.20.0.73",
}
# TODO(JordiSubira): These addresses will change if the topology file is modified.
# In any case, after rebasing this branch this probably does not work anymore, since
# SVC resolution and address setup is modified.
control_addresses = {
"2": "172.20.0.51:30090",
"3": "172.20.0.59:30090",
"4": "172.20.0.67:30090",
"5": "172.20.0.75:30090",
}
# Each AS participating in hidden paths has their own hidden paths configuration file.
hp_configs = {
"2": "hp_groups_as2_as5.yml",
Expand Down Expand Up @@ -86,16 +108,13 @@ def setup_prepare(self):
# even though some don't need the registration service.
as_dir_path = self.artifacts / "gen" / ("ASff00_0_%s" % as_number)

# The hidden_segment services are behind the same server as the control_service.
topology_file = as_dir_path / "topology.json"
control_service_addr = scion.load_from_json(
'control_service.%s.addr' % control_id, [topology_file])
topology_update = {
"hidden_segment_lookup_service.%s.addr" % control_id:
control_service_addr,
control_addresses[as_number],
"hidden_segment_registration_service.%s.addr" % control_id:
control_service_addr,
control_addresses[as_number],
}
topology_file = as_dir_path / "topology.json"
scion.update_json(topology_update, [topology_file])

def setup_start(self):
Expand All @@ -106,13 +125,9 @@ def setup_start(self):
self._server = server

super().setup_start()
time.sleep(10) # Give applications time to download configurations

self._ases = {
"2": "1-ff00:0:2",
"3": "1-ff00:0:3",
"4": "1-ff00:0:4",
"5": "1-ff00:0:5",
}
server.shutdown()

def _run(self):
self.await_connectivity()
Expand Down
9 changes: 9 additions & 0 deletions acceptance/old_new_br/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("//acceptance/common:topogen.bzl", "topogen_test")

topogen_test(
name = "test",
src = "test.py",
args = ["--executable=end2end_integration:$(location //tools/end2end_integration)"],
data = ["//tools/end2end_integration"],
topo = "//acceptance/old_new_br/testdata:topology.topo",
)
56 changes: 56 additions & 0 deletions acceptance/old_new_br/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

# Copyright 2023 ETH Zurich

import time

from acceptance.common import base
from acceptance.common import scion
# from plumbum import local


class Test(base.TestTopogen):
"""
Constructs a simple test topology with one core, two leaf ASes.
Each of them will run a different mix between BR that will replicate
the old behaviour (i.e., they will send traffic to its own AS to the
endhost default port) and routers with the new behaviour (i.e., they
will rewrite the underlay UDP/IP destination port with the UDP/SCION
port).
AS 1-ff00:0:1 is core.
AS 1-ff00:0:2, 1-ff00:0:3 are leaves.
We use the shortnames AS1, AS2, etc. for the ASes above.
AS1 contains a BR with the port rewriting configuration to the default
range. It also includes a shim dispatcher.
AS2 contains a BR with a configuration that reassembles the old
behaviour, i.e., sending all traffic to default endhost port 30041.
It also includes a shim dispatcher.
AS3 contains a BR with the port rewriting configuration to the default
range. It does not include the shim dispatcher.
"""

def setup_prepare(self):
super().setup_prepare()

br_as_2_id = "br1-ff00_0_2-1"

br_as_2_file = self.artifacts / "gen" / "ASff00_0_2" \
/ ("%s.toml" % br_as_2_id)
scion.update_toml({"router.endhost_start_port": 0,
"router.endhost_end_port": 0},
[br_as_2_file])

def setup_start(self):
super().setup_start()
time.sleep(10) # TODO(JordiSubira): Replace with self.await_connectivity() after rebasing

def _run(self):
ping_test = self.get_executable("end2end_integration")
ping_test["-d", "-outDir", self.artifacts].run_fg()


if __name__ == "__main__":
base.main(Test)
3 changes: 3 additions & 0 deletions acceptance/old_new_br/testdata/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports_files([
"topology.topo",
])
15 changes: 15 additions & 0 deletions acceptance/old_new_br/testdata/topology.topo
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- # Test Topology
ASes:
"1-ff00:0:1":
core: true
voting: true
authoritative: true
issuing: true
"1-ff00:0:2":
cert_issuer: 1-ff00:0:1
"1-ff00:0:3":
cert_issuer: 1-ff00:0:1
test_dispatcher: False
links:
- {a: "1-ff00:0:1#2", b: "1-ff00:0:2#1", linkAtoB: CHILD}
- {a: "1-ff00:0:1#3", b: "1-ff00:0:3#1", linkAtoB: CHILD}
1 change: 1 addition & 0 deletions acceptance/router_multi/conf/topology.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"isd_as": "1-ff00:0:1",
"mtu": 1472,
"attributes": [],
"endhost_port_range": "1024-65535",
"border_routers": {
"brA": {
"internal_addr": "192.168.0.11:30001",
Expand Down
24 changes: 0 additions & 24 deletions acceptance/sig_short_exp_time/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ sh_test(
srcs = ["test"],
data = [
"docker-compose.yml",
":dispatcher1.tar",
":dispatcher2.tar",
":sig1.tar",
":sig2.tar",
":udpproxy.tar",
Expand All @@ -24,28 +22,6 @@ container_image(
base = "//tools/udpproxy",
)

container_image(
name = "dispatcher1",
base = "//docker:dispatcher",
cmd = [
"--config",
"/disp.toml",
],
entrypoint = ["/app/dispatcher"],
files = ["testdata/1-ff00_0_110/dispatcher/disp.toml"],
)

container_image(
name = "dispatcher2",
base = "//docker:dispatcher",
cmd = [
"--config",
"/disp.toml",
],
entrypoint = ["/app/dispatcher"],
files = ["testdata/1-ff00_0_111/dispatcher/disp.toml"],
)

container_image(
name = "sig1",
base = "//docker:posix_gateway",
Expand Down
24 changes: 12 additions & 12 deletions acceptance/sig_short_exp_time/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,38 +62,38 @@ services:
cap_add:
- NET_ADMIN
container_name: sig1
depends_on:
- dispatcher1
image: bazel/acceptance/sig_short_exp_time:sig1
network_mode: service:dispatcher1
networks:
bridge1:
ipv4_address: 242.254.100.2
privileged: true
volumes:
- vol_scion_disp_sig1-ff00_0_110:/run/shm/dispatcher:rw
- /dev/net/tun:/dev/net/tun
sig2:
cap_add:
- NET_ADMIN
container_name: sig2
depends_on:
- dispatcher2
image: bazel/acceptance/sig_short_exp_time:sig2
network_mode: service:dispatcher2
networks:
bridge2:
ipv4_address: 242.254.200.2
privileged: true
volumes:
- vol_scion_disp_sig1-ff00_0_111:/run/shm/dispatcher:rw
- /dev/net/tun:/dev/net/tun
tester1:
container_name: tester1
image: alpine
network_mode: service:dispatcher1
networks:
bridge1:
ipv4_address: 242.254.100.10
privileged: true
tester2:
container_name: tester2
image: alpine
network_mode: service:dispatcher2
networks:
bridge2:
ipv4_address: 242.254.200.10
privileged: true
version: '2.4'
volumes:
vol_logs: null
vol_scion_disp_sig1-ff00_0_110: null
vol_scion_disp_sig1-ff00_0_111: null
2 changes: 1 addition & 1 deletion acceptance/sig_short_exp_time/test
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# | |
# | +---------------------------------------------+ |
# +---+ pathb +----
# | 242.254.100.3:50000 <-> 242.254.200.4:50000 |
# | 242.254.100.4:50000 <-> 242.254.200.4:50000 |
# +---------------------------------------------+

run_test() {(set -e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
id = "disp_1-ff00_0_110"

[log.console]
level = "debug"
level = "debug"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
id = "disp_1-ff00_0_111"

[log.console]
level = "debug"
level = "debug"
1 change: 1 addition & 0 deletions acceptance/topo_common/topology.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"isd_as": "1-ff00:0:110",
"mtu": 1400,
"endhost_port_range": "1024-65535",
"attributes": [
"core"
],
Expand Down
12 changes: 0 additions & 12 deletions acceptance/topo_cs_reload/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ go_test(
"docker-compose.yml",
"testdata/topology_reload.json",
":control.tar",
":dispatcher.tar",
":invalid_changed_ip",
":invalid_changed_port",
":testdata/gen_crypto.sh",
Expand All @@ -36,17 +35,6 @@ go_test(
],
)

container_image(
name = "dispatcher",
base = "//docker:dispatcher",
cmd = [
"--config",
"/disp.toml",
],
entrypoint = ["/app/dispatcher"],
files = ["testdata/disp.toml"],
)

container_image(
name = "control",
base = "//docker:control",
Expand Down
18 changes: 4 additions & 14 deletions acceptance/topo_cs_reload/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ networks:
config:
- subnet: 242.253.100.0/24
services:
topo_cs_reload_dispatcher:
image: bazel/acceptance/topo_cs_reload:dispatcher
networks:
bridge1:
ipv4_address: 242.253.100.2
volumes:
- vol_topo_cs_reload_disp:/run/shm/dispatcher:rw
topo_cs_reload_control_srv:
image: bazel/acceptance/topo_cs_reload:control
depends_on:
- topo_cs_reload_dispatcher
volumes:
- vol_topo_cs_reload_disp:/run/shm/dispatcher:ro
- "${TOPO_CS_RELOAD_CONFIG_DIR}/certs:/certs:ro"
- "${TOPO_CS_RELOAD_CONFIG_DIR}/keys:/keys:ro"
- "${TOPO_CS_RELOAD_CONFIG_DIR}/crypto:/crypto:ro"
network_mode: service:topo_cs_reload_dispatcher
version: '2.4'
volumes:
vol_topo_cs_reload_disp: null
networks:
bridge1:
ipv4_address: 242.253.100.2
version: '2.4'
2 changes: 0 additions & 2 deletions acceptance/topo_cs_reload/reload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func setupTest(t *testing.T) testState {
s.mustExec(t, "tar", "-xf", "crypto.tar", "-C", tmpDir)
// first load the docker images from bazel into the docker deamon, the
// tars are in the same folder as this test runs in bazel.
s.mustExec(t, "docker", "image", "load", "-i", "dispatcher.tar")
s.mustExec(t, "docker", "image", "load", "-i", "control.tar")
// now start the docker containers
s.mustExec(t, "docker", "compose", "-f", "docker-compose.yml", "up", "-d")
Expand All @@ -123,7 +122,6 @@ func (s testState) teardownTest(t *testing.T) {
require.NoError(t, os.MkdirAll(fmt.Sprintf("%s/logs", outdir), os.ModePerm|os.ModeDir))
// collect logs
for service, file := range map[string]string{
"topo_cs_reload_dispatcher": "disp.log",
"topo_cs_reload_control_srv": "control.log",
} {
cmd := exec.Command("docker", "compose",
Expand Down
1 change: 0 additions & 1 deletion acceptance/topo_cs_reload/testdata/cs.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[general]
reconnect_to_dispatcher = true
config_dir = "/"
id = "cs1-ff00_0_110-1"

Expand Down
5 changes: 0 additions & 5 deletions acceptance/topo_cs_reload/testdata/disp.toml

This file was deleted.

1 change: 0 additions & 1 deletion acceptance/topo_cs_reload/testdata/sd.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[general]
reconnect_to_dispatcher = true
config_dir = "/"
id = "sd1-ff00_0_110"

Expand Down
1 change: 1 addition & 0 deletions acceptance/topo_cs_reload/testdata/topology_reload.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"isd_as": "1-ff00:0:110",
"mtu": 1400,
"endhost_port_range": "1024-65535",
"attributes": [
"core"
],
Expand Down
Loading

0 comments on commit a627bc1

Please sign in to comment.