Skip to content
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

refactor: replace addr.HostAddr hierarchy with tagged union addr.Host #4346

Merged
merged 8 commits into from
Jul 10, 2023

Conversation

matzf
Copy link
Contributor

@matzf matzf commented Jun 1, 2023

Replace the addr.HostAddr type hierarchy, consisting of the HostAddr interface and the HostNone, HostIPv4, HostIPv6 and HostSVC implementations with a single type addr.Host, representing all the different host address types as a tagged union ("sum type"). This uses, and follows the spirit of, the net/netip.Addr types to represent IP addresses for both IPv4 and IPv6.

The addr.Host type is a simple value type, which can be created and copied without heap allocations and can be used in comparisons and as map keys.
In addition to replacing all uses of addr.HostAddr, the new addr.Host type is used in the slayers.SCION.Get/SetSrc/DstAddr interfaces, as well as in the DRKey infrastructure. Using a consistent representation of the addresses allows to get rid of duplicate functionality and a number of address conversions, e.g. in snet.
In contrast to the addr.HostAddr interface, the new addr.Host does not implement the net.Addr interface. In particular, service addresses were passed through layers requiring a net.Addr. Use snet.SVCAddr in these cases.

Additionally, add a new addr.Addr type representing a full SCION address (ISD, AS and host address), including parsing functionality. This definition is identical to the snet.SCIONAddress type, which is now only kept as a type alias for compatibility.

Closes #4149.

Future work:

  • pkg/addr is a public API and should have a more SCION-specific and less clash-likely name, e.g. saddr
  • replace snet.SCIONAddress by addr.Addr
  • adopt using addr.Addr in the ping, traceroute etc tools, in place of the ill-fitting use of snet.UDPAddr.
  • add addr.MustParse{ISD,AS,IA} for completeness sake (currently in xtest package)
  • get rid of the IP-slice to netip.Addr conversions by gradually increasing the adoption of netip.Addr and related APIs

This change is Reviewable

@matzf matzf requested review from a team and oncilla as code owners June 1, 2023 08:34
@matzf matzf force-pushed the addr-host-refactor branch 2 times, most recently from b5b945b to d44237c Compare June 2, 2023 07:27
Copy link
Contributor

@marcfrei marcfrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 110 of 116 files at r1, 12 of 12 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @matzf and @oncilla)


pkg/addr/host.go line 95 at r2 (raw file):

// IP address.
// TODO(matzf): return ok or ...?
func HostIPFromSlice(ip net.IP) Host {
  • Just HostFromSlice instead of HostIPFromSlice?
  • Re "return ok or ...?": Browsing through the existing code, I see the convenience argument, nevertheless I lean towards passing the ok value to the caller instead of returning an invalid address.

pkg/addr/svc.go line 40 at r2 (raw file):

// SVC is a SCION service address.
// A service address is a short identifier for the service type, and a
// flag-bit to for multicast.

"flag-bit for multicast"?

Code quote:

flag-bit to for multicast

@matzf matzf force-pushed the addr-host-refactor branch from d44237c to 3233ae5 Compare June 12, 2023 12:17
Copy link
Contributor Author

@matzf matzf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 95 of 125 files reviewed, all discussions resolved (waiting on @marcfrei and @oncilla)


pkg/addr/host.go line 95 at r2 (raw file):

Previously, marcfrei (Marc Frei) wrote…
  • Just HostFromSlice instead of HostIPFromSlice?
  • Re "return ok or ...?": Browsing through the existing code, I see the convenience argument, nevertheless I lean towards passing the ok value to the caller instead of returning an invalid address.

Done. I've added the handling of the ok result by raising errors where appropriate. This looks a bit clunky in some places now, but as pointed out in the PR description, the plan is to get rid of these type conversions by adopting the netip.Addr etc more broadly.
When the caller needs to handle the ok result, this HostIPFromSlice is really no longer any more convenient than using netip.AddrFromSlice directly, and so I've removed the function entirely.

Copy link
Contributor

@marcfrei marcfrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 5 of 17 files at r3, 25 of 25 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @oncilla)

@matzf matzf force-pushed the addr-host-refactor branch from 7ec7810 to 62ab7de Compare June 23, 2023 08:09
@lukedirtwalker lukedirtwalker self-requested a review June 23, 2023 08:45
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 95 of 116 files at r1, 5 of 17 files at r3, 25 of 25 files at r4, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @matzf and @oncilla)


pkg/addr/addr.go line 63 at r4 (raw file):

	return fmt.Sprintf("%s,%s", a.IA, a.Host)
}

I think it would be nice if we'd also implement TextMarshaler and TextUnmarshaler


pkg/addr/addr.go line 85 at r4 (raw file):

// EXPERIMENTAL: This API is experimental. It may be changed to return a
// combined AddrPort type instead.
func ParseAddrPort(s string) (Addr, uint16, error) {

should we also have an JoinAddrPort?


pkg/addr/addr.go line 88 at r4 (raw file):

	host, port, err := net.SplitHostPort(s)
	if err != nil {
		return Addr{}, 0, serrors.WrapStr("invalid address: split host:port", err, "addr", s)

I wonder if it would be desirable to get rid of the serrors dependency on this package and if it is I would suggest to use fmt.Errorf here.


pkg/addr/host.go line 51 at r4 (raw file):

//
// The zero value is a valid object with Host{}.Type() == HostTypeNone.
type Host struct {

I think we should sort the members by size to get the better alignment (and smaller struct size): ip, svc, t, I wonder why SVC needs to be a uint16 and not just a uint8 (but it doesn't matter much anyway)


pkg/addr/svc.go line 43 at r4 (raw file):

// The package's SVC constant values are defined without multicast.
// The Multicast and Base methods set/unset the multicast flag.
type SVC uint16

If we anyway rework, can we get rid of the SVC multicast ? :P


pkg/addr/svc.go line 85 at r4 (raw file):

}

// XXX(matzf): change this to the format accepted by ParseSVC?

hm I think it's not nice that we don't have a matching pair. I would have expected that whatever I print with String() I can also parse.


tools/braccept/cases/bfd.go line 106 at r4 (raw file):

		SrcIA:        remoteIA,
	}
	err := scionL.SetSrcAddr(addr.HostIP(netip.MustParseAddr("192.168.13.3")))

why not use addr.MustParseHost() here and below?


tools/braccept/cases/child_to_child_xover.go line 112 at r4 (raw file):

	}

	if err := scionL.SetSrcAddr(addr.HostIP(netip.MustParseAddr("172.16.5.1"))); err != nil {

MustParseHost ?


tools/braccept/cases/child_to_internal.go line 101 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.HostIP(netip.MustParseAddr("172.16.4.1"))); err != nil {

MustParseHost? here and below?


tools/braccept/cases/child_to_parent.go line 109 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.HostIP(netip.MustParseAddr("172.16.4.1"))); err != nil {

ditto


tools/braccept/cases/internal_to_child.go line 104 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.MustParseHost("192.168.0.51")); err != nil {

ditto


tools/braccept/cases/jumbo.go line 108 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil {

ditto


tools/braccept/cases/onehop.go line 82 at r4 (raw file):

		Path:         ohp,
	}
	if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.4.1")); err != nil {

ditto


tools/braccept/cases/parent_to_child.go line 108 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil {

ditto


tools/braccept/cases/parent_to_internal.go line 95 at r4 (raw file):

		Path:         sp,
	}
	if err := scionL.SetSrcAddr(addr.MustParseHost("172.16.3.1")); err != nil {

ditto

Copy link
Contributor Author

@matzf matzf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @lukedirtwalker and @oncilla)


pkg/addr/addr.go line 63 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I think it would be nice if we'd also implement TextMarshaler and TextUnmarshaler

Done.


pkg/addr/addr.go line 85 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

should we also have an JoinAddrPort?

Done.
I thought that the "Join" name is a bit close to net.JoinHostPort which also works on scion addresses (in the form of strings). I would have chosen FmtAddrPort but this package already contains a few FormatXY functions, so I went with FormatAddrPort.


pkg/addr/addr.go line 88 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I wonder if it would be desirable to get rid of the serrors dependency on this package and if it is I would suggest to use fmt.Errorf here.

Ok to look into this as a follow up? The serrors package is throughout addr and this would all need to change as we don't gain anything by using a different error mechanism only in the new functionality.


pkg/addr/host.go line 51 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I think we should sort the members by size to get the better alignment (and smaller struct size): ip, svc, t, I wonder why SVC needs to be a uint16 and not just a uint8 (but it doesn't matter much anyway)

Excellent, done.

The uint16 is really a bit weird. The address field in the packet header is 4 bytes wide and it currently only uses the upper two bytes.


pkg/addr/svc.go line 43 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

If we anyway rework, can we get rid of the SVC multicast ? :P

I'm happy to work more on this, and I agree that the service addresses can be used better. But such a functional change to the service addresses themselves should perhaps be discussed separately.


pkg/addr/svc.go line 85 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

hm I think it's not nice that we don't have a matching pair. I would have expected that whatever I print with String() I can also parse.

Done. It now only contains the hex representation of the service identifier in cases where it's unknown. This format cannot currently be parsed back.


tools/braccept/cases/bfd.go line 106 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

why not use addr.MustParseHost() here and below?

Done.


tools/braccept/cases/child_to_child_xover.go line 112 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

MustParseHost ?

Done.


tools/braccept/cases/child_to_internal.go line 101 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

MustParseHost? here and below?

Done.


tools/braccept/cases/child_to_parent.go line 109 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done.


tools/braccept/cases/internal_to_child.go line 104 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done.


tools/braccept/cases/jumbo.go line 108 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done (was already MustParseHost here)


tools/braccept/cases/onehop.go line 82 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done.


tools/braccept/cases/parent_to_child.go line 108 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done.


tools/braccept/cases/parent_to_internal.go line 95 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

ditto

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 11 of 11 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @oncilla)


pkg/addr/svc.go line 43 at r4 (raw file):

Previously, matzf (Matthias Frei) wrote…

I'm happy to work more on this, and I agree that the service addresses can be used better. But such a functional change to the service addresses themselves should perhaps be discussed separately.

Agreed.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @oncilla)

@matzf
Copy link
Contributor Author

matzf commented Jun 27, 2023

Thanks for the reviews and feedback so far!
Since this PR implements a proposal that has not been formally accepted, I will add the "final comment period" label on #4149 and leave this PR open until the 10 day period has elapsed.

@matzf matzf force-pushed the addr-host-refactor branch from 0e97b8c to c117167 Compare July 10, 2023 09:06
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 30 of 30 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @oncilla)

@matzf matzf merged commit 9f77b13 into scionproto:master Jul 10, 2023
@matzf matzf deleted the addr-host-refactor branch July 10, 2023 12:03
oncilla added a commit to oncilla/scion that referenced this pull request Aug 16, 2023
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.
matzf pushed a commit that referenced this pull request Oct 10, 2023
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 #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.
marcfrei pushed a commit to JordiSubira/scion that referenced this pull request Oct 27, 2023
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.
JordiSubira added a commit to JordiSubira/scion that referenced this pull request Mar 5, 2024
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
JordiSubira added a commit to JordiSubira/scion that referenced this pull request Mar 11, 2024
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

fix dispatcherless docker and integration tests

ignore SCMP errors messages on initSvcRedirect()

adapt HP test

adapt integration tests

error string HP control/main

dispatcher pass return addresses in helper function by value
JordiSubira added a commit to JordiSubira/scion that referenced this pull request May 10, 2024
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

fix dispatcherless docker and integration tests

ignore SCMP errors messages on initSvcRedirect()

adapt HP test

adapt integration tests

error string HP control/main

dispatcher pass return addresses in helper function by value

fix rebase

upgrade dispatcher shim config to toml v2

add PortRange() RPC in daemon

Revert "modify HP and tests"

This reverts commit 1c82e9c.

remove leftover CSResolver leftover in HP discovery

open a single underlay socket for both the QUIC server and the SVC redirector

revert acceptance/hiden_paths test

await connectivity in old_br acceptance test

pass

pass

pass

pass

pass + lint

pass

changes to snet API + refactor

pass + allow for using snet outside the defined port range

changes in isShimDispatcher()

add destination safeguard to snet.scionConnReader.read()

add TODOs

lint

change dispatched_ports name in topo

add dispatched_ports all|ALL option

range for services in topology PortGenerator

dynamic ports refactoring

add isDispatcher flag

fix clientNet SCMPHandler

add default value for shim underlay addr

fix dispatcher port + cleaning isShimDispatcher

add dstPort check reader

remove leftover + TODO

revert destination type in ResolverPacketConn

replace UnderlayAddr

comment

comments + TODOs + refactoring

add options pattern NewCookedConn

improve error message

pass
JordiSubira added a commit to JordiSubira/scion that referenced this pull request May 15, 2024
change last-mile router port forwarding

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

fix dispatcherless docker and integration tests

ignore SCMP errors messages on initSvcRedirect()

adapt HP test

adapt integration tests

error string HP control/main

dispatcher pass return addresses in helper function by value

fix rebase

upgrade dispatcher shim config to toml v2

add PortRange() RPC in daemon

Revert "modify HP and tests"

This reverts commit 1c82e9c.

remove leftover CSResolver leftover in HP discovery

open a single underlay socket for both the QUIC server and the SVC redirector

revert acceptance/hiden_paths test

await connectivity in old_br acceptance test

pass

pass

pass

pass

pass + lint

pass

changes to snet API + refactor

pass + allow for using snet outside the defined port range

changes in isShimDispatcher()

add destination safeguard to snet.scionConnReader.read()

add TODOs

lint

change dispatched_ports name in topo

add dispatched_ports all|ALL option

range for services in topology PortGenerator

dynamic ports refactoring

add isDispatcher flag

fix clientNet SCMPHandler

add default value for shim underlay addr

fix dispatcher port + cleaning isShimDispatcher

add dstPort check reader

remove leftover + TODO

revert destination type in ResolverPacketConn

replace UnderlayAddr

comment

comments + TODOs + refactoring

add options pattern NewCookedConn

improve error message

pass

fix rebase

rename dispatcher flag

mocks

pass

update sig_short_exp_time docker file

fix dialer constructor

fix docker image references for sig

adapt end2end test to use Dial/Listen API

remove debug logs

add comment for snet.Dial
JordiSubira added a commit to JordiSubira/scion that referenced this pull request May 17, 2024
change last-mile router port forwarding

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

fix dispatcherless docker and integration tests

ignore SCMP errors messages on initSvcRedirect()

adapt HP test

adapt integration tests

error string HP control/main

dispatcher pass return addresses in helper function by value

fix rebase

upgrade dispatcher shim config to toml v2

add PortRange() RPC in daemon

Revert "modify HP and tests"

This reverts commit 1c82e9c.

remove leftover CSResolver leftover in HP discovery

open a single underlay socket for both the QUIC server and the SVC redirector

revert acceptance/hiden_paths test

await connectivity in old_br acceptance test

pass

pass

pass

pass

pass + lint

pass

changes to snet API + refactor

pass + allow for using snet outside the defined port range

changes in isShimDispatcher()

add destination safeguard to snet.scionConnReader.read()

add TODOs

lint

change dispatched_ports name in topo

add dispatched_ports all|ALL option

range for services in topology PortGenerator

dynamic ports refactoring

add isDispatcher flag

fix clientNet SCMPHandler

add default value for shim underlay addr

fix dispatcher port + cleaning isShimDispatcher

add dstPort check reader

remove leftover + TODO

revert destination type in ResolverPacketConn

replace UnderlayAddr

comment

comments + TODOs + refactoring

add options pattern NewCookedConn

improve error message

pass

fix rebase

rename dispatcher flag

mocks

pass

update sig_short_exp_time docker file

fix dialer constructor

fix docker image references for sig

adapt end2end test to use Dial/Listen API

remove debug logs

add comment for snet.Dial

typo
matzf pushed a commit to JordiSubira/scion that referenced this pull request May 17, 2024
change last-mile router port forwarding

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

fix dispatcherless docker and integration tests

ignore SCMP errors messages on initSvcRedirect()

adapt HP test

adapt integration tests

error string HP control/main

dispatcher pass return addresses in helper function by value

fix rebase

upgrade dispatcher shim config to toml v2

add PortRange() RPC in daemon

Revert "modify HP and tests"

This reverts commit 1c82e9c.

remove leftover CSResolver leftover in HP discovery

open a single underlay socket for both the QUIC server and the SVC redirector

revert acceptance/hiden_paths test

await connectivity in old_br acceptance test

pass

pass

pass

pass

pass + lint

pass

changes to snet API + refactor

pass + allow for using snet outside the defined port range

changes in isShimDispatcher()

add destination safeguard to snet.scionConnReader.read()

add TODOs

lint

change dispatched_ports name in topo

add dispatched_ports all|ALL option

range for services in topology PortGenerator

dynamic ports refactoring

add isDispatcher flag

fix clientNet SCMPHandler

add default value for shim underlay addr

fix dispatcher port + cleaning isShimDispatcher

add dstPort check reader

remove leftover + TODO

revert destination type in ResolverPacketConn

replace UnderlayAddr

comment

comments + TODOs + refactoring

add options pattern NewCookedConn

improve error message

pass

fix rebase

rename dispatcher flag

mocks

pass

update sig_short_exp_time docker file

fix dialer constructor

fix docker image references for sig

adapt end2end test to use Dial/Listen API

remove debug logs

add comment for snet.Dial

typo
matzf added a commit that referenced this pull request Jul 9, 2024
Providing MustParseX along with ParseX is a typical pattern in Go. There
was already addr.MustParseAddr (since #4346), but MustParseIA and
MustParseAS were only defined as helper function in the internal xtest
package.

Define addr.MustParseIA, MustParseAS, MustParseISD to replace the
definitions in the xtest package.
Remove the rarely used plural forms, xtest.MustParseIAs/ASes; simply
typing this out instead seems perfectly appropriate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor addr.HostAddr types
3 participants