eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit c8eb33c2c25521a8c915b234fec3706369063da3
parent d954eee0cc66e291f152a0dadcb1ee39b3a8a46c
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date:   Fri, 27 Sep 2019 12:52:22 -0700

rtnlutil: Add parser for IPv6 RTNL packet

At this time, we are only looking for IFA_ADDRESS attribute that
represents the IPv6 IP address.

Diffstat:
Msrc/rtnlutil.c | 30++++++++++++++++++++++++++++++
Msrc/rtnlutil.h | 3+++
2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/rtnlutil.c b/src/rtnlutil.c @@ -418,3 +418,33 @@ uint32_t rtnl_route_ipv4_add_gateway(struct l_netlink *rtnl, int ifindex, gateway, src, priority_offset, proto, cb, user_data, destroy); } + +void rtnl_ifaddr_ipv6_extract(const struct ifaddrmsg *ifa, int len, char **ip) +{ + struct in6_addr in6_addr; + struct rtattr *attr; + char address[128]; + + for (attr = IFA_RTA(ifa); RTA_OK(attr, len); + attr = RTA_NEXT(attr, len)) { + switch (attr->rta_type) { + case IFA_ADDRESS: + if (!ip) + break; + + memcpy(&in6_addr.s6_addr, RTA_DATA(attr), + sizeof(in6_addr.s6_addr)); + + if (!inet_ntop(AF_INET6, &in6_addr, address, + INET6_ADDRSTRLEN)) { + + l_error("rtnl: Failed to extract IPv6 address"); + break; + } + + *ip = l_strdup(address); + + break; + } + } +} diff --git a/src/rtnlutil.h b/src/rtnlutil.h @@ -67,3 +67,6 @@ uint32_t rtnl_route_ipv4_add_gateway(struct l_netlink *rtnl, int ifindex, l_netlink_command_func_t cb, void *user_data, l_netlink_destroy_func_t destroy); + +void rtnl_ifaddr_ipv6_extract(const struct ifaddrmsg *ifa, int bytes, + char **ip);