Open hprem opened 5 months ago
I had a quick look at this. The failure is in prepending an ASPath to a route that has no existing AS_SET or AS_SEQUENCE. The code checks the length, but doesn't deal with that lack of length in the second part:
let data = if len != 0 && buf[0] == Attribute::AS_PATH_TYPE_SEQ && buf[1] < 255 {
let mut new_buf = Vec::with_capacity(len as usize + 4);
new_buf.put_u8(buf[0]);
new_buf.put_u8(buf[1] + 1);
new_buf.put_u32(as_number);
new_buf.put(&buf[2..]);
AttributeData::Bin(new_buf)
} else {
let mut new_buf = Vec::with_capacity(len as usize + 6);
new_buf.put_u8(Attribute::AS_PATH_TYPE_SEQ);
new_buf.put_u8(1);
new_buf.put_u32(as_number);
new_buf.put(&buf[4..]);
AttributeData::Bin(new_buf)
};
Looking in the bview file, I see the following. Note the prefix at line 81357 has no AS Path.
81354,84.205.0.0/19 3356 8928 24724 31608
81355,84.205.32.0/19 8419 6461 1299 3307
81356,84.205.80.0/24 6067 16150 1103 1125 196613 12654
81357,84.205.81.0/24
81358,84.205.83.0/24 6067 5413 12654
81359,84.205.84.0/24 6067 16150 8928 513 513 513 513 12654
81360,84.205.85.0/24 6067 13237 12654
So we don't take the first path because len is zero, but then there's an assumption data is there. I think the 'len != 0' check is to protect the AS_PATH_TYPE_SEQ check.
Hello, While trying out rustybgp, I am hitting this panic on injecting routes from the mrt dump http://data.ris.ripe.net/rrc01/2010.01/bview.20100101.0759.gz. Was able to inject ~ 80k routes without any issues, before hitting the issue
thread '<unnamed>' panicked at 'range start index 4 out of range for slice of length 0', daemon/src/packet/bgp.rs:936:26
Config
stack backtrace