summaryrefslogtreecommitdiffstats
path: root/lib/table.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-05-22 12:41:01 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-26 17:33:30 +0200
commitd3830f1fa453db6213476acdc77467a737fabb50 (patch)
treef5c2ac6e4e3a42e79654294e922522bf5493d781 /lib/table.c
parentsockunion: add accessors for sockunion address (diff)
downloadfrr-d3830f1fa453db6213476acdc77467a737fabb50.tar.xz
frr-d3830f1fa453db6213476acdc77467a737fabb50.zip
route table: constify some APIs
Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 3293bc280f15d8e3c04e0bf9b0a8d54d342a87a9)
Diffstat (limited to 'lib/table.c')
-rw-r--r--lib/table.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/table.c b/lib/table.c
index bd7023c12..da2136168 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -59,7 +59,7 @@ route_node_new (struct route_table *table)
/* Allocate new route node with prefix set. */
static struct route_node *
-route_node_set (struct route_table *table, struct prefix *prefix)
+route_node_set (struct route_table *table, const struct prefix *prefix)
{
struct route_node *node;
@@ -141,14 +141,14 @@ static const u_char maskbit[] =
/* Common prefix route genaration. */
static void
-route_common (struct prefix *n, struct prefix *p, struct prefix *new)
+route_common (const struct prefix *n, const struct prefix *p, struct prefix *new)
{
int i;
u_char diff;
u_char mask;
- u_char *np = (u_char *)&n->u.prefix;
- u_char *pp = (u_char *)&p->u.prefix;
+ const u_char *np = (const u_char *)&n->u.prefix;
+ const u_char *pp = (const u_char *)&p->u.prefix;
u_char *newp = (u_char *)&new->u.prefix;
for (i = 0; i < p->prefixlen / 8; i++)
@@ -265,7 +265,7 @@ route_node_match_ipv6 (const struct route_table *table,
/* Lookup same prefix node. Return NULL when we can't find route. */
struct route_node *
-route_node_lookup (const struct route_table *table, struct prefix *p)
+route_node_lookup (const struct route_table *table, const struct prefix *p)
{
struct route_node *node;
u_char prefixlen = p->prefixlen;
@@ -287,7 +287,7 @@ route_node_lookup (const struct route_table *table, struct prefix *p)
/* Add node to routing table. */
struct route_node *
-route_node_get (struct route_table *const table, struct prefix *p)
+route_node_get (struct route_table *const table, const struct prefix *p)
{
struct route_node *new;
struct route_node *node;