Pārlūkot izejas kodu

Merge pull request #105 from kuroa-me/main

Skip warning about rules in legacy iptables.
Casey Callendrello 1 gadu atpakaļ
vecāks
revīzija
b20e55f906
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      iptables/iptables.go

+ 5 - 0
iptables/iptables.go

@@ -317,6 +317,11 @@ func (ipt *IPTables) Stats(table, chain string) ([][]string, error) {
 
 	ipv6 := ipt.proto == ProtocolIPv6
 
+	// Skip the warning if exist
+	if strings.HasPrefix(lines[0], "#") {
+		lines = lines[1:]
+	}
+
 	rows := [][]string{}
 	for i, line := range lines {
 		// Skip over chain name and field header