File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ import (
11
11
"github.com/sirupsen/logrus"
12
12
)
13
13
14
+ // Truncate for avoiding "Parse error" from `busybox nslookup`
15
+ // https://github.com/lima-vm/lima/issues/380
16
+ const truncateSize = 512
17
+
14
18
type Handler struct {
15
19
clientConfig * dns.ClientConfig
16
20
clients []* dns.Client
@@ -174,6 +178,7 @@ func (h *Handler) handleQuery(w dns.ResponseWriter, req *dns.Msg) {
174
178
}
175
179
}
176
180
if handled {
181
+ reply .Truncate (truncateSize )
177
182
_ = w .WriteMsg (& reply )
178
183
return
179
184
}
@@ -186,13 +191,15 @@ func (h *Handler) handleDefault(w dns.ResponseWriter, req *dns.Msg) {
186
191
addr := fmt .Sprintf ("%s:%s" , srv , h .clientConfig .Port )
187
192
reply , _ , err := client .Exchange (req , addr )
188
193
if err == nil {
194
+ reply .Truncate (truncateSize )
189
195
_ = w .WriteMsg (reply )
190
196
return
191
197
}
192
198
}
193
199
}
194
200
var reply dns.Msg
195
201
reply .SetReply (req )
202
+ reply .Truncate (truncateSize )
196
203
_ = w .WriteMsg (& reply )
197
204
}
198
205
You can’t perform that action at this time.
0 commit comments