summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c1
-rw-r--r--sysdep/config.h3
-rw-r--r--sysdep/linux/netlink.c3
-rw-r--r--sysdep/unix/krt.Y3
-rw-r--r--sysdep/unix/krt.c8
-rw-r--r--sysdep/unix/krt.h3
-rw-r--r--sysdep/unix/unix.h6
7 files changed, 9 insertions, 18 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 19e82047..dd62b375 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -71,6 +71,7 @@
#define KRT_MAX_TABLES 1
#endif
+#define IPV6 1
/* Dynamic max number of tables */
diff --git a/sysdep/config.h b/sysdep/config.h
index 9620a37d..08c15fe9 100644
--- a/sysdep/config.h
+++ b/sysdep/config.h
@@ -9,9 +9,6 @@
/* BIRD version */
#define BIRD_VERSION "1.5.0"
-/* XXXX Temporary */
-#define IPV6 1
-
/* Include parameters determined by configure script */
#include "sysdep/autoconf.h"
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index b3d0a9ab..201d074e 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -1169,7 +1169,8 @@ nl_parse_route(struct nlmsghdr *h, int scan)
ra.gw = rta_get_ipa(a[RTA_GATEWAY]);
/* Silently skip strange 6to4 routes */
- if ((i->rtm_family == AF_INET6) && ipa_in_net(ra.gw, IPA_NONE, 96))
+ const net_addr_ip6 sit = NET_ADDR_IP6(IP6_NONE, 96);
+ if ((i->rtm_family == AF_INET6) && ipa_in_netX(ra.gw, (net_addr *) &sit))
return;
neighbor *nbr;
diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y
index e769ec0f..eb0ae109 100644
--- a/sysdep/unix/krt.Y
+++ b/sysdep/unix/krt.Y
@@ -69,8 +69,7 @@ kif_item:
}
| PRIMARY opttext net_or_ipa {
struct kif_primary_item *kpi = cfg_alloc(sizeof (struct kif_primary_item));
- kpi->prefix = IPA_NONE; /* XXXX */
- kpi->pxlen = 0; /* XXXX */
+ kpi->addr = $3.n;
add_tail(&THIS_KIF->primary, &kpi->n);
}
;
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 73324f38..41293a06 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -131,14 +131,14 @@ prefer_addr(struct ifa *a, struct ifa *b)
}
static inline struct ifa *
-find_preferred_ifa(struct iface *i, ip_addr prefix, ip_addr mask)
+find_preferred_ifa(struct iface *i, const net_addr *n)
{
struct ifa *a, *b = NULL;
WALK_LIST(a, i->addrs)
{
if (!(a->flags & IA_SECONDARY) &&
- ipa_equal(ipa_and(a->ip, mask), prefix) &&
+ (!n || ipa_in_netX(a->ip, n)) &&
(!b || prefer_addr(a, b)))
b = a;
}
@@ -156,14 +156,14 @@ kif_choose_primary(struct iface *i)
WALK_LIST(it, cf->primary)
{
if (!it->pattern || patmatch(it->pattern, i->name))
- if (a = find_preferred_ifa(i, it->prefix, ipa_mkmask(it->pxlen)))
+ if (a = find_preferred_ifa(i, &it->addr))
return a;
}
if (a = kif_get_primary_ip(i))
return a;
- return find_preferred_ifa(i, IPA_NONE, IPA_NONE);
+ return find_preferred_ifa(i, NULL);
}
diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h
index 4b66ea83..f05dc37e 100644
--- a/sysdep/unix/krt.h
+++ b/sysdep/unix/krt.h
@@ -97,8 +97,7 @@ extern struct protocol proto_unix_iface;
struct kif_primary_item {
node n;
byte *pattern;
- ip_addr prefix;
- int pxlen;
+ net_addr addr;
};
struct kif_config {
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index 58ceab1e..6e788f08 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -80,14 +80,8 @@ static inline ip_addr ipa_from_sa(sockaddr *sa)
static inline struct in_addr ipa_to_in4(ip_addr a)
{ return (struct in_addr) { htonl(ipa_to_u32(a)) }; }
-#ifdef IPV6
static inline struct in6_addr ipa_to_in6(ip_addr a)
{ return (struct in6_addr) { .s6_addr32 = { htonl(_I0(a)), htonl(_I1(a)), htonl(_I2(a)), htonl(_I3(a)) } }; }
-#else
-/* Temporary dummy */
-static inline struct in6_addr ipa_to_in6(ip_addr a)
-{ return (struct in6_addr) { .s6_addr32 = { 0, 0, 0, 0 } }; }
-#endif
void sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port);
int sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *port);