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

[12.0 stable candidate] Properly mark DHCP & DNS traffic entering switch NI from outside #3890

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions pkg/pillar/nireconciler/linux_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ const (
// Describes protocol that is allowed implicitly because it provides some essential
// function for applications.
type essentialProto struct {
label string
ingressMatch []string
egressMatch []string
mark uint32
markChainName string
canOrigOutside bool // true if communication can be initiated from outside the edge node
label string
ingressMatch []string
egressMatch []string
mark uint32
markChainName string
}

// User-configured ACL rule.
Expand Down Expand Up @@ -163,21 +162,18 @@ func getEssentialIPv6Protos(niType types.NetworkInstanceType,
switch niType {
case types.NetworkInstanceTypeSwitch:
protos = append(protos, essentialProto{
label: "ICMPv6",
egressMatch: []string{"-p", "ipv6-icmp"},
ingressMatch: []string{"-p", "ipv6-icmp"},
mark: iptables.ControlProtocolMarkingIDMap["app_icmpv6"],
markChainName: "icmpv6",
canOrigOutside: true,
label: "ICMPv6",
egressMatch: []string{"-p", "ipv6-icmp"},
ingressMatch: []string{"-p", "ipv6-icmp"},
mark: iptables.ControlProtocolMarkingIDMap["app_icmpv6"],
markChainName: "icmpv6",
})
protos = append(protos, essentialProto{
label: "DHCPv6",
egressMatch: []string{"-p", "udp", "--dport", "dhcpv6-server"},
ingressMatch: []string{"-p", "udp", "--sport", "dhcpv6-server"},
mark: iptables.ControlProtocolMarkingIDMap["app_dhcp"],
markChainName: "dhcpv6",
// RFC 6644 (DHCPv6 Reconfigure) allows the server to initiate communication.
canOrigOutside: true,
})
protos = append(protos, essentialProto{
label: "DNS over UDP",
Expand Down Expand Up @@ -960,7 +956,7 @@ func (r *LinuxNIReconciler) getIntendedAppConnMangleIptables(vif vifInfo,
}
// 1.1. Mark essential protocols allowed implicitly.
for _, proto := range essentialProtos {
if proto.ingressMatch == nil || !proto.canOrigOutside {
if proto.ingressMatch == nil {
continue
}
markChain := markChainPrefix + proto.markChainName
Expand Down
Loading