aboutsummaryrefslogtreecommitdiffstats
path: root/sys/decl.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-01-25 16:18:05 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-01-25 20:31:13 +0100
commit63b16a5d5cfd3b41f596daccd56d32b2548ec119 (patch)
tree3dfa93b07083b7ee4c21aa430aeedc92b9a16bb4 /sys/decl.go
parentc8d03a05f3acd375badcde94264909d149784778 (diff)
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.
Diffstat (limited to 'sys/decl.go')
-rw-r--r--sys/decl.go13
1 files changed, 12 insertions, 1 deletions
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")
}