- 23 3月, 2017 1 次提交
-
-
由 Laine Stump 提交于
This function provides the bridge/bond device that the given network device is attached to. The return value is 0 or -1, and the master device is a char** argument to the function - this is needed in order to allow for a "success" return from a device that has no master.
-
- 22 3月, 2017 1 次提交
-
-
由 Cédric Bosdonnat 提交于
Add a function getting the name of a network interface out of its index.
-
- 07 3月, 2017 1 次提交
-
-
由 Laine Stump 提交于
Proposed formal coding conventions encourage defining typedefs for vir[Blah] and vir[Blah]Ptr separately from the associated struct named _vir[Blah]: typedef struct _virBlah virBlah; typedef virBlah *virBlahPtr; struct _virBlah { ... }; At some point in the past, I had submitted several patches using a more compact style that I prefer, and they were accepted: typedef struct _virBlah { ... } virBlah, *virBlahPtr; Since these are by far a minority among all struct definitions, this patch changes all those definitions to reflect the style prefered by the proposal so that there is 100% consistency.
-
- 27 6月, 2016 3 次提交
-
-
由 Andrea Bolognani 提交于
Commit cf0568b0 moved a bunch of functions from virNetDev to the more specific virNetDevIP; however, not all of the existing uses were moved properly, causing build failures on FreeBSD. Complete the transition to the new names and drop the obsolete declarations from the header file while at it.
-
由 Laine Stump 提交于
These had been declared in conf/device_conf.h, but then used in util/virnetdev.c, meaning that we had to #include conf/device_conf.h in virnetdev.c (which we have for a long time said shouldn't be done. This caused a bigger problem when I tried to #include util/virnetdev.h in a file in src/conf (which is allowed) - for some reason the "device_conf.h: File not found" error. The solution is to move the data types and functions used in util sources from conf to util. Some names were adjusted during the move ("virInterface" --> "virNetDevIf", and "VIR_INTERFACE" --> "VIR_NETDEV_IF")
-
由 Laine Stump 提交于
virNetDevLinkDump should have been in virnetlink.c, but that file didn't exist yet when the function was created. It didn't really matter until now - I found that having virnetlink.h included by virnetdev.h caused build problems when trying to #include virnetdev.h in a .c file in src/conf (due to missing directory in -I). Rather than fix that to further institutionalize the incorrect placement of this one function, this patch moves the function.
-
- 11 5月, 2016 1 次提交
-
-
由 Laine Stump 提交于
SRIOV VFs used in macvtap passthrough mode can take advantage of the SRIOV card's transparent vlan tagging. All the code was there to set the vlan tag, and it has been used for SRIOV VFs used for hostdev interfaces for several years, but for some reason, the vlan tag for macvtap passthrough devices was stubbed out with a -1. This patch moves a bit of common validation down to a lower level (virNetDevReplaceNetConfig()) so it is shared by hostdev and macvtap modes, and updates the macvtap caller to actually send the vlan config instead of -1.
-
- 13 4月, 2016 1 次提交
-
-
由 Ján Tomko 提交于
This is just a wrapper for virCommand that takes two strings and runs them. Move it to virnetdev.c for easier mocking.
-
- 08 4月, 2016 1 次提交
-
-
由 Vasiliy Tolstov 提交于
Signed-off-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
-
- 25 11月, 2015 1 次提交
-
-
由 Laine Stump 提交于
A PCI device may have the capability to setup virtual functions (VFs) but have them currently all disabled. Prior to this patch, if that was the case the the node device XML for the device wouldn't report any virtual_functions capability. With this patch, if a file called "sriov_totalvfs" is found in the device's sysfs directory, its contents will be interpreted as a decimal number, and that value will be reported as "maxCount" in a capability element of the device's XML, e.g.: <capability type='virtual_functions' maxCount='7'/> This will be reported regardless of whether or not any VFs are currently enabled for the device. NB: sriov_numvfs (the number of VFs currently active) is also available in sysfs, but that value is implied by the number of items in the list that is inside the capability element, so there is no reason to explicitly provide it as an attribute. sriov_totalvfs and sriov_numvfs are available in kernels at least as far back as the 2.6.32 that is in RHEL6.7, but in the case that they simply aren't there, libvirt will behave as it did prior to this patch - no maxCount will be displayed, and the virtual_functions capability will be absent from the device's XML when 0 VFs are enabled.
-
- 05 11月, 2015 1 次提交
-
-
由 John Ferlan 提交于
Commit id '0f7436ca' added virNetDevWaitDadFinish using ATTRIBUTE_NONNULL for both arguments, although one is a non-null argument. A Coverity build balks at that.
-
- 29 10月, 2015 1 次提交
-
-
由 Maxim Perevedentsev 提交于
commit db488c79 assumed that dnsmasq would complete IPv6 DAD before daemonizing, but in reality it doesn't wait, which creates problems when libvirt's bridge driver sets the matching "dummy tap device" to IFF_DOWN prior to DAD completing. This patch waits for DAD completion by periodically polling the kernel using netlink to check whether there are any IPv6 addresses assigned to bridge which have a 'tentative' state (if there are any in this state, then DAD hasn't yet finished). After DAD is finished, execution continues. To avoid an endless hang in case something was wrong with the kernel's DAD, we wait a maximum of 5 seconds.
-
- 03 9月, 2015 1 次提交
-
-
由 Laine Stump 提交于
These functions were made static as a part of commit cbfe38c since they were no longer called from outside virnetdev.c. We once again need to call them from another file, so this patch makes them once again public.
-
- 21 7月, 2015 1 次提交
-
-
由 Moshe Levi 提交于
Adding functionality to libvirt that will allow it query the interface for the availability of RDMA and tx-udp_tnl-segmentation Offloading NIC capabilities Here is an example of the feature XML definition: <device> <name>net_eth4_90_e2_ba_5e_a5_45</name> <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path> <parent>pci_0000_08_00_1</parent> <capability type='net'> <interface>eth4</interface> <address>90:e2:ba:5e:a5:45</address> <link speed='10000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <feature name='rdma'/> <feature name='txudptnl'/> <capability type='80203'/> </capability> </device>
-
- 22 4月, 2015 1 次提交
-
-
由 Laine Stump 提交于
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1113474 When we set the MAC address of a network device as a part of setting up macvtap "passthrough" mode (where the domain has an emulated netdev connected to a host macvtap device that has exclusive use of the physical device, and sets the device MAC address to match its own, i.e. "<interface type='direct'> <source mode='passthrough' .../>"), we use ioctl(SIOCSIFHWADDR) giving it the name of that device. This is true even if it is an SRIOV Virtual Function (VF). But, when we are setting the MAC address / vlan ID of a VF in preparation for "hostdev network" passthrough (this is where we set the MAC address and vlan id of the VF after detaching the host net driver and before assigning the device to the domain with PCI passthrough, i.e. "<interface type='hostdev'>", we do the setting via a netlink RTM_SETLINK message for that VF's Physical Function (PF), telling it the VF# we want to change. This sets an "administratively changed MAC" flag for that VF in the PF's driver, and from that point on (until the PF driver is reloaded, *not* merely the VF driver) that VF's MAC address can't be changed using ioctl(SIOCSIFHWADDR) - the only way to change it is via the PF with RTM_SETLINK. This means that if a VF is used for hostdev passthrough, it will have the admin flag set, and future attempts to use that VF for macvtap passthrough will fail. The solution to this problem is to check if the device being used for macvtap passthrough is actually a VF; if so, we use the netlink RTM_SETLINK message to the PF to set the VF's mac address instead of ioctl(SIOCSIFHWADDR) directly to the VF; if not, behavior does not change from previously. There are three pieces to making this work: 1) virNetDevMacVLan(Create|Delete)WithVPortProfile() now call virNetDev(Replace|Restore)NetConfig() rather than virNetDev(Replace|Restore)MacAddress() (simply passing -1 for VF# and vlanid). 2) virNetDev(Replace|Restore)NetConfig() check to see if the device is a VF. If so, they find the PF's name and VF#, allowing them to call virNetDev(Replace|Restore)VfConfig(). 3) To prevent mixups when detaching a macvtap passthrough device that had been attached while running an older version of libvirt, virNetDevRestoreVfConfig() is potentially given the preserved name of the VF, and if the proper statefile for a VF can't be found in the stateDir (${stateDir}/${pfname}_vf${vfid}), virNetDevRestoreMacAddress() is called instead (which will look in the file named ${stateDir}/${vfname}). This problem has existed in every version of libvirt that has both macvtap passthrough and interface type='hostdev'. Fortunately people seem to use one or the other though, so it hasn't caused any real world problem reports.
-
- 15 4月, 2015 2 次提交
-
-
由 Michal Privoznik 提交于
Throughout the code, we have several places need to construct a path somewhere in /sys/class/net/... They are not consistent and nearly each code piece invents its own way how to do it. So unify this by: 1) use virNetDevSysfsFile() wherever possible 2) At least use common macro SYSFS_NET_DIR declared in virnetdev.h at the rest of places which can't go with 1) Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Michal Privoznik 提交于
This is yet another test for check of basic functionality of our NIC state handling code. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 10 4月, 2015 1 次提交
-
-
由 John Ferlan 提交于
Rename it to virNetDevGetIPv4AddressIoctl and make virNetDevGetIPAddress a wrapper around it, allowing other ways of getting the address to be implemented, and still falling back to the old method. Signed-off-by: NJohn Ferlan <jferlan@redhat.com> Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
- 05 3月, 2015 2 次提交
-
-
由 Ján Tomko 提交于
Last commit unconditionally included a linux-specific header. Do not do that.
-
由 James Chapman 提交于
Adding functionality to libvirt that will allow it query the ethtool interface for the availability of certain NIC HW offload features Here is an example of the feature XML definition: <device> <name>net_eth4_90_e2_ba_5e_a5_45</name> <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path> <parent>pci_0000_08_00_1</parent> <capability type='net'> <interface>eth4</interface> <address>90:e2:ba:5e:a5:45</address> <link speed='10000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <capability type='80203'/> </capability> </device> Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
- 03 2月, 2015 2 次提交
-
-
由 Pavel Hrdina 提交于
Commit e562a61a introduced new function to get/set interface state but there was misuse of ATTRIBUTE_NONNULL on non-pointer attributes and also we need to wrap that functions by #ifdef to not break mingw build. Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
由 Laine Stump 提交于
e562a61a added these two new helper functions and only used them within virnetdev.c, but declared them in the .h file. If some currently unsupported interface flags need to be accessed in the future, it will make more sense to write the appropriate higher level function rather than require us to artificially define IFF_* on some mythical platform that doesn't have SIOC[SG]IFFLAGS (and therefore doesn't have IFF_*) just so we can call virNetDevSetIFFFlags() to return an error. To help someone in not going down the wrong road, this patch makes the two helper functions static, hopefully making it less likely that someone will want to use them outside of virnetdev.c.
-
- 30 1月, 2015 1 次提交
-
-
由 Tony Krowiak 提交于
This patch provides the utility functions needed to synchronize the rxfilter changes made to a guest domain with the corresponding macvtap devices on the host: * Get/set PROMISC flag * Get/set ALLMULTI, MULTICAST Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 06 1月, 2015 3 次提交
-
-
由 Cédric Bosdonnat 提交于
Network interfaces devices and host devices with net capabilities can now have IPv4 and/or an IPv6 routes configured.
-
由 Cédric Bosdonnat 提交于
Make clear that virNetDevClearIPv4Address can also handle IPv6 addresses by changing the name
-
由 Cédric Bosdonnat 提交于
Renamed virNetDevSetIPv4Address as it also handles IPv6 addresses.
-
- 29 10月, 2014 1 次提交
-
-
由 Tony Krowiak 提交于
This patch provides the utility functions to needed to synchronize the changes made to a guest domain network device's multicast filter with the corresponding macvtap device's filter on the host: * Get/add/remove multicast MAC addresses * Get the macvtap device's RX filter list Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com> Signed-off-by: NLaine Stump <laine@laine.org>
-
- 27 10月, 2014 1 次提交
-
-
由 Laine Stump 提交于
virNetDevLinkDump() gets a message from netlink into "resp", then calls nlmsg_parse() to fill the table "tb" with pointers into resp. It then returns tb to its caller, but not before freeing the buffer at resp. That means that all the callers of virNetDevLinkDump() are examining memory that has already been freed. This can be verified by filling the buffer at resp with garbage prior to freeing it (or, I suppose, just running libvirtd under valgrind) then performing some operation that calls virNetDevLinkDump(). The code has been like this ever since virNetDevLinkDump() was written - the original author didn't notice it, and neither did later additional users of the function. It has only been pure luck (or maybe a lack of heavy load, and/or maybe an allocation algorithm in malloc() that delays re-use of just-freed memory) that has kept this from causing errors, for example when configuring a PCI passthrough or macvtap passthrough network interface. The solution taken in this patch is the simplest - just return resp to the caller along with tb, then have the caller free it after they are finished using the data (pointers) in tb. I alternately could have made a cleaner interface by creating a new struct that put tb and resp together along with a vir*Free() function for it, but this function is only used in a couple places, and I'm not sure there will be additional new uses of virNetDevLinkDump(), so the value of adding a new type, extra APIs, etc. is dubious.
-
- 07 10月, 2014 1 次提交
-
-
由 Laine Stump 提交于
This same structure will be used to retrieve RX filter info for interfaces on the host via netlink messages, and RX filter info for interfaces on the guest via the qemu "query-rx-filter" command.
-
- 11 6月, 2014 1 次提交
-
-
由 Michal Privoznik 提交于
The purpose of this function is to fetch link state and link speed for given NIC name from the SYSFS. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 13 3月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
Various methods in virnetdev.c and virhostdev.c were missing const-ness for several char * parameters. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 11月, 2013 1 次提交
-
-
由 Laine Stump 提交于
This is a prerequisite to the fix for the fix to: https://bugzilla.redhat.com/show_bug.cgi?id=1025397 num_virtual_functions needs to be size_t in order to use the VIR_APPEND_ELEMENT macro.
-
- 15 10月, 2013 1 次提交
-
-
由 Eric Blake 提交于
'const fooPtr' is the same as 'foo * const' (the pointer won't change, but it's contents can). But in general, if an interface is trying to be const-correct, it should be using 'const foo *' (the pointer is to data that can't be changed). Fix up remaining offenders in src/util. * src/util/virnetdev.h (virNetDevSetMAC) (virNetDevReplaceMacAddress, virNetDevValidateConfig) (virNetDevReplaceNetConfig): Use intended type. * src/util/virnetdevbandwidth.h (virNetDevBandwidthCopy) (virNetDevBandwidthPlug): Likewise. * src/util/virnetdevmacvlan.h (virNetDevMacVLanCreate) (virNetDevMacVLanCreateWithVPortProfile) (virNetDevMacVLanDeleteWithVPortProfile) (virNetDevMacVLanRestartWithVPortProfile) (virNetDevMacVLanVPortProfileRegisterCallback): Likewise. * src/util/virnetdevopenvswitch.h (virNetDevOpenvswitchAddPort): Likewise. * src/util/virnetdevtap.h (virNetDevTapCreateInBridgePort): Likewise. * src/util/virnetdevvlan.h (virNetDevVlanEqual) (virNetDevVlanCopy): Likewise. * src/util/virnetdevvportprofile.h (virNetDevVPortProfileAssociate) (virNetDevVPortProfileDisassociate): Likewise. * src/util/virnetlink.h (virNetlinkEventRemoveCallback) (virNetlinkEventAddClient, virNetlinkEventRemoveClient): Likewise. * src/util/virnetdev.c (virNetDevSetMAC) (virNetDevReplaceMacAddress, virNetDevValidateConfig) (virNetDevReplaceNetConfig): Fix fallout. * src/util/virnetdevbandwidth.c (virNetDevBandwidthCopy) (virNetDevBandwidthPlug): Likewise. * src/util/virnetdevmacvlan.c (virNetDevMacVLanCreate) (virNetDevMacVLanCreateWithVPortProfile) (virNetDevMacVLanDeleteWithVPortProfile) (virNetDevMacVLanRestartWithVPortProfile) (virNetDevMacVLanVPortProfileRegisterCallback): Likewise. * src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort): Likewise. * src/util/virnetdevtap.c (virNetDevTapCreateInBridgePort): Likewise. * src/util/virnetdevvlan.c (virNetDevVlanEqual) (virNetDevVlanCopy): Likewise. * src/util/virnetdevvportprofile.c (virNetDevVPortProfileAssociate) (virNetDevVPortProfileDisassociate) (virNetDevVPortProfileOpSetLink, virNetDevVPortProfileOpCommon) (virNetDevVPortProfileOp8021Qbg, virNetDevVPortProfileOp8021Qbh): Likewise. * src/util/virnetlink.c (virNetlinkEventRemoveCallback) (virNetlinkEventAddClient, virNetlinkEventRemoveClient): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 6月, 2013 1 次提交
-
- 14 6月, 2013 1 次提交
-
-
由 Roman Bogorodskiy 提交于
This method is useful not only in virnetdev.c.
-
- 15 5月, 2013 1 次提交
-
-
由 Martin Kletzander 提交于
Commit ccff335f added ATTRIBUTE_NONNULL for an attribute which is not a pointer and made files including virnetdev.h not compilable, so fix that.
-
- 14 5月, 2013 1 次提交
-
-
由 Gene Czarcinski 提交于
network: static route support for <network> This patch adds the <route> subelement of <network> to define a static route. the address and prefix (or netmask) attribute identify the destination network, and the gateway attribute specifies the next hop address (which must be directly reachable from the containing <network>) which is to receive the packets destined for "address/(prefix|netmask)". These attributes are translated into an "ip route add" command that is executed when the network is started. The command used is of the following form: ip route add <address>/<prefix> via <gateway> \ dev <virbr-bridge> proto static metric <metric> Tests are done to validate that the input data are correct. For example, for a static route ip definition, the address must be a network address and not a host address. Additional checks are added to ensure that the specified gateway is directly reachable via this network (i.e. that the gateway IP address is in the same subnet as one of the IP's defined for the network). prefix='0' is supported for both family='ipv4' address='0.0.0.0' netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::', prefix=0', although care should be taken to not override a desired system default route. Anytime an attempt is made to define a static route which *exactly* duplicates an existing static route (for example, address=::, prefix=0, metric=1), the following error message will be sent to syslog: RTNETLINK answers: File exists This can be overridden by decreasing the metric value for the route that should be preferred, or increasing the metric for the route that shouldn't be preferred (and is thus in place only in anticipation that the preferred route may be removed in the future). Caution should be used when manipulating route metrics, especially for a default route. Note: The use of the command-line interface should be replaced by direct use of libnl so that error conditions can be handled better. But, that is being left as an exercise for another day. Signed-off-by: NGene Czarcinski <gene@czarc.net> Signed-off-by: NLaine Stump <laine@laine.org>
-
- 08 4月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
The virNetlinkCommand() method takes an 'unsigned char **' parameter to be filled with the received netlink message. The callers then immediately cast this to 'struct nlmsghdr', triggering (bogus) warnings about increasing alignment requirements util/virnetdev.c: In function 'virNetDevLinkDump': util/virnetdev.c:1300:12: warning: cast increases required alignment of target type [-Wcast-align] resp = (struct nlmsghdr *)*recvbuf; ^ util/virnetdev.c: In function 'virNetDevSetVfConfig': util/virnetdev.c:1429:12: warning: cast increases required alignment of target type [-Wcast-align] resp = (struct nlmsghdr *)recvbuf; Since all callers cast to 'struct nlmsghdr' we can avoid the warning problem entirely by simply changing the signature of virNetlinkCommand to return a 'struct nlmsghdr **' instead of 'unsigned char **'. The way we do the cast inside virNetlinkCommand does not have any alignment issues. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 06 2月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Rename all the pciDeviceXXX and pciXXXDevice APIs to have a fixed virPCIDevice name prefix
-
- 21 12月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
-