From 63b16a5d5cfd3b41f596daccd56d32b2548ec119 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 25 Jan 2017 16:18:05 +0100 Subject: prog, sys: add csum type, embed checksums for ipv4 packets This change adds a `csum[kind, type]` type. The only available kind right now is `ipv4`. Using `csum[ipv4, int16be]` in `ipv4_header` makes syzkaller calculate and embed correct checksums into ipv4 packets. --- sys/decl.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/decl.go') diff --git a/sys/decl.go b/sys/decl.go index 3c98d1038..14f1105de 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -191,6 +191,17 @@ type ProcType struct { ValuesPerProc uint64 } +type CsumKind int + +const ( + CsumIPv4 CsumKind = iota +) + +type CsumType struct { + IntTypeCommon + Kind CsumKind +} + type VmaType struct { TypeCommon RangeBegin int64 // in pages @@ -573,7 +584,7 @@ func ForeachType(meta *Call, f func(Type)) { rec(opt) } case *ResourceType, *BufferType, *VmaType, *LenType, - *FlagsType, *ConstType, *IntType, *ProcType: + *FlagsType, *ConstType, *IntType, *ProcType, *CsumType: default: panic("unknown type") } -- cgit mrf-deployment