[v2,2/3] examples/l3fwd: fix return value on rules add
Checks
Commit Message
fix return value on adding the EM or LPM rules.
Fixes: e7e6dd643092 ("examples/l3fwd: support config file for EM")
Fixes: 52def963fc1c ("examples/l3fwd: support config file for LPM/FIB")
Cc: sean.morrissey@intel.com
Cc: stable@dpdk.org
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
examples/l3fwd/em_route_parse.c | 11 ++++++-----
examples/l3fwd/lpm_route_parse.c | 11 ++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
@@ -119,7 +119,7 @@ em_add_rules(const char *rule_path,
char buff[LINE_MAX];
FILE *fh;
unsigned int i = 0, rule_size = sizeof(*next);
- int val;
+ int val, rc;
*proute_base = NULL;
fh = fopen(rule_path, "rb");
@@ -172,13 +172,14 @@ em_add_rules(const char *rule_path,
return -EINVAL;
}
- if (parser(buff + 1, next) != 0) {
+ rc = parser(buff + 1, next);
+ if (rc != 0) {
RTE_LOG(ERR, L3FWD,
- "%s Line %u: parse rules error\n",
- rule_path, i);
+ "%s Line %u: parse rules error code = %d\n",
+ rule_path, i, rc);
fclose(fh);
free(route_rules);
- return -EINVAL;
+ return rc;
}
route_cnt++;
@@ -184,7 +184,7 @@ lpm_add_rules(const char *rule_path,
char buff[LINE_MAX];
FILE *fh;
unsigned int i = 0, rule_size = sizeof(*next);
- int val;
+ int val, rc;
*proute_base = NULL;
fh = fopen(rule_path, "rb");
@@ -237,13 +237,14 @@ lpm_add_rules(const char *rule_path,
return -EINVAL;
}
- if (parser(buff + 1, next) != 0) {
+ rc = parser(buff + 1, next);
+ if (rc != 0) {
RTE_LOG(ERR, L3FWD,
- "%s Line %u: parse rules error\n",
- rule_path, i);
+ "%s Line %u: parse rules error code = %d\n",
+ rule_path, i, rc);
fclose(fh);
free(route_rules);
- return -EINVAL;
+ return rc;
}
route_cnt++;