func dumpCtProto(file string, ctType ctmap.CtType) { fd, err := bpf.ObjGet(file) if err != nil { fmt.Fprintf(os.Stderr, "Unable to open %s: %s\n", file, err) os.Exit(1) } m := ctmap.CtMap{Fd: fd, Type: ctType} out, err := m.Dump() if err != nil { fmt.Fprintf(os.Stderr, "Error while dumping BPF Map: %s\n", err) os.Exit(1) } fmt.Println(out) }
func runGC(e *endpoint.Endpoint, prefix string, ctType ctmap.CtType) { file := prefix + strconv.Itoa(int(e.ID)) fd, err := bpf.ObjGet(file) if err != nil { log.Warningf("Unable to open CT map %s: %s\n", file, err) e.LogStatus(endpoint.Warning, fmt.Sprintf("Unable to open CT map %s: %s", file, err)) return } f := os.NewFile(uintptr(fd), file) m := ctmap.CtMap{Fd: fd, Type: ctType} deleted := m.GC(uint16(GcInterval)) if deleted > 0 { log.Debugf("Deleted %d entries from map %s", deleted, file) } f.Close() }