"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "go/pkg/pass1/check-identical-services.go" between
Netspoc-6.026.tar.gz and Netspoc-6.027.tar.gz

About: NetSPoC is a network security policy compiler (using its own description language) to manage all the packet filter devices inside your network topology.

check-identical-services.go  (Netspoc-6.026):check-identical-services.go  (Netspoc-6.027)
package pass1 package pass1
import ( import (
"github.com/hknutzen/Netspoc/go/pkg/ast" "github.com/hknutzen/Netspoc/go/pkg/ast"
"github.com/hknutzen/Netspoc/go/pkg/conf" "github.com/hknutzen/Netspoc/go/pkg/conf"
"net"
"sort" "sort"
) )
func (c *spoc) checkIdenticalServices(sRules *serviceRules) { func (c *spoc) checkIdenticalServices(sRules *serviceRules) {
printType := conf.Conf.CheckIdenticalServices printType := conf.Conf.CheckIdenticalServices
if printType == "" { if printType == "" {
return return
} }
c.progress("Checking for services with identical body") c.progress("Checking for services with identical body")
skipping to change at line 299 skipping to change at line 298
case *ast.IntfRef: case *ast.IntfRef:
b, ok := e2.(*ast.IntfRef) b, ok := e2.(*ast.IntfRef)
return ok && a.Type == b.Type && return ok && a.Type == b.Type &&
a.Router == b.Router && a.Network == b.Network && a.Router == b.Router && a.Network == b.Network &&
a.Extension == b.Extension a.Extension == b.Extension
case *ast.SimpleAuto: case *ast.SimpleAuto:
b, ok := e2.(*ast.SimpleAuto) b, ok := e2.(*ast.SimpleAuto)
return ok && a.Type == b.Type && elementsEq(a.Elements, b.Element s) return ok && a.Type == b.Type && elementsEq(a.Elements, b.Element s)
case *ast.AggAuto: case *ast.AggAuto:
b, ok := e2.(*ast.AggAuto) b, ok := e2.(*ast.AggAuto)
return ok && netEq(a.Net, b.Net) && elementsEq(a.Elements, b.Elem ents) return ok && a.Net == b.Net && elementsEq(a.Elements, b.Elements)
case *ast.IntfAuto: case *ast.IntfAuto:
b, ok := e2.(*ast.IntfAuto) b, ok := e2.(*ast.IntfAuto)
return ok && a.Managed == b.Managed && a.Selector == b.Selector & & return ok && a.Managed == b.Managed && a.Selector == b.Selector & &
elementsEq(a.Elements, b.Elements) elementsEq(a.Elements, b.Elements)
case *ast.Complement: case *ast.Complement:
b, ok := e2.(*ast.Complement) b, ok := e2.(*ast.Complement)
return ok && elemEq(a.Element, b.Element) return ok && elemEq(a.Element, b.Element)
case *ast.Intersection: case *ast.Intersection:
b, ok := e2.(*ast.Intersection) b, ok := e2.(*ast.Intersection)
return ok && elementsEq(a.Elements, b.Elements) return ok && elementsEq(a.Elements, b.Elements)
} }
return false return false
} }
func netEq(a, b *net.IPNet) bool {
if a == nil {
return a == b
}
return a.String() == b.String()
}
 End of changes. 3 change blocks. 
2 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)