Treat conntrack SOURCE all/any as global like an omitted source
This commit is contained in:
@@ -228,6 +228,9 @@ func (c *Compiler) compileConntrack(state *FirewallState) error {
|
||||
}
|
||||
|
||||
for _, src := range srcs {
|
||||
if src.Zone == "all" || src.Zone == "any" {
|
||||
src.Zone = ""
|
||||
}
|
||||
chains := []string{"raw_prerouting"}
|
||||
switch {
|
||||
case ct.Chain == config.ConntrackOutput && src.Zone != fwZone && src.Zone != "":
|
||||
|
||||
@@ -2476,6 +2476,26 @@ func TestCompile_ConntrackZones(t *testing.T) {
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackBoth},
|
||||
want: map[string][]string{"raw_prerouting": {""}, "raw_output": {""}},
|
||||
},
|
||||
{
|
||||
name: "all source with chain both is global in both chains",
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Source: "all", Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackBoth},
|
||||
want: map[string][]string{"raw_prerouting": {""}, "raw_output": {""}},
|
||||
},
|
||||
{
|
||||
name: "all source with chain output is global in raw_output",
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Source: "all", Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackOutput},
|
||||
want: map[string][]string{"raw_output": {""}},
|
||||
},
|
||||
{
|
||||
name: "any source with chain both is global in both chains",
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Source: "any", Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackBoth},
|
||||
want: map[string][]string{"raw_prerouting": {""}, "raw_output": {""}},
|
||||
},
|
||||
{
|
||||
name: "any source with chain output is global in raw_output",
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Source: "any", Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackOutput},
|
||||
want: map[string][]string{"raw_output": {""}},
|
||||
},
|
||||
{
|
||||
name: "chain both with non-fw source emits prerouting only",
|
||||
ct: config.ConntrackRule{Action: config.ConntrackNoTrack, Source: "net", Dest: "fw", Proto: "udp", DPort: config.PortSpec{"53"}, Chain: config.ConntrackBoth},
|
||||
|
||||
Reference in New Issue
Block a user