summaryrefslogtreecommitdiff
path: root/lib/prefix.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index 85488ccea7..45e6368463 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -74,9 +74,7 @@ struct prefix
{
u_char prefix;
struct in_addr prefix4;
-#ifdef HAVE_IPV6
struct in6_addr prefix6;
-#endif /* HAVE_IPV6 */
struct
{
struct in_addr id;
@@ -97,14 +95,12 @@ struct prefix_ipv4
};
/* IPv6 prefix structure. */
-#ifdef HAVE_IPV6
struct prefix_ipv6
{
u_char family;
u_char prefixlen;
struct in6_addr prefix __attribute__ ((aligned (8)));
};
-#endif /* HAVE_IPV6 */
struct prefix_ls
{
@@ -138,6 +134,14 @@ struct prefix_ptr
uintptr_t prefix __attribute__ ((aligned (8)));
};
+struct prefix_sg
+{
+ u_char family;
+ u_char prefixlen;
+ struct in_addr src __attribute ((aligned (8)));
+ struct in_addr grp;
+};
+
/* helper to get type safety/avoid casts on calls
* (w/o this, functions accepting all prefix types need casts on the caller
* side, which strips type safety since the cast will accept any pointer
@@ -226,13 +230,8 @@ extern const char *prefix_family_str (const struct prefix *);
extern int prefix_blen (const struct prefix *);
extern int str2prefix (const char *, struct prefix *);
-/*
- * 8 groups of 4 bytes of hexadecimal + 7 seperators is 39
- * /128 = 4 bytes
- * Null = 1 byte
- * 39 + 4 + 1 = 44 bytes
- */
-#define PREFIX2STR_BUFFER 44
+#define PREFIX2STR_BUFFER PREFIX_STRLEN
+
extern const char *prefix2str (union prefix46constptr, char *, int);
extern int prefix_match (const struct prefix *, const struct prefix *);
extern int prefix_same (const struct prefix *, const struct prefix *);
@@ -271,7 +270,6 @@ extern in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
extern int netmask_str2prefix_str (const char *, const char *, char *);
-#ifdef HAVE_IPV6
extern struct prefix_ipv6 *prefix_ipv6_new (void);
extern void prefix_ipv6_free (struct prefix_ipv6 *);
extern int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
@@ -298,8 +296,6 @@ static inline int ipv6_martian (struct in6_addr *addr)
return 0;
}
-#endif /* HAVE_IPV6 */
-
extern int all_digit (const char *);
/* NOTE: This routine expects the address argument in network byte order. */