summaryrefslogtreecommitdiff
path: root/zebra/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/ioctl.c')
-rw-r--r--zebra/ioctl.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 58118ce006..8e3a1d1a03 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -78,6 +78,7 @@ int if_ioctl(u_long request, caddr_t buffer)
return 0;
}
+#ifndef HAVE_NETLINK
static int if_ioctl_ipv6(u_long request, caddr_t buffer)
{
int sock;
@@ -108,6 +109,7 @@ static int if_ioctl_ipv6(u_long request, caddr_t buffer)
}
return 0;
}
+#endif /* ! HAVE_NETLINK */
/*
* get interface metric
@@ -460,44 +462,19 @@ struct in6_ifreq {
int ifr6_ifindex;
};
#endif /* _LINUX_IN6_H */
-
/* Interface's address add/delete functions. */
int if_prefix_add_ipv6(struct interface *ifp, struct connected *ifc)
{
- int ret;
- struct prefix_ipv6 *p;
- struct in6_ifreq ifreq;
-
- p = (struct prefix_ipv6 *)ifc->address;
-
- memset(&ifreq, 0, sizeof(struct in6_ifreq));
-
- memcpy(&ifreq.ifr6_addr, &p->prefix, sizeof(struct in6_addr));
- ifreq.ifr6_ifindex = ifp->ifindex;
- ifreq.ifr6_prefixlen = p->prefixlen;
-
- ret = if_ioctl_ipv6(SIOCSIFADDR, (caddr_t)&ifreq);
-
- return ret;
+#ifdef HAVE_NETLINK
+ return kernel_address_add_ipv6 (ifp, ifc);
+#endif /* HAVE_NETLINK */
}
int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
{
- int ret;
- struct prefix_ipv6 *p;
- struct in6_ifreq ifreq;
-
- p = (struct prefix_ipv6 *)ifc->address;
-
- memset(&ifreq, 0, sizeof(struct in6_ifreq));
-
- memcpy(&ifreq.ifr6_addr, &p->prefix, sizeof(struct in6_addr));
- ifreq.ifr6_ifindex = ifp->ifindex;
- ifreq.ifr6_prefixlen = p->prefixlen;
-
- ret = if_ioctl_ipv6(SIOCDIFADDR, (caddr_t)&ifreq);
-
- return ret;
+#ifdef HAVE_NETLINK
+ return kernel_address_delete_ipv6 (ifp, ifc);
+#endif /* HAVE_NETLINK */
}
#else /* LINUX_IPV6 */
#ifdef HAVE_STRUCT_IN6_ALIASREQ