forked from github/multus-cni
Add logging feature for debug
This diff adds logging feature for debug.
This commit is contained in:
12
vendor/github.com/vishvananda/netlink/conntrack_linux.go
generated
vendored
12
vendor/github.com/vishvananda/netlink/conntrack_linux.go
generated
vendored
@@ -56,7 +56,7 @@ func ConntrackTableFlush(table ConntrackTableType) error {
|
||||
|
||||
// ConntrackDeleteFilter deletes entries on the specified table on the base of the filter
|
||||
// conntrack -D [table] parameters Delete conntrack or expectation
|
||||
func ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error) {
|
||||
func ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter CustomConntrackFilter) (uint, error) {
|
||||
return pkgHandle.ConntrackDeleteFilter(table, family, filter)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func (h *Handle) ConntrackTableFlush(table ConntrackTableType) error {
|
||||
|
||||
// ConntrackDeleteFilter deletes entries on the specified table on the base of the filter using the netlink handle passed
|
||||
// conntrack -D [table] parameters Delete conntrack or expectation
|
||||
func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error) {
|
||||
func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter CustomConntrackFilter) (uint, error) {
|
||||
res, err := h.dumpConntrackTable(table, family)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -290,6 +290,12 @@ const (
|
||||
ConntrackNatAnyIP // -any-nat ip Source or destination NAT ip
|
||||
)
|
||||
|
||||
type CustomConntrackFilter interface {
|
||||
// MatchConntrackFlow applies the filter to the flow and returns true if the flow matches
|
||||
// the filter or false otherwise
|
||||
MatchConntrackFlow(flow *ConntrackFlow) bool
|
||||
}
|
||||
|
||||
type ConntrackFilter struct {
|
||||
ipFilter map[ConntrackFilterType]net.IP
|
||||
}
|
||||
@@ -342,3 +348,5 @@ func (f *ConntrackFilter) MatchConntrackFlow(flow *ConntrackFlow) bool {
|
||||
|
||||
return match
|
||||
}
|
||||
|
||||
var _ CustomConntrackFilter = (*ConntrackFilter)(nil)
|
||||
|
6
vendor/github.com/vishvananda/netns/netns_linux.go
generated
vendored
6
vendor/github.com/vishvananda/netns/netns_linux.go
generated
vendored
@@ -138,9 +138,7 @@ func getThisCgroup(cgroupType string) (string, error) {
|
||||
return "", fmt.Errorf("docker pid not found in /var/run/docker.pid")
|
||||
}
|
||||
pid, err := strconv.Atoi(result[0])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
output, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -188,8 +186,6 @@ func getPidForContainer(id string) (int, error) {
|
||||
filepath.Join(cgroupRoot, "system.slice", "docker-"+id+".scope", "tasks"),
|
||||
// Even more recent docker versions under cgroup/systemd/docker/<id>/
|
||||
filepath.Join(cgroupRoot, "..", "systemd", "docker", id, "tasks"),
|
||||
// Kubernetes with docker and CNI is even more different
|
||||
filepath.Join(cgroupRoot, "..", "systemd", "kubepods", "*", "pod*", id, "tasks"),
|
||||
}
|
||||
|
||||
var filename string
|
||||
|
Reference in New Issue
Block a user