diff options
| author | Mark Stapp <mjs@voltanet.io> | 2018-07-10 16:02:03 -0400 |
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2018-07-11 09:22:49 -0400 |
| commit | 86391e565937db3c4d08436ffa0edaa02ace50eb (patch) | |
| tree | df5f0971da7b96ccf3d003b63cf8c23968f307e7 /lib/srcdest_table.c | |
| parent | 01d38683b9632c24111ec266ec0299f77829f0d3 (diff) | |
zebra, libs: use const prefix ptrs in apis
Add 'const' to prefix args to several zebra route update,
redistribution, and route owner notification apis.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib/srcdest_table.c')
| -rw-r--r-- | lib/srcdest_table.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/srcdest_table.c b/lib/srcdest_table.c index a70574cff2..32f8e8ca5b 100644 --- a/lib/srcdest_table.c +++ b/lib/srcdest_table.c @@ -127,7 +127,7 @@ route_table_delegate_t _srcdest_srcnode_delegate = { /* NB: read comments in code for refcounting before using! */ static struct route_node *srcdest_srcnode_get(struct route_node *rn, - struct prefix_ipv6 *src_p) + const struct prefix_ipv6 *src_p) { struct srcdest_rnode *srn; @@ -158,11 +158,12 @@ static struct route_node *srcdest_srcnode_get(struct route_node *rn, route_unlock_node(rn); } - return route_node_get(srn->src_table, (struct prefix *)src_p); + return route_node_get(srn->src_table, (const struct prefix *)src_p); } -static struct route_node *srcdest_srcnode_lookup(struct route_node *rn, - struct prefix_ipv6 *src_p) +static struct route_node *srcdest_srcnode_lookup( + struct route_node *rn, + const struct prefix_ipv6 *src_p) { struct srcdest_rnode *srn; @@ -180,7 +181,7 @@ static struct route_node *srcdest_srcnode_lookup(struct route_node *rn, if (!srn->src_table) return NULL; - return route_node_lookup(srn->src_table, (struct prefix *)src_p); + return route_node_lookup(srn->src_table, (const struct prefix *)src_p); } /* ----- exported functions ----- */ @@ -233,25 +234,25 @@ struct route_node *srcdest_route_next(struct route_node *rn) } struct route_node *srcdest_rnode_get(struct route_table *table, - union prefixptr dst_pu, - struct prefix_ipv6 *src_p) + union prefixconstptr dst_pu, + const struct prefix_ipv6 *src_p) { - struct prefix_ipv6 *dst_p = dst_pu.p6; + const struct prefix_ipv6 *dst_p = dst_pu.p6; struct route_node *rn; - rn = route_node_get(table, (struct prefix *)dst_p); + rn = route_node_get(table, (const struct prefix *)dst_p); return srcdest_srcnode_get(rn, src_p); } struct route_node *srcdest_rnode_lookup(struct route_table *table, - union prefixptr dst_pu, - struct prefix_ipv6 *src_p) + union prefixconstptr dst_pu, + const struct prefix_ipv6 *src_p) { - struct prefix_ipv6 *dst_p = dst_pu.p6; + const struct prefix_ipv6 *dst_p = dst_pu.p6; struct route_node *rn; struct route_node *srn; - rn = route_node_lookup_maynull(table, (struct prefix *)dst_p); + rn = route_node_lookup_maynull(table, (const struct prefix *)dst_p); srn = srcdest_srcnode_lookup(rn, src_p); if (rn != NULL && rn == srn && !rn->info) { @@ -263,8 +264,8 @@ struct route_node *srcdest_rnode_lookup(struct route_table *table, return srn; } -void srcdest_rnode_prefixes(struct route_node *rn, struct prefix **p, - struct prefix **src_p) +void srcdest_rnode_prefixes(struct route_node *rn, const struct prefix **p, + const struct prefix **src_p) { if (rnode_is_srcnode(rn)) { struct route_node *dst_rn = rn->table->info; @@ -282,7 +283,7 @@ void srcdest_rnode_prefixes(struct route_node *rn, struct prefix **p, const char *srcdest_rnode2str(struct route_node *rn, char *str, int size) { - struct prefix *dst_p, *src_p; + const struct prefix *dst_p, *src_p; char dst_buf[PREFIX_STRLEN], src_buf[PREFIX_STRLEN]; srcdest_rnode_prefixes(rn, &dst_p, &src_p); |
