From ceb907750fccb2f46535ca927c6ea1e12a15fb3b Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Fri, 1 Feb 2019 15:07:29 +0100 Subject: 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. --- prog/encodingexec_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'prog/encodingexec_test.go') 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) -- cgit mrf-deployment