lpm: fix overflow issue
LPM table overflow may occur if table is full and added rule has the biggest depth that already have some rules. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
dc783e74cf
commit
e128e53879
@ -298,6 +298,9 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,
|
|||||||
return rule_index;
|
return rule_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rule_index == lpm->max_rules)
|
||||||
|
return -ENOSPC;
|
||||||
} else {
|
} else {
|
||||||
/* Calculate the position in which the rule will be stored. */
|
/* Calculate the position in which the rule will be stored. */
|
||||||
rule_index = 0;
|
rule_index = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user