summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/prefix.c14
-rw-r--r--lib/prefix.h6
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 1008e16a5..78a97fd14 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -628,8 +628,11 @@ int prefix_match_network_statement(const struct prefix *n,
return 1;
}
-void prefix_copy(struct prefix *dest, const struct prefix *src)
+void prefix_copy(union prefixptr udest, union prefixconstptr usrc)
{
+ struct prefix *dest = udest.p;
+ const struct prefix *src = usrc.p;
+
dest->family = src->family;
dest->prefixlen = src->prefixlen;
@@ -674,8 +677,11 @@ void prefix_copy(struct prefix *dest, const struct prefix *src)
* the same. Note that this routine has the same return value sense
* as '==' (which is different from prefix_cmp).
*/
-int prefix_same(const struct prefix *p1, const struct prefix *p2)
+int prefix_same(union prefixconstptr up1, union prefixconstptr up2)
{
+ const struct prefix *p1 = up1.p;
+ const struct prefix *p2 = up2.p;
+
if ((p1 && !p2) || (!p1 && p2))
return 0;
@@ -722,8 +728,10 @@ int prefix_same(const struct prefix *p1, const struct prefix *p2)
* this routine has the same return sense as strcmp (which is different
* from prefix_same).
*/
-int prefix_cmp(const struct prefix *p1, const struct prefix *p2)
+int prefix_cmp(union prefixconstptr up1, union prefixconstptr up2)
{
+ const struct prefix *p1 = up1.p;
+ const struct prefix *p2 = up2.p;
int offset;
int shift;
int i;
diff --git a/lib/prefix.h b/lib/prefix.h
index d57b43dac..5f88eaae0 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -410,10 +410,10 @@ extern const char *prefix2str(union prefixconstptr, char *, int);
extern int prefix_match(const struct prefix *, const struct prefix *);
extern int prefix_match_network_statement(const struct prefix *,
const struct prefix *);
-extern int prefix_same(const struct prefix *, const struct prefix *);
-extern int prefix_cmp(const struct prefix *, const struct prefix *);
+extern int prefix_same(union prefixconstptr, union prefixconstptr);
+extern int prefix_cmp(union prefixconstptr, union prefixconstptr);
extern int prefix_common_bits(const struct prefix *, const struct prefix *);
-extern void prefix_copy(struct prefix *dest, const struct prefix *src);
+extern void prefix_copy(union prefixptr, union prefixconstptr);
extern void apply_mask(struct prefix *);
extern struct prefix *sockunion2prefix(const union sockunion *dest,