Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.14] Author backport of #28928 (Dns proxy use original source address and port) #29086

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
5 changes: 2 additions & 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.20231108175042-eaf71f6affd2
github.com/cilium/ebpf v0.10.1-0.20230626090016-654491c8a500
github.com/cilium/fake v0.4.0
github.com/cilium/linters v0.0.0-20230711081823-012f25fa2197
Expand Down Expand Up @@ -60,7 +61,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 @@ -206,6 +206,7 @@ require (
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/packet v1.1.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/miekg/dns v1.1.51 // indirect
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
Expand Down Expand Up @@ -257,8 +258,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 fork of client-go.
Expand Down
18 changes: 14 additions & 4 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
2 changes: 1 addition & 1 deletion pkg/fqdn/dnsproxy/noop_sessionudpfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package dnsproxy
import (
"net"

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

type noopSessionUDPFactory struct{}
Expand Down