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

combinator: avoid returning duplicate paths #3930

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

matzf
Copy link
Contributor

@matzf matzf commented Nov 12, 2020

Duplicate paths can occur when multiple combinations of different path
segments result in identical sequences of path interfaces path after
applying short-cuts.

The old behaviour was to return all paths found. The rationale for this
was that from a crypto point of view the paths are different; this made
sense with the old path header format, where shortcuts would include a
verify-only hop field that was really separate from the effectively used
hop fields.
Now with the new path header format, the sequence of the hop fields for
such duplicate paths is really identical, the only differences are the
segment IDs and the MACs. While it's still conceivable that an AS could
misbehave and change the forwarding behaviour based on the segment IDs
or MACs, this would be really an exceptional case.
Thus, the new behaviour of the combinator is to return only one path for
each unique sequence of path interfaces found. If there are multiple
ways to construct the same sequence of path interfaces from the
available path segments, the construction with latest expiration time
will be returned.
A flag allows to still return all identical paths, so that an application
could diagnose broken paths due to such a misbehaving AS described
above. This flag is not currently exposed through sciond at the moment.

To keep this change simple, duplicates are filtered in a separate
post-processing step. In a future change, duplicates could/should be
avoided directly by reducing the available options in the graph, as we
could potentially create a large number of duplicates in wide network
topologies.


This change is Reviewable

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.

Reviewed 5 of 5 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@lukedirtwalker lukedirtwalker requested a review from scrye November 25, 2020 07:40
@matzf matzf force-pushed the deduplicate-paths branch 2 times, most recently from 2493d92 to aa60c6e Compare November 25, 2020 10:33
Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 5 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @matzf)

a discussion (no related file):
Some typos in the commit message:

  • rational -> rationale
  • realy -> really
  • identicaly -> identical


go/lib/infra/modules/combinator/combinator.go, line 110 at r2 (raw file):

// available options in the graph, as we could potentially create a large
// number of duplicates in wide network topologies.
func filterDuplicates(paths []Path) []Path {

Add unit tests for filterDuplicates. Use the export file pattern to unit test an unexported function. See the below for an example:

package grpc
var (
RequestToChainQuery = requestToChainQuery
RequestToTRCQuery = requestToTRCQuery
ChainsToResponse = chainsToResponse
TRCToResponse = trcToResponse
)


go/lib/infra/modules/combinator/combinator.go, line 111 at r2 (raw file):

// number of duplicates in wide network topologies.
func filterDuplicates(paths []Path) []Path {

Remove newline.

Copy link
Contributor

@scrye scrye 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 5 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @matzf)

@matzf matzf force-pushed the deduplicate-paths branch 2 times, most recently from e31892a to 706c558 Compare November 25, 2020 12:40
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: 3 of 7 files reviewed, 3 unresolved discussions (waiting on @marcfrei and @scrye)

a discussion (no related file):

Previously, scrye (Sergiu Costea) wrote…

Some typos in the commit message:

  • rational -> rationale
  • realy -> really
  • identicaly -> identical

Done.



go/lib/infra/modules/combinator/combinator.go, line 110 at r2 (raw file):

Previously, scrye (Sergiu Costea) wrote…

Add unit tests for filterDuplicates. Use the export file pattern to unit test an unexported function. See the below for an example:

package grpc
var (
RequestToChainQuery = requestToChainQuery
RequestToTRCQuery = requestToTRCQuery
ChainsToResponse = chainsToResponse
TRCToResponse = trcToResponse
)

Done.


go/lib/infra/modules/combinator/combinator.go, line 111 at r2 (raw file):

Previously, scrye (Sergiu Costea) wrote…

Remove newline.

Ok.

@matzf matzf force-pushed the deduplicate-paths branch from ca36f47 to 2bc3fde Compare November 25, 2020 15:22
Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @matzf)


go/lib/infra/modules/combinator/combinator_test.go, line 596 at r3 (raw file):

		Expected []uint32
	}{
		{

Add tests for nil input slice and empty input slice.

@matzf matzf force-pushed the deduplicate-paths branch from 2bc3fde to 3b42198 Compare November 27, 2020 09:33
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: 6 of 7 files reviewed, 1 unresolved discussion (waiting on @scrye)


go/lib/infra/modules/combinator/combinator_test.go, line 596 at r3 (raw file):

Previously, scrye (Sergiu Costea) wrote…

Add tests for nil input slice and empty input slice.

Ok, done.

Copy link
Contributor

@scrye scrye 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 r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@matzf
Copy link
Contributor Author

matzf commented Nov 27, 2020

/rebase

Duplicate paths can occur when multiple combinations of different path
segments result in identical sequences of path interfaces path after
applying short-cuts.

The old behaviour was to return all paths found. The rationale for this
was that from a crypto point of view the paths are different; this made
sense with the old path header format, where shortcuts would include a
verify-only hop field that was really separate from the effectively used
hop fields.
Now with the new path header format, the sequence of the hop fields for
such duplicate paths is really identical, the only differences are the
segment IDs and the MACs. While it's still conceivable that an AS could
misbehave and change the forwarding behaviour based on the segment IDs
or MACs, this would be really an exceptional case.
Thus, the new behaviour of the combinator is to return only one path for
each unique sequence of path interfaces found. If there are multiple
ways to construct the same sequence of path interfaces from the
available path segments, the construction with latest expiration time
will be returned.

To keep this change simple, duplicates are filtered in a separate
post-processing step. In a future change, duplicates could/should be
avoided directly by reducing the available options in the graph, as we
could potentially create a large number of duplicates in wide network
topologies.
Copy link
Contributor

@scrye scrye 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @matzf)

@scrye scrye merged commit 60806f4 into scionproto:master Nov 27, 2020
@matzf matzf deleted the deduplicate-paths branch November 27, 2020 15:54
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.

3 participants