NetSys / NetBricks

NetBricks: A new network function framework based on Rust.
ISC License
464 stars 75 forks source link

a bug in ip.rs ? #49

Closed jackyangNJ closed 7 years ago

jackyangNJ commented 7 years ago

Hello, I was testing the module aclfw, however, I found it cannot work correctly when I wanted to filter a specified source port. I looked up into the code of ip.rs used by aclfw. code snap from ip rs let port_as_u8 = self_as_u8.offset(self.length() as isize);, the offset value may be wrong. self.length() is the whole length of ip packet, not the ip header length. So let dst_port = BigEndian::read_u16(&port_slice[..16]); gets the wrong value. Also, port_slice[..16] may not be right.

Thanks!

shwang commented 7 years ago

Thanks for pointing this out, Jack!