From e86b71f142b66ca0b74b5d392ea537fd3a30f33c Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 11 Dec 2017 15:21:04 +0100 Subject: 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 --- zebra/ioctl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'zebra/ioctl.c') 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 -- cgit v1.2.3