You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/10/28 18:07:57 UTC

[plc4x] 03/05: fix(plc4xpcapanalyzer): guard against unknown protocols

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 3c11cbd7360d8c95dc640fc5d6483a83dfa17190
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Oct 28 18:13:18 2022 +0200

    fix(plc4xpcapanalyzer): guard against unknown protocols
---
 plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
index b814b5691..016e6f6d0 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
@@ -70,7 +70,7 @@ func AnalyzeWithOutputAndCallback(pcapFile, protocolType string, stdout, stderr
 	}
 	var byteOutput = hex.Dump
 	switch protocolType {
-	case "bacnet":
+	case "bacnetip":
 		packageParse = bacnetanalyzer.PackageParse
 		serializePackage = bacnetanalyzer.SerializePackage
 	case "c-bus":
@@ -84,6 +84,8 @@ func AnalyzeWithOutputAndCallback(pcapFile, protocolType string, stdout, stderr
 		} else {
 			log.Info().Msg("Custom mapping disabled")
 		}
+	default:
+		return errors.Errorf("Unsupported protocol type %s", protocolType)
 	}
 	bar := progressbar.NewOptions(numberOfPackage, progressbar.OptionSetWriter(ansi.NewAnsiStderr()),
 		progressbar.OptionSetVisibility(!config.RootConfigInstance.HideProgressBar),