From 0dc2403aa88cb51f4b61b2266db587b80f9f2026 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 9 Sep 2020 10:45:14 +0200 Subject: [PATCH] plugin/trace: fix struct allignment (#4112) * plugin/trace: fix struct allignment A 64 bit entity needs to be the first in a struct to make it work on 32 bit systems. Fixes: #4111 Signed-off-by: Miek Gieben * plugin/erratic does makes the same mistake Signed-off-by: Miek Gieben --- plugin/erratic/erratic.go | 10 ++++------ plugin/trace/trace.go | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/erratic/erratic.go b/plugin/erratic/erratic.go index 3b22e225d38c..da7f68a6498e 100644 --- a/plugin/erratic/erratic.go +++ b/plugin/erratic/erratic.go @@ -13,15 +13,13 @@ import ( // Erratic is a plugin that returns erratic responses to each client. type Erratic struct { - drop uint64 - + q uint64 // counter of queries + drop uint64 delay uint64 - duration time.Duration - truncate uint64 - large bool // undocumented feature; return large responses for A request (>512B, to test compression). - q uint64 // counter of queries + duration time.Duration + large bool // undocumented feature; return large responses for A request (>512B, to test compression). } // ServeDNS implements the plugin.Handler interface. diff --git a/plugin/trace/trace.go b/plugin/trace/trace.go index 84076126a07e..167a5a376453 100644 --- a/plugin/trace/trace.go +++ b/plugin/trace/trace.go @@ -29,6 +29,8 @@ const ( ) type trace struct { + count uint64 // as per Go spec, needs to be first element in a struct + Next plugin.Handler Endpoint string EndpointType string @@ -37,7 +39,6 @@ type trace struct { serviceName string clientServer bool every uint64 - count uint64 Once sync.Once }