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.
This commit is contained in:
Vincent Bernat
2016-07-19 20:05:20 +09:00
committed by FUJITA Tomonori
parent ed62f3f3d9
commit f1baa204dc
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -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)
}
+2 -1
View File
@@ -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 {