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

Fix decoding of AS-PATH for long-ish attr #62

Merged
merged 1 commit into from
Jul 13, 2024

Conversation

netixx
Copy link
Contributor

@netixx netixx commented Jul 11, 2024

The current implementation incurs counter wrap when the path is longer than an uint8.

I debugged using the following test-case, but I am not sure how to include it properly in the test-suite:

func TestASPathDecode(t *testing.T) {
	update := []byte{2, 72, 0, 0, 18, 29, 0, 0, 218, 13, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43, 0, 2, 82, 43}

	asPathAttr  := &ASPathAttr{}
	err := asPathAttr.Decode(PathAttrFlags(1<<6), update)
	if err != nil {
		t.Errorf("failed to decode: %s", err)
	}
}

@jwhited jwhited merged commit 40ced4a into jwhited:main Jul 13, 2024
4 checks passed
@jwhited
Copy link
Owner

jwhited commented Jul 13, 2024

thanks!

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