@@ -41,11 +41,6 @@ func (c *IptablesCheck) Run(ctx context.Context, target string) (*types.TestResu
4141 details .LegacyRuleCount , details .NftableRuleCount ))
4242 }
4343
44- backend , err := c .detectActiveBackend (ctx )
45- if err == nil && backend != "" {
46- issues = append (issues , fmt .Sprintf ("detected active backend: %s" , backend ))
47- }
48-
4944 if len (issues ) > 0 && details .DuplicateRules > 0 {
5045 result .Status = types .StatusFail
5146 result .Error = "iptables configuration conflict detected"
@@ -80,24 +75,11 @@ func (c *IptablesCheck) countIptablesRules(ctx context.Context, binary string) (
8075 return count , nil
8176}
8277
83- func (c * IptablesCheck ) detectActiveBackend (ctx context.Context ) (string , error ) {
84- cmd := exec .CommandContext (ctx , "iptables" , "--version" )
85- output , err := cmd .CombinedOutput ()
86- if err != nil {
87- return "" , err
88- }
89-
90- versionStr := strings .ToLower (string (output ))
91- if strings .Contains (versionStr , "nf_tables" ) {
92- return "nftables" , nil
93- } else if strings .Contains (versionStr , "legacy" ) {
94- return "legacy" , nil
95- }
96-
97- return "unknown" , nil
78+ func (c * IptablesCheck ) IsLocal () bool {
79+ return true
9880}
9981
100- func (c * IptablesCheck ) IsLocal () bool {
82+ func (c * IptablesCheck ) HostNetworkOnly () bool {
10183 return true
10284}
10385
@@ -125,18 +107,17 @@ func (c *IptablesCheck) FormatSummary(details interface{}, debug bool) string {
125107 return ""
126108 }
127109
128- // Get issues if present
129- issuesRaw , hasIssues := iptablesMap ["issues" ]
130- if hasIssues {
131- if issues , ok := issuesRaw .([]interface {}); ok && len (issues ) > 0 {
132- return fmt .Sprintf ("%d issues" , len (issues ))
133- }
134- }
135-
136110 legacyCount , _ := iptablesMap ["legacy_rule_count" ].(float64 )
137111 nftCount , _ := iptablesMap ["nftable_rule_count" ].(float64 )
138112
139113 summary := fmt .Sprintf ("%.0f legacy, %.0f nftables rules" , legacyCount , nftCount )
114+
115+ if issuesRaw , ok := iptablesMap ["issues" ]; ok {
116+ if issues , ok := issuesRaw .([]interface {}); ok && len (issues ) > 0 {
117+ summary += fmt .Sprintf (" | %d issues" , len (issues ))
118+ }
119+ }
120+
140121 if debug {
141122 return summary
142123 }
0 commit comments