Skip to content

Commit

Permalink
fqdn: Fix Upgrade Issue Between PortProto Versions
Browse files Browse the repository at this point in the history
Users of this library need Cilium to both check
restore and updated DNS rules for the new PortProto
version. Otherwise upgrade incompatibilities exist
between Cilium and programs that utilize this library.

Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
  • Loading branch information
nathanjsweet committed May 3, 2024
1 parent 01c3b83 commit a682a62
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/fqdn/dnsproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func (p *DNSProxy) checkRestored(endpointID uint64, destPortProto restore.PortPr
if !exists && destPortProto.IsPortV2() {
// Check if there is a Version 1 restore.
ipRules, exists = p.restored[endpointID][destPortProto.ToV1()]
log.WithFields(logrus.Fields{
logfields.EndpointID: endpointID,
logfields.Port: destPortProto.Port(),
logfields.Protocol: destPortProto.Protocol(),
}).Debugf("Checking if restored V1 IP rules (exists: %t) for endpoint: %+v", exists, ipRules)
if !exists {
return false
}
Expand Down Expand Up @@ -514,6 +519,14 @@ func (allow perEPAllow) setPortRulesForIDFromUnifiedFormat(cache regexCache, end
// passed-in endpointID and destPort with setPortRulesForID
func (allow perEPAllow) getPortRulesForID(endpointID uint64, destPortProto restore.PortProto) (rules CachedSelectorREEntry, exists bool) {
rules, exists = allow[endpointID][destPortProto]
if !exists && destPortProto.Protocol() != 0 {
rules, exists = allow[endpointID][destPortProto.ToV1()]
log.WithFields(logrus.Fields{
logfields.EndpointID: endpointID,
logfields.Port: destPortProto.Port(),
logfields.Protocol: destPortProto.Protocol(),
}).Debugf("Checking for V1 port rule (exists: %t) for endpoint: %+v", exists, rules)
}
return
}

Expand Down

0 comments on commit a682a62

Please sign in to comment.