diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2019-02-01 15:07:29 +0100 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@gmail.com> | 2019-02-01 16:52:54 +0100 |
| commit | ceb907750fccb2f46535ca927c6ea1e12a15fb3b (patch) | |
| tree | e6375c74b499171b66d5a38a99b666a70271c94f /prog/encodingexec_test.go | |
| parent | 9f528bbcc8a3d94c9be27a0eecc12022d4b3bfaa (diff) | |
prog: fix checksum dependencies
Make pseudo checksums depend (via csumUses) on the arg it requires for
calculation. Otherwise we fail to assign addrs to those args during encoding
for execution. Also add a test.
Diffstat (limited to 'prog/encodingexec_test.go')
| -rw-r--r-- | prog/encodingexec_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/prog/encodingexec_test.go b/prog/encodingexec_test.go index cfae11ccd..7a5c066b8 100644 --- a/prog/encodingexec_test.go +++ b/prog/encodingexec_test.go @@ -427,6 +427,28 @@ func TestSerializeForExec(t *testing.T) { }, nil, }, + { + "test$csum_ipv4_tcp(&(0x7f0000000000)={{0x0, 0x1, 0x2}, {{0x0}, \"ab\"}})", + []uint64{ + execInstrCopyin, dataOffset + 0, execArgConst, 2, 0x0, + execInstrCopyin, dataOffset + 2, execArgConst, 4 | 1<<8, 0x1, + execInstrCopyin, dataOffset + 6, execArgConst, 4 | 1<<8, 0x2, + execInstrCopyin, dataOffset + 10, execArgConst, 2, 0x0, + execInstrCopyin, dataOffset + 12, execArgData, 1, 0xab, + + execInstrCopyin, dataOffset + 10, execArgCsum, 2, ExecArgCsumInet, 5, + ExecArgCsumChunkData, dataOffset + 2, 4, + ExecArgCsumChunkData, dataOffset + 6, 4, + ExecArgCsumChunkConst, 0x0600, 2, + ExecArgCsumChunkConst, 0x0300, 2, + ExecArgCsumChunkData, dataOffset + 10, 3, + execInstrCopyin, dataOffset + 0, execArgCsum, 2, ExecArgCsumInet, 1, + ExecArgCsumChunkData, dataOffset + 0, 10, + callID("test$csum_ipv4_tcp"), ExecNoCopyout, 1, execArgConst, ptrSize, dataOffset, + execInstrEOF, + }, + nil, + }, } buf := make([]byte, ExecBufferSize) |
