eiwd

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

commit 7c5fb5aad4b6e7325cc7f700f9195b8b1e8d6681
parent 609f9c8f439dec013809b501777f03287f27e3b2
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Wed,  4 Nov 2020 14:29:47 -0600

monitor: Pretty-print IFA_CACHEINFO entries

Diffstat:
Mmonitor/nlmon.c | 29++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/monitor/nlmon.c b/monitor/nlmon.c @@ -6701,6 +6701,32 @@ static void print_inet_addr(unsigned int indent, const char *str, print_attr(indent, "%s: %s", str, ip); } +static void print_cacheinfo(unsigned int indent, const char *str, + const void *buf, uint16_t size) +{ + const struct ifa_cacheinfo *cinfo = buf; + + print_attr(indent, "%s:", str); + + if (size != sizeof(struct ifa_cacheinfo)) { + printf("malformed packet\n"); + return; + } + + if (cinfo->ifa_prefered == 0xffffffffu) + print_attr(indent + 1, "ifa_prefered: infinite"); + else + print_attr(indent + 1, "ifa_prefered: %u", cinfo->ifa_prefered); + + if (cinfo->ifa_valid == 0xffffffffu) + print_attr(indent + 1, "ifa_valid: infinite"); + else + print_attr(indent + 1, "ifa_valid: %u", cinfo->ifa_valid); + + print_attr(indent + 1, "tstamp: %u, cstamp: %u", + cinfo->tstamp, cinfo->cstamp); +} + static struct attr_entry addr_entry[] = { { IFA_ADDRESS, "Interface Address", ATTR_CUSTOM, { .function = print_inet_addr } }, @@ -6711,7 +6737,8 @@ static struct attr_entry addr_entry[] = { { IFA_ANYCAST, "Anycast Address", ATTR_CUSTOM, { .function = print_inet_addr } }, { IFA_LABEL, "Label", ATTR_STRING }, - { IFA_CACHEINFO, "CacheInfo", ATTR_BINARY }, + { IFA_CACHEINFO, "CacheInfo", ATTR_CUSTOM, + { .function = print_cacheinfo } }, { IFA_FLAGS, "Flags", ATTR_CUSTOM, { .function = print_ifa_flags } }, { },