On Mon, 11 Apr 2011 15:26:19 -0500 Ted Zlatanov <[email protected]> wrote:
TZ> Actually it would be really nice if cfengine produced the list of
TZ> interfaces in addition to the current net_iface_* classes. It's already
TZ> traversing the list of interfaces and providing sys.ipv4 so collecting
TZ> their names in a sys.interfaces slist would be useful.
TZ> I think it would be useful information to know the network driver, maybe
TZ> as the mapped value if the key is the interface name.
TZ> getindices("sys.ipv4") won't work with Infiniband interfaces, for
TZ> instance (they can be sometimes configured with IPv4 addresses but it's
TZ> not standard or reliable), and probably won't work with IPv6 according
TZ> to the docs. So knowledge of the driver would really help there,
TZ> instead of relying on the interface name to match some regex as we do now.
I think the right place to put this information is in sysinfo.c, see
attached patch. I don't know (yet) how to get the driver name from the
ifreq structure. Before I dive into the code and produce a full patch,
can one of the cfengine maintainers please tell me if I'm on the right
track and if this feature will be considered for inclusion? If not I
can just do it with a module in our environment.
Thanks
Ted
Index: src/sysinfo.c
===================================================================
--- src/sysinfo.c (revision 2045)
+++ src/sysinfo.c (working copy)
@@ -1976,6 +1976,10 @@
continue;
}
+ /* get driver_name */
+ snprintf(name,CF_MAXVARSIZE-1,"interface[%s]",CanonifyName(ifp->ifr_name));
+ NewScalar("sys",name,driver_name,cf_str);
+
if (strncmp(last_name,ifp->ifr_name,sizeof(ifp->ifr_name)) == 0)
{
first_address = false;
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine