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

border: check errors before updating metadata #1988

Merged
merged 3 commits into from
Oct 18, 2018

Conversation

sgmonroy
Copy link
Contributor

@sgmonroy sgmonroy commented Oct 16, 2018

Check for possible errors when incrementing the path before updating the
packet metadata, which can result in an invalid state.

The issue showed up when the border router processes a BadSegment
packet. Because the metadata is updated, when we create the scmp reply
and reverse the packet, we fail to increment the reversed path, not
being able to send the error back.

With this change, the packet metadata is only updated once we have
verified that there are no errors when incrementing the path.


This change is Reviewable

Copy link
Contributor

@kormat kormat 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 r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sgmonroy)


go/border/rpkt/path.go, line 354 at r1 (raw file):

	}
	// Check that the segment didn't change from a down-segment to an up-segment.
	if origConsDir && !*rp.consDirFlag {

This check can't be moved here, consDirFlag hasn't been changed yet.

Copy link
Contributor Author

@sgmonroy sgmonroy 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, 1 unresolved discussion (waiting on @sgmonroy)


go/border/rpkt/path.go, line 354 at r1 (raw file):

Previously, kormat (Stephen Shirley) wrote…

This check can't be moved here, consDirFlag hasn't been changed yet.

I made a mistake when creating the patch, will fix in next version.

Copy link
Contributor

@kormat kormat 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 r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sgmonroy)


go/border/rpkt/path.go, line 363 at r2 (raw file):

	rp.hopF = hopF
	rp.IncrementedPath = true
	if segChgd {

As discussed offline, i think this block should be dropped, and just have rp.consDirFlag = rp.infoF.ConsDir.

Copy link
Contributor Author

@sgmonroy sgmonroy 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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @kormat)


go/border/rpkt/path.go, line 363 at r2 (raw file):

Previously, kormat (Stephen Shirley) wrote…

As discussed offline, i think this block should be dropped, and just have rp.consDirFlag = rp.infoF.ConsDir.

Done.

Copy link
Contributor

@kormat kormat 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 1 of 1 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Check for possible errors when incrementing the path before updating the
packet metadata, which can result in an invalid state.

The issue showed up when the border router processes a BadSegment
packet. Because the metadata is updated, when we create the scmp reply
and reverse the packet, we fail to increment the reversed path, not
being able to send the error back.

With this change, the packet metadata is only updated once we have
verified that there are no errors when incrementing the path.
@sgmonroy sgmonroy merged commit c708a27 into scionproto:master Oct 18, 2018
@sgmonroy sgmonroy deleted the br-fix-incpath branch October 18, 2018 08:30
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.

2 participants