lpm6: make IPv6 address immutable
Both the table setup and lookup do no modify their arguments. Therefore the parameter should be constant. This is not actually an API breakage since programs can be recompiled without change. This is not an ABI breakage because old programs will still run. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
103809d032
commit
d82927d2f8
@ -853,8 +853,8 @@ simulate_add(struct rte_lpm6 *lpm, const uint8_t *masked_ip, uint8_t depth)
|
||||
* Add a route
|
||||
*/
|
||||
int
|
||||
rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
|
||||
uint32_t next_hop)
|
||||
rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth,
|
||||
uint32_t next_hop)
|
||||
{
|
||||
struct rte_lpm6_tbl_entry *tbl;
|
||||
struct rte_lpm6_tbl_entry *tbl_next = NULL;
|
||||
@ -912,7 +912,7 @@ rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
|
||||
*/
|
||||
static inline int
|
||||
lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
|
||||
const struct rte_lpm6_tbl_entry **tbl_next, uint8_t *ip,
|
||||
const struct rte_lpm6_tbl_entry **tbl_next, const uint8_t *ip,
|
||||
uint8_t first_byte, uint32_t *next_hop)
|
||||
{
|
||||
uint32_t tbl8_index, tbl_entry;
|
||||
@ -942,7 +942,7 @@ lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl,
|
||||
* Looks up an IP
|
||||
*/
|
||||
int
|
||||
rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip,
|
||||
rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip,
|
||||
uint32_t *next_hop)
|
||||
{
|
||||
const struct rte_lpm6_tbl_entry *tbl;
|
||||
|
@ -94,8 +94,8 @@ rte_lpm6_free(struct rte_lpm6 *lpm);
|
||||
* 0 on success, negative value otherwise
|
||||
*/
|
||||
int
|
||||
rte_lpm6_add(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth,
|
||||
uint32_t next_hop);
|
||||
rte_lpm6_add(struct rte_lpm6 *lpm, const uint8_t *ip, uint8_t depth,
|
||||
uint32_t next_hop);
|
||||
|
||||
/**
|
||||
* Check if a rule is present in the LPM table,
|
||||
@ -171,7 +171,7 @@ rte_lpm6_delete_all(struct rte_lpm6 *lpm);
|
||||
* -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
|
||||
*/
|
||||
int
|
||||
rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, uint32_t *next_hop);
|
||||
rte_lpm6_lookup(const struct rte_lpm6 *lpm, const uint8_t *ip, uint32_t *next_hop);
|
||||
|
||||
/**
|
||||
* Lookup multiple IP addresses in an LPM table.
|
||||
|
Loading…
x
Reference in New Issue
Block a user