Loading go-apps/meep-tm/server/bwm/bwm.go +32 −37 Original line number Diff line number Diff line Loading @@ -1426,29 +1426,27 @@ func validateAppInfo(appInfo map[string]string) (int, string, error) { func checkSrcIP(bw *BwInfo) (err error) { ueNameList := activeModel.GetNodeNames("UE") // if the provided source IP range matches with the existing UE IP(s) if len(ueNameList) > 0 { for _, ip := range bw.SessionFilter { ipFound := true if ip.SourceIp != "" { _, ueNetIP, _ := net.ParseCIDR(ip.SourceIp) if ueNetIP == nil { log.Error("IP not provided in the CIDR notation") err = errors.New("IP not provided in the CIDR notation in the request body") return err } ipName := net.ParseIP(ip.SourceIp) if ipName != nil { for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) || !isInLocality(name) { continue } ipName := net.ParseIP(name) if ueNetIP.Contains(ipName) { if ipName.String() == name { log.Info("Provided source IP range is valid against the existing UE IPs") ipFound = true break } else { ipFound = false } } } // Return error if IP not in ueNameList if !ipFound { Loading @@ -1474,27 +1472,24 @@ func checkDstIP(bw *BwInfo) (err error) { for _, ip := range bw.SessionFilter { ipFound := true if ip.DstAddress != "" { _, ueNetIP, _ := net.ParseCIDR(ip.DstAddress) if ueNetIP == nil { log.Error("IP not provided in the CIDR notation") err = errors.New("IP not provided in the CIDR notation in the request body") return err } ipName := net.ParseIP(ip.DstAddress) if ipName != nil { for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) || !isInLocality(name) { continue } ipName := net.ParseIP(name) if ueNetIP.Contains(ipName) { if ipName.String() == name { log.Info("Provided destination IP range is valid against the existing UE IPs") ipFound = true break } else { ipFound = false } } // Return error if IP not in ueNameList } if !ipFound { log.Error("Provided destination IP range is not valid against the existing UE IPs") err = errors.New("Provided destination IP range is not valid against the existing UE IPs in the request body") Loading Loading
go-apps/meep-tm/server/bwm/bwm.go +32 −37 Original line number Diff line number Diff line Loading @@ -1426,29 +1426,27 @@ func validateAppInfo(appInfo map[string]string) (int, string, error) { func checkSrcIP(bw *BwInfo) (err error) { ueNameList := activeModel.GetNodeNames("UE") // if the provided source IP range matches with the existing UE IP(s) if len(ueNameList) > 0 { for _, ip := range bw.SessionFilter { ipFound := true if ip.SourceIp != "" { _, ueNetIP, _ := net.ParseCIDR(ip.SourceIp) if ueNetIP == nil { log.Error("IP not provided in the CIDR notation") err = errors.New("IP not provided in the CIDR notation in the request body") return err } ipName := net.ParseIP(ip.SourceIp) if ipName != nil { for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) || !isInLocality(name) { continue } ipName := net.ParseIP(name) if ueNetIP.Contains(ipName) { if ipName.String() == name { log.Info("Provided source IP range is valid against the existing UE IPs") ipFound = true break } else { ipFound = false } } } // Return error if IP not in ueNameList if !ipFound { Loading @@ -1474,27 +1472,24 @@ func checkDstIP(bw *BwInfo) (err error) { for _, ip := range bw.SessionFilter { ipFound := true if ip.DstAddress != "" { _, ueNetIP, _ := net.ParseCIDR(ip.DstAddress) if ueNetIP == nil { log.Error("IP not provided in the CIDR notation") err = errors.New("IP not provided in the CIDR notation in the request body") return err } ipName := net.ParseIP(ip.DstAddress) if ipName != nil { for _, name := range ueNameList { // Ignore disconnected UEs if !isUeConnected(name) || !isInLocality(name) { continue } ipName := net.ParseIP(name) if ueNetIP.Contains(ipName) { if ipName.String() == name { log.Info("Provided destination IP range is valid against the existing UE IPs") ipFound = true break } else { ipFound = false } } // Return error if IP not in ueNameList } if !ipFound { log.Error("Provided destination IP range is not valid against the existing UE IPs") err = errors.New("Provided destination IP range is not valid against the existing UE IPs in the request body") Loading