Skip to content

Commit

Permalink
tweak logs
Browse files Browse the repository at this point in the history
  • Loading branch information
IrineSistiana committed Oct 27, 2021
1 parent 9eb8415 commit f01ca4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dispatcher/handler/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ func NewContext(q *dns.Msg, from net.Addr) *Context {
return ctx
}

// String returns a short summery of its query.
func (ctx *Context) String() string {
q := ctx.q
if len(q.Question) == 1 {
q := q.Question[0]
return fmt.Sprintf("%s %s %s %d %d", q.Name, dnsutils.QclassToString(q.Qclass), dnsutils.QtypeToString(q.Qtype), ctx.q.Id, ctx.id)
return fmt.Sprintf("%s %s %s %d %d %s", q.Name, dnsutils.QclassToString(q.Qclass), dnsutils.QtypeToString(q.Qtype), ctx.q.Id, ctx.id, ctx.clientAddr)
}
return fmt.Sprintf("%v %d %d", ctx.q.Question, ctx.id, ctx.q.Id)
return fmt.Sprintf("%v %d %d %s", ctx.q.Question, ctx.q.Id, ctx.id, ctx.clientAddr)
}

// Q returns the query msg. It always returns a non-nil msg.
Expand Down
2 changes: 0 additions & 2 deletions dispatcher/plugin/executable/nftset/nftset_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,12 @@ func (p *nftsetPlugin) addElems(r *dns.Msg) error {
}

if p.v4set != nil && len(v4Elems) > 0 {
p.L().Debug("push ipv4 elems to set", zap.Int("len", len(v4Elems)))
if err := p.v4set.AddElems(v4Elems); err != nil {
return fmt.Errorf("failed to add ipv4 elems %s: %w", v4Elems, err)
}
}

if p.v6set != nil && len(v6Elems) > 0 {
p.L().Debug("push ipv6 elems to set", zap.Int("len", len(v6Elems)))
if err := p.v6set.AddElems(v6Elems); err != nil {
return fmt.Errorf("failed to add ipv6 elems %s: %w", v6Elems, err)
}
Expand Down

0 comments on commit f01ca4f

Please # to comment.