plugin/k8s_external: Set authoritative bit in responses (#5284)
set authoritative bit in responses Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
83021637b3
commit
e60c179194
4 changed files with 9 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
func (e *External) serveApex(state request.Request) (int, error) {
|
||||
m := new(dns.Msg)
|
||||
m.SetReply(state.Req)
|
||||
m.Authoritative = true
|
||||
switch state.QType() {
|
||||
case dns.TypeSOA:
|
||||
m.Answer = []dns.RR{e.soa(state)}
|
||||
|
@ -37,6 +38,7 @@ func (e *External) serveSubApex(state request.Request) (int, error) {
|
|||
|
||||
m := new(dns.Msg)
|
||||
m.SetReply(state.Req)
|
||||
m.Authoritative = true
|
||||
|
||||
// base is either dns. of ns1.dns (or another name), if it's longer return nxdomain
|
||||
switch labels := dns.CountLabel(base); labels {
|
||||
|
|
|
@ -41,6 +41,9 @@ func TestApex(t *testing.T) {
|
|||
if resp == nil {
|
||||
t.Fatalf("Test %d, got nil message and no error for %q", i, r.Question[0].Name)
|
||||
}
|
||||
if !resp.Authoritative {
|
||||
t.Error("Expected authoritative answer")
|
||||
}
|
||||
if err := test.SortAndCheck(resp, tc); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ func (e *External) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Ms
|
|||
|
||||
m := new(dns.Msg)
|
||||
m.SetReply(state.Req)
|
||||
m.Authoritative = true
|
||||
|
||||
if len(svc) == 0 {
|
||||
m.Rcode = rcode
|
||||
|
|
|
@ -45,6 +45,9 @@ func TestExternal(t *testing.T) {
|
|||
if resp == nil {
|
||||
t.Fatalf("Test %d, got nil message and no error for %q", i, r.Question[0].Name)
|
||||
}
|
||||
if !resp.Authoritative {
|
||||
t.Error("Expected authoritative answer")
|
||||
}
|
||||
if err = test.SortAndCheck(resp, tc); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue