Skip to content

Commit

Permalink
Split IPv4 and IPv6 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal committed Aug 14, 2024
1 parent efbd29c commit 79d776a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions management/server/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func getDefaultPermit(route *route.Route) []*RouteFirewallRule {
if route.Network.Addr().Is6() {
sources = []string{"::/0"}
}
ruleIn := RouteFirewallRule{
rule := RouteFirewallRule{
SourceRanges: sources,
Direction: firewallRuleDirectionIN,
Action: string(PolicyTrafficActionAccept),
Expand All @@ -466,11 +466,13 @@ func getDefaultPermit(route *route.Route) []*RouteFirewallRule {
IsDynamic: route.IsDynamic(),
}

rules = append(rules, &rule)

// dynamic routes always contain an IPv4 placeholder as destination, hence we must add IPv6 rules additionally
if route.IsDynamic() {
ruleIn.SourceRanges = append(ruleIn.SourceRanges, "::/0")
ruleV6 := rule
ruleV6.SourceRanges = []string{"::/0"}
}
rules = append(rules, &ruleIn)

return rules
}
Expand Down

0 comments on commit 79d776a

Please sign in to comment.