Closed rcgoodfellow closed 1 year ago
The test in the initial commit is working as expected. Next I'm going to try to make the packets look exactly like they do in the report to see what happens.
I've got repro on this with 186844c
ry@masaka:~/src/p4$ RUST_BACKTRACE=1 cargo test geneve_decap -- --nocapture
[snip]
running 1 test
Decapped IP: Ipv4Packet { version : 0, header_length : 0, dscp : 0, ecn : 0, total_length : 35, identification : 0, flags : 0, fragment_offset : 0, ttl : 0, next_level_protocol : IpNextHeaderProtocol(17), checksum : 0, source : 10.0.0.1, destination : 8.8.8.8, options : [], }
Decapped UDP: UdpPacket { source : 47, destination : 74, length : 0, checksum : 99, }
thread 'decap::geneve_decap' panicked at 'assertion failed: `(left == right)`
left: `Ipv4Packet { version : 0, header_length : 5, dscp : 0, ecn : 0, total_length : 35, identification : 0, flags : 0, fragment_offset : 0, ttl : 0, next_level_protocol : IpNextHeaderProtocol(17), checksum : 0, source : 10.0.0.1, destination : 8.8.8.8, options : [], }`,
right: `Ipv4Packet { version : 0, header_length : 0, dscp : 0, ecn : 0, total_length : 35, identification : 0, flags : 0, fragment_offset : 0, ttl : 0, next_level_protocol : IpNextHeaderProtocol(17), checksum : 0, source : 10.0.0.1, destination : 8.8.8.8, options : [], }`', test/src/decap.rs:106:5
stack backtrace:
0: rust_begin_unwind
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:203:5
4: tests::decap::geneve_decap
at ./src/decap.rs:106:5
5: tests::decap::geneve_decap::{{closure}}
at ./src/decap.rs:16:1
6: core::ops::function::FnOnce::call_once
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
7: core::ops::function::FnOnce::call_once
at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test decap::geneve_decap ... FAILED
failures:
failures:
decap::geneve_decap
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 10 filtered out; finished in 0.05s
explicitly setting the header length to 5 has no effect
if (hdr.inner_ipv4.isValid()) {
hdr.ipv4 = hdr.inner_ipv4;
hdr.ipv4.ihl = 4w5;
hdr.ipv4.setValid();
hdr.ipv6.setInvalid();
hdr.inner_ipv4.setInvalid();
}
so this appears to be an issue with writing out the ipv4 header - e.g. sub-byte field serialization is not working right in this case.
There has been a report of header corruption for geneve packets that are being decapsulated by sidecar-lite. The purpose of this PR is to isolate and fix the issue.
Report Details
We see the following form dtrace probes running on the host system. The first probe shows the packet that sidecar-lite sees on ingress. The second probe shows what sidecar-lite produces on egress. The transformation that happens is the expected decapsulation.
However, what comes out the interface attached to the softnpu-standalone instance is a corrupt packet as observed by snoop.
CC: @internet-diglett