Skip to content
Snippets Groups Projects
Commit 3356dafb authored by Oliver Herms's avatar Oliver Herms
Browse files

Adding support for empty AS paths

parent 1013e996
Branches
Tags
No related merge requests found
......@@ -452,6 +452,10 @@ func ParseASPathStr(asPathString string) (*PathAttribute, error) {
newSegmentNeeded := true
currentSegment := -1
for _, asn := range strings.Split(asPathString, " ") {
if asn == "" {
continue
}
if isBeginOfASSet(asn) {
currentType = ASSet
newSegmentNeeded = true
......
......@@ -1298,6 +1298,15 @@ func TestParseASPathStr(t *testing.T) {
wantFail bool
expected *PathAttribute
}{
{
name: "Empty AS Path",
input: "",
wantFail: false,
expected: &PathAttribute{
TypeCode: ASPathAttr,
Value: ASPath{},
},
},
{
name: "Simple AS_SEQUENCE",
input: "3320 15169",
......
......@@ -41,6 +41,10 @@ func (u *UpdateSenderAddPath) AddPath(pfx net.Prefix, p *route.Path) error {
Next: &packet.PathAttribute{
TypeCode: packet.NextHopAttr,
Value: p.BGPPath.NextHop,
Next: &packet.PathAttribute{
TypeCode: packet.LocalPrefAttr,
Value: p.BGPPath.LocalPref,
},
},
},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment