summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVincent Bernat <vincent@bernat.im>2016-07-11 17:51:55 +0200
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-19 20:05:20 +0900
commitf1baa204dc0f7edabb8e23330271e6fdc26df7e2 (patch)
tree7c74c51512c8b32f34024964db3416812a2bc8cc
parented62f3f3d91e378c53d4f6faea4fad4280c3079e (diff)
mrt: skip MRT errors instead of just dying
When trying to inject a full view from the router views project, it seems that some entries have an unexpected flag (transitive flag missing). Just skip those entries instead of dying.
-rw-r--r--gobgp/cmd/common.go6
-rw-r--r--gobgp/cmd/mrt.go3
2 files changed, 7 insertions, 2 deletions
diff --git a/gobgp/cmd/common.go b/gobgp/cmd/common.go
index 5aaadaf8..9a4b8164 100644
--- a/gobgp/cmd/common.go
+++ b/gobgp/cmd/common.go
@@ -477,7 +477,7 @@ func checkAddressFamily(def bgp.RouteFamily) (bgp.RouteFamily, error) {
return rf, e
}
-func exitWithError(err error) {
+func printError(err error) {
if globalOpts.Json {
j, _ := json.Marshal(struct {
Error string `json:"error"`
@@ -486,5 +486,9 @@ func exitWithError(err error) {
} else {
fmt.Println(err)
}
+}
+
+func exitWithError(err error) {
+ printError(err)
os.Exit(1)
}
diff --git a/gobgp/cmd/mrt.go b/gobgp/cmd/mrt.go
index c3ecf0ed..f9287f77 100644
--- a/gobgp/cmd/mrt.go
+++ b/gobgp/cmd/mrt.go
@@ -73,7 +73,8 @@ func injectMrt(r string, filename string, count int, skip int) error {
msg, err := mrt.ParseMRTBody(h, buf)
if err != nil {
- exitWithError(fmt.Errorf("failed to parse: %s", err))
+ printError(fmt.Errorf("failed to parse: %s", err))
+ continue
}
if globalOpts.Debug {