lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EB466CB.2040506@hp.com>
Date:	Fri, 04 Nov 2011 15:27:23 -0700
From:	Rick Jones <rick.jones2@...com>
To:	netdev@...r.kernel.org
CC:	rusty@...tcorp.com.au, mst@...hat.com
Subject: what's in a bus_info

...or would an interface name smell as sweet? (as PCI bus addressing)

Is there a "standard" for what is returned in bus_info of 
ethtool_drvinfo?  I have been very used to seeing PCI bus addressing 
information in that field (at least as displayed by ethtool -i) and when 
I went to "leverage how to" from other drivers, to add "native" ethtool 
-i support to virtio_net, I ended-up with "eth0" rather than the PCI 
information I see in lspci output and in ethtool -i against other 
devices.  Including an emulated e1000 interface in the same kernel.

What I'm doing is calling pci_name(), feeding it with to_pci_dev() from 
the address of the struct device in the struct net_device.  The perhaps 
overly paranoid work-in-progress:

static void virtnet_get_drvinfo(struct net_device *dev,
                                 struct ethtool_drvinfo *info)
{

         struct device *dev_dev;
         struct pci_dev *pci_dev = NULL;


         dev_dev = &(dev->dev);
         if (dev_dev != NULL)
                 pci_dev = to_pci_dev(dev_dev);
         strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
         strlcpy(info->version,"I am versionless", sizeof(info->version));
         strlcpy(info->fw_version,"I have no firmware", 
sizeof(info->fw_version));
         strlcpy(info->bus_info,
                 (pci_dev != NULL) ? pci_name(pci_dev) : "",
                 sizeof(info->bus_info));

}

So, with the emulated e1000 I get:

raj@...-ubuntu-guest:~$ ethtool -i eth0
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version: N/A
bus-info: 0000:00:11.0
raj@...-ubuntu-guest:~$

and I see that the e1000 driver calls pci_name().  However, the code 
above, when I boot the guest with the virtio device gives me:

raj@...-ubuntu-guest:~$ ethtool -i eth0
driver: virtio_net
version: I am versionless
firmware-version: I have no firmware
bus-info: eth0

00:03.0 Ethernet controller: Red Hat, Inc Virtio network device

Am I chasing the wrong pointers?  Is it  a function of virtio?

rick jones

BTW, I notice some drivers call strlcpy and some strncpy, and some even 
call strcpy.  Is there one that is meant to be preferred over the others?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ