func GetMapNameFromBPFPinPath()

in pkg/elfparser/elf.go [690:706]


func GetMapNameFromBPFPinPath(pinPath string) (string, string) {

	splittedPinPath := strings.Split(pinPath, "/")
	lastSegment := splittedPinPath[len(splittedPinPath)-1]
	// Split at the first occurrence of "_"
	mapNamespace, mapName, _ := strings.Cut(lastSegment, "_")
	log.Infof("Found Identified - %s : %s", mapNamespace, mapName)

	if mapName == "ingress_map" || mapName == "egress_map" || mapName == "ingress_pod_state_map" || mapName == "egress_pod_state_map" {
		log.Infof("Adding %s -> %s", mapName, mapNamespace)
		return mapName, mapNamespace
	}

	//This is global map, we cannot use global since there are multiple maps
	log.Infof("Adding GLOBAL %s -> %s", mapName, mapName)
	return mapName, mapName
}