Skip to content

Commit

Permalink
go.mod, vendor: use github.com/cilium/dns fork directly
Browse files Browse the repository at this point in the history
We have been maintaining and using that fork for a long time and it
looks like the custom changes won't make it upstream any time soon.

There are no other vendored dependencies using miekg/dns, so switching
to the cilium/dns fork shouldn't have any side effects. The fork's
module name was changed to match its import path in
cilium/dns#4.

Let's replace the github.com/miekg/dns import path by
github.com/cilium/dns to get rid of another replace directive in go.mod
and thus make life a tiny bit easier for downstream packages importing
github.com/cilium/cilium.

Signed-off-by: Tobias Klauser <[email protected]>
  • Loading branch information
tklauser committed Aug 26, 2023
1 parent 8365bb0 commit 95e25bf
Show file tree
Hide file tree
Showing 69 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion daemon/cmd/fqdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"sync"
"time"

"github.com/cilium/dns"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/miekg/dns"
"github.com/sirupsen/logrus"

"github.com/cilium/cilium/api/v1/models"
Expand Down
22 changes: 11 additions & 11 deletions daemon/cmd/fqdn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"time"

. "github.com/cilium/checkmate"
miekgdns "github.com/miekg/dns"
ciliumdns "github.com/cilium/dns"

"github.com/cilium/cilium/pkg/allocator"
"github.com/cilium/cilium/pkg/checker"
Expand Down Expand Up @@ -234,28 +234,28 @@ func (ds *DaemonFQDNSuite) Benchmark_notifyOnDNSMsg(c *C) {
// parameter is only used in logging. Not using the endpoint's IP
// so we don't spend any time in the benchmark on converting from
// net.IP to string.
c.Assert(ds.d.notifyOnDNSMsg(time.Now(), ep, "10.96.64.8:12345", 0, "10.96.64.1:53", &miekgdns.Msg{
MsgHdr: miekgdns.MsgHdr{
c.Assert(ds.d.notifyOnDNSMsg(time.Now(), ep, "10.96.64.8:12345", 0, "10.96.64.1:53", &ciliumdns.Msg{
MsgHdr: ciliumdns.MsgHdr{
Response: true,
},
Question: []miekgdns.Question{{
Question: []ciliumdns.Question{{
Name: dns.FQDN("cilium.io"),
}},
Answer: []miekgdns.RR{&miekgdns.A{
Hdr: miekgdns.RR_Header{Name: dns.FQDN("cilium.io")},
Answer: []ciliumdns.RR{&ciliumdns.A{
Hdr: ciliumdns.RR_Header{Name: dns.FQDN("cilium.io")},
A: ciliumDNSRecord[dns.FQDN("cilium.io")].IPs[0],
}}}, "udp", true, &dnsproxy.ProxyRequestContext{}), IsNil)

c.Assert(ds.d.notifyOnDNSMsg(time.Now(), ep, "10.96.64.4:54321", 0, "10.96.64.1:53", &miekgdns.Msg{
MsgHdr: miekgdns.MsgHdr{
c.Assert(ds.d.notifyOnDNSMsg(time.Now(), ep, "10.96.64.4:54321", 0, "10.96.64.1:53", &ciliumdns.Msg{
MsgHdr: ciliumdns.MsgHdr{
Response: true,
},
Compress: false,
Question: []miekgdns.Question{{
Question: []ciliumdns.Question{{
Name: dns.FQDN("ebpf.io"),
}},
Answer: []miekgdns.RR{&miekgdns.A{
Hdr: miekgdns.RR_Header{Name: dns.FQDN("ebpf.io")},
Answer: []ciliumdns.RR{&ciliumdns.A{
Hdr: ciliumdns.RR_Header{Name: dns.FQDN("ebpf.io")},
A: ebpfDNSRecord[dns.FQDN("ebpf.io")].IPs[0],
}}}, "udp", true, &dnsproxy.ProxyRequestContext{}), IsNil)
}(endpoints[i%len(endpoints)])
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/cilium/checkmate v1.0.3
github.com/cilium/coverbee v0.3.2
github.com/cilium/deepequal-gen v0.0.0-20230330134849-754271daeec2
github.com/cilium/dns v1.1.51-0.20230303133941-d3bcb3008ed2
github.com/cilium/ebpf v0.11.0
github.com/cilium/fake v0.5.0
github.com/cilium/linters v0.0.0-20230822071834-30df268c15f9
Expand Down Expand Up @@ -59,7 +60,6 @@ require (
github.com/mattn/go-shellwords v1.0.12
github.com/mdlayher/arp v0.0.0-20220221190821-c37aaafac7f9
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118
github.com/miekg/dns v1.1.43
github.com/mitchellh/mapstructure v1.5.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.7
Expand Down Expand Up @@ -256,8 +256,6 @@ require (
)

replace (
github.com/miekg/dns => github.com/cilium/dns v1.1.51-0.20220729113855-5b94b11b46fc

go.universe.tf/metallb => github.com/cilium/metallb v0.1.1-0.20220829170633-5d7dfb1129f7

// Using private fork of controller-tools. See commit msg for more context
Expand Down
26 changes: 18 additions & 8 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/fqdn/dnsproxy/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"net"

"github.com/miekg/dns"
"github.com/cilium/dns"
)

// lookupTargetDNSServer finds the intended DNS target server for a specific
Expand Down
6 changes: 3 additions & 3 deletions pkg/fqdn/dnsproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"syscall"
"time"

"github.com/miekg/dns"
"github.com/cilium/dns"
"github.com/sirupsen/logrus"
"golang.org/x/sync/semaphore"
"golang.org/x/sys/unix"
Expand Down Expand Up @@ -87,7 +87,7 @@ type DNSProxy struct {
// design now.
NotifyOnDNSMsg NotifyOnDNSMsgFunc

// DNSServers are the miekg/dns server instances.
// DNSServers are the cilium/dns server instances.
// Depending on the configuration, these might be
// TCPv4, UDPv4, TCPv6 and/or UDPv4.
// They handle DNS parsing etc. for us.
Expand Down Expand Up @@ -1157,7 +1157,7 @@ func evaluateAddress(address string, port uint16, bindPort uint16, ipFamily ipFa
// for a given request.
// Originally, DNS was limited to 512 byte responses. EDNS0 allows for larger
// sizes. In either case, responses can apply DNS compression, and the original
// RFCs require clients to accept this. In miekg/dns there is a comment that BIND
// RFCs require clients to accept this. In cilium/dns there is a comment that BIND
// does not support compression, so we retain the ability to suppress this.
func shouldCompressResponse(request, response *dns.Msg) bool {
ednsOptions := request.IsEdns0()
Expand Down
2 changes: 1 addition & 1 deletion pkg/fqdn/dnsproxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

. "github.com/cilium/checkmate"
"github.com/miekg/dns"
"github.com/cilium/dns"
"golang.org/x/exp/maps"
"sigs.k8s.io/yaml"

Expand Down
2 changes: 1 addition & 1 deletion pkg/fqdn/dnsproxy/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"syscall"
"unsafe"

"github.com/miekg/dns"
"github.com/cilium/dns"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitor/logrecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"strings"

"github.com/miekg/dns"
"github.com/cilium/dns"

"github.com/cilium/cilium/pkg/proxy/accesslog"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/accesslog/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,17 @@ type LogRecordDNS struct {

// RCode is the response code
// defined as per https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6
// Use github.com/miekg/dns.RcodeToString map to retrieve string representation
// Use github.com/cilium/dns.RcodeToString map to retrieve string representation
RCode int `json:"RCode,omitempty"`

// QTypes are question types in DNS message
// https://www.ietf.org/rfc/rfc1035.txt
// Use github.com/miekg/dns.TypeToString map to retrieve string representation
// Use github.com/cilium/dns.TypeToString map to retrieve string representation
QTypes []uint16 `json:"QTypes,omitempty"`

// AnswerTypes are record types in the answer section
// https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
// Use github.com/miekg/dns.TypeToString map to retrieve string representation
// Use github.com/cilium/dns.TypeToString map to retrieve string representation
AnswerTypes []uint16 `json:"AnswerTypes,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"sync"
"testing"

"github.com/cilium/dns"

"github.com/cilium/cilium/pkg/hive"
"github.com/cilium/cilium/pkg/hive/cell"
"github.com/cilium/cilium/pkg/maps/eventsmap"
Expand All @@ -22,8 +24,6 @@ import (
"github.com/cilium/cilium/pkg/node"
"github.com/cilium/cilium/pkg/proxy/accesslog"
"github.com/cilium/cilium/pkg/u8proto"

"github.com/miekg/dns"
)

// mockLogRecord is a log entry similar to the one used in fqdn.go for
Expand Down
Loading

0 comments on commit 95e25bf

Please sign in to comment.