mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-20 00:10:59 +02:00
Fix issue with too large DNS messages
This is an import of the fix for issue 10135 in the rancher fork of this project ( rancher/rancher#10135 ).
This commit is contained in:
parent
4a45706209
commit
785adeb6c1
@ -33,6 +33,11 @@ import (
|
||||
"sigs.k8s.io/external-dns/provider"
|
||||
)
|
||||
|
||||
const (
|
||||
// maximum size of a UDP transport message in DNS protocol
|
||||
udpMaxMsgSize = 512
|
||||
)
|
||||
|
||||
// rfc2136 provider type
|
||||
type rfc2136Provider struct {
|
||||
nameserver string
|
||||
@ -309,6 +314,10 @@ func (r rfc2136Provider) SendMessage(msg *dns.Msg) error {
|
||||
msg.SetTsig(r.tsigKeyName, r.tsigSecretAlg, 300, time.Now().Unix())
|
||||
}
|
||||
|
||||
if msg.Len() > udpMaxMsgSize {
|
||||
c.Net = "tcp"
|
||||
}
|
||||
|
||||
resp, _, err := c.Exchange(msg, r.nameserver)
|
||||
if err != nil {
|
||||
log.Infof("error in dns.Client.Exchange: %s", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user