summaryrefslogtreecommitdiff
path: root/zebra/ioctl.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2017-12-11 15:21:04 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2017-12-13 16:54:10 +0100
commite86b71f142b66ca0b74b5d392ea537fd3a30f33c (patch)
tree11c35cdb12fdb7c6d8c1be379d0785cfae2df001 /zebra/ioctl.c
parentdb33b83b1d90458503987fd9f5f21c09c045e9a7 (diff)
zebra: ipv6 addressing uses netlink socket instead of standard ioctl
It is possible to configure IPv6 addresses from interfaces by using netlink socket, intead of using standard sockets. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/ioctl.c')
-rw-r--r--zebra/ioctl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 58118ce006..b5ed3ede97 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,10 +462,12 @@ 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)
{
+#ifdef HAVE_NETLINK
+ return kernel_address_add_ipv6 (ifp, ifc);
+#else /* ! HAVE_NETLINK */
int ret;
struct prefix_ipv6 *p;
struct in6_ifreq ifreq;
@@ -479,10 +483,14 @@ int if_prefix_add_ipv6(struct interface *ifp, struct connected *ifc)
ret = if_ioctl_ipv6(SIOCSIFADDR, (caddr_t)&ifreq);
return ret;
+#endif /* ! HAVE_NETLINK */
}
int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
{
+#ifdef HAVE_NETLINK
+ return kernel_address_delete_ipv6 (ifp, ifc);
+#else /* ! HAVE_NETLINK */
int ret;
struct prefix_ipv6 *p;
struct in6_ifreq ifreq;
@@ -498,6 +506,7 @@ int if_prefix_delete_ipv6(struct interface *ifp, struct connected *ifc)
ret = if_ioctl_ipv6(SIOCDIFADDR, (caddr_t)&ifreq);
return ret;
+#endif /* ! HAVE_NETLINK */
}
#else /* LINUX_IPV6 */
#ifdef HAVE_STRUCT_IN6_ALIASREQ