[13:17:40] moritzm: do you have a minute to review https://gerrit.wikimedia.org/r/c/operations/puppet/+/677110 ? just updating the key with a new one [13:44:13] LGTM, +1 [14:13:50] thanks! [16:43:18] wonder if anyone here could help with this https://unix.stackexchange.com/questions/643692/calculating-ifa-flags-larger-then-0xff-from-proc-net-if-inet6 [16:47:06] as far as i can tell from random bugs like this (https://bugzilla.redhat.com/show_bug.cgi?id=1056711) ifa-flags is 32bits however /proc/net/if_inet6 only has an 8bit indicator [17:26:19] jbond42: as best I can tell from the linux source it confirms what you're guessing above: it is in fact true that the ifa_flags field is 32 bits wide and has flags defined which don't fit in 8 bits, but for legacy compat reasons, the /proc/net/if_inet6 interface does only show the lowest 8 bits of them. [17:26:38] jbond42: I think the interface to get those flags is going to be netlink [17:26:46] (rather than procfs) [17:27:41] but, I couldn't even tell you the precise netlink call to get to that info offhand [17:28:17] bblack: ack thanks for the confirmation ill have a dig into netlink the following also looks usefull https://www.rubydoc.info/stdlib/socket/Socket.getifaddrs (facter4 is ruby again) [17:29:45] ah yes [17:30:06] there's a corresponding BSD-derived linux call too [17:30:28] https://linux.die.net/man/3/getifaddrs [17:30:41] the ruby stuff looks like a direct interface into that, and the flags field there may contain those same flags [17:30:54] s/may/should/ :) [17:31:09] that might be way simpler than netlink [17:32:22] :D thanks and yes lokos like its quite simple to get the flags (i think) [17:33:07] well [17:33:27] digging on the docs a bit: getifaddrs flags says they're equivalent to SIOCGIFFLAGS ioctl's flags [17:33:52] "man 7 netdevice" has a list of those, and they don't look like exactly the same set as the raw ifa_flags [17:34:14] but they might in practice tell you all the metadata you need regardless. i guess it depends on the purpose :) [17:34:44] I think the distinction is these are interface flags, not address flags? [17:35:36] ahh yes that is probably not usefull as im specificly trying to identify the different properties of multiple addresses on the same int [17:36:26] it's kind of poorly named, the API fields involved here [17:36:49] the kernel ifa_flags is what we want, and getifaddrs' structure has an "ifa_flags" which is not that, but rather what the ioctls call ifr_flags :) [17:38:26] they explains why they dont give me the results i expected [17:39:58] so the other tactic you could take, is to rely on the other binary tools which do use the raw netlink interface for you [17:40:09] like "ip -6 addr" does the netlink calls and displays parseable text [17:41:11] yes thats definetly an option, was hoping to avooid that allthugh i have spent way more time diggin into this then i would in wrting something to parse ip -6 -o addr [17:42:00] you can use the netlink API from a higher-level language. it's basically just a network message API over an AF_NETLINUX socket, but it's pretty ugly [17:42:14] maybe there's a ruby library that abstracts AF_NETLINK messages though [17:44:03] yes could be thanks for the help has at least saved me going further won the socket.getifaddrs :) and will take a look at netlink :) [17:44:40] there's not even great docs. In theory "man 7 netlink" tells you that you need NETLINK_ROUTE and points at "man rtnetlink" for that, which then helpfully indicates halfway down the page: [17:44:47] BUGS: This manual page is incomplete. [17:45:20] but in an strace of the ip command, you can see it in action, e.g.: [17:45:21] sendto(3, [{{len=24, type=RTM_GETADDR, flags=NLM_F_REQUEST|NLM_F_DUMP, seq=1617730828, pid=0}, {ifa_family=AF_INET6, ifa_prefixlen=0, ifa_flags=0, ifa_scope=RT_SCOPE_UNIVERSE, ifa_index=0}}, {len=0, type=0 /* NLMSG_??? */, flags=0, seq=0, pid=0}], 152, 0, NULL, 0) = 152 [17:45:35] recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base=[{{len=72, type=RTM_NEWADDR, flags=NLM_F_MULTI, seq=1617730828, pid=3864992}, {ifa_family=AF_INET6, ifa_prefixlen=128, ifa_flags=IFA_F_PERMANENT, ifa_scope=RT_SCOPE_HOST, ifa_index=if_nametoindex("lo")}, [{{nla_len=20, nla_type=IFA_ADDRESS}, inet_pton(AF_INET6, "::1")}, .... [17:46:14] (there's the ifa_flags, deep in the structures returned in response to RTM_GETADDR on a NETLINK_ROUTE socket, basically) [17:46:49] ahh cool, i also found https://people.netfilter.org/pablo/netlink/netlink.pdf