- 18 5月, 2017 1 次提交
-
- 04 4月, 2017 1 次提交
-
-
由 Ján Tomko 提交于
Similar to commit b202c39a ignore the warning that breaks the build with clang: util/virnetlink.c:365:52: error: cast from 'char *' to 'struct nlmsghdr *' increases required alignment from 1 to 4 [-Werror,-Wcast-align] for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) { ^~~~~~~~~~~~~~~~~~~~ /usr/include/linux/netlink.h:87:7: note: expanded from macro 'NLMSG_NEXT' (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- 22 3月, 2017 2 次提交
-
-
由 Cédric Bosdonnat 提交于
virNetlinkCommand() processes only one response message, while some netlink commands, like route dumping, need to process several. Add virNetlinkDumpCommand() as a virNetlinkCommand() sister.
-
由 Cédric Bosdonnat 提交于
Allow to reuse as much as possible from virNetlinkCommand(). This comment prepares for the introduction of virNetlinkDumpCommand() only differing by how it handles the responses.
-
- 27 6月, 2016 1 次提交
-
-
由 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.
-
- 22 6月, 2016 1 次提交
-
- 27 1月, 2016 1 次提交
-
-
由 Leno Hou 提交于
In the following cases nl_recv() was returning the error "No buffer space available": * When switching CPUs to offline/online in a system more than 128 cpus * When using virsh to destroy domain in a system with many interfaces This patch sets the buffer size for all netlink sockets created by libnl to 128K and turns on message peeking for nl_recv(). This eliminates the "No buffer space available" errors seen in the cases above, and also preempts other future errors the smaller buffers could have caused. Signed-off-by: NLeno Hou <houqy@linux.vnet.ibm.com> Signed-off-by: NLaine Stump <laine@laine.org>
-
- 29 10月, 2015 1 次提交
-
-
由 Maxim Perevedentsev 提交于
Such messages do not have NLMSG_ERROR or NLMSG_DONE type but they are valid responses. We test 'multi-partness' by looking for NLM_F_MULTI flag.
-
- 29 8月, 2015 1 次提交
-
-
由 Laine Stump 提交于
commit 09778e09 switched from using ioctl(SIOCBRDELBR) for bridge device deletion to using a netlink RTM_DELLINK message, which is the more modern way to delete a bridge (and also doesn't require the bridge to be ~IFF_UP to succeed). However, although older kernels (e.g. 2.6.32, in RHEL6/CentOS6) support deleting *some* link types with RTM_NEWLINK, they don't support deleting bridges, and there is no compile-time way to figure this out. This patch moves the body of the SIOCBRDELBR version of virNetDevBridgeDelete() into a static function, calls the new function from the original, and also calls the new function from the RTM_DELLINK version if the RTM_DELLINK message generates an EOPNOTSUPP error. Since RTM_DELLINK is done from the subordinate function virNetlinkDelLink, which is also called for other purposes (deleting a macvtap interface), a function pointer called "fallback" has been added to the arglist of virNetlinkDelLink() - if that arg != NULL, the provided function will be called when (and only when) RTM_DELLINK fails with EOPNOTSUPP. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1252780 (part 2)
-
- 27 3月, 2015 2 次提交
-
-
由 Pavel Hrdina 提交于
Commint 0473b45c introduced new function virNetlinkDelLink, but in it's counterpart for non-linux platform there should be ATTRIBUTE_UNUSED instead of ATTRIBUTE_UNSUPPORTED. Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
由 Laine Stump 提交于
libvirt has always used the netlink RTM_DELLINK message to delete macvtap/macvlan devices, but it can actually be used to delete other types of network devices, such as bonds and bridges. This patch makes virNetDevMacVLanDelete() available as a generic function so it can intelligibly be called to delete these other types of interfaces.
-
- 06 1月, 2015 2 次提交
-
-
由 Eric Blake 提交于
Commit 4dc04d3a added virNetlinkGetErrorCode, but forgot to provide a fallback, which kills the build on mingw (among others): CCLD libvirt.la Cannot export virNetlinkGetErrorCode: symbol not defined collect2: error: ld returned 1 exit status * src/util/virnetlink.c (virNetlinkGetErrorCode): Provide fallback. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Cédric Bosdonnat 提交于
Add a default implementation of virNetDevSetIPv4Address using netlink and libnl. This avoids requiring /usr/sbin/ip or /usr/sbin/ifconfig external binaries.
-
- 29 10月, 2014 1 次提交
-
-
由 Eric Blake 提交于
C guarantees that static variables are zero-initialized. Some older compilers (and also gcc -fno-zero-initialized-in-bss) create larger binaries if you explicitly zero-initialize a static variable. * src/libvirt.c: Fix initialization. * src/util/viralloc.c: Likewise. * src/util/virdbus.c: Likewise. * src/util/virevent.c: Likewise. * src/util/virfile.c (safezero): Likewise. * src/util/virlog.c: Likewise. * src/util/virnetlink.c: Likewise. * src/util/virthread.h (VIR_ONCE_GLOBAL_INIT): Likewise. * src/util/virprocess.c (virProcessGetStartTime): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 20 5月, 2014 1 次提交
-
-
由 Laine Stump 提交于
Inspired by a simpler patch from "Wangrui (K) <moon.wangrui@huawei.com>". A submitted patch pointed out that virNetlinkCommand() was doing an improper typecast of the return value from nl_recv() (int to unsigned), causing it to miss error returns, and that even after remedying that problem, virNetlinkCommand() was calling VIR_FREE() on the pointer returned from nl_recv() (*resp) even if nl_recv() had returned an error, and that in this case the pointer was verifiably invalid, as it was pointing to memory that had been allocated by libnl, but then freed prior to returning the error. While reviewing this patch, I noticed several other problems with this seemingly simple function (at least one of them as serious as the problem being reported/fixed by the aforementioned patch), and decided they all deserved to be fixed. Here is the list: 1) The return value from nl_recv() must be assigned to an int (rather than unsigned int) in order to detect failure. 2) When nl_recv() returns an error or 0, the contents of *resp is invalid, and should be simply set to 0, *not* VIR_FREE()'d. 3) When nl_recv() returns 0, errno is not set, so the logged error message should not reference errno (it *is* an error though). 4) The first error return from virNetlinkCommand returns -EINVAL, incorrectly implying that the caller can expect the return value to be of the "-errno" variety, which is not true in any other case. 5) The 2nd error return returns directly with garbage in *resp. While the caller should never use *resp in this case, it's still good practice to set it to NULL. 6) For the next 5 (!!) error conditions, *resp will contain garbage, and virNetlinkCommand() will goto it's cleanup code which will VIR_FREE(*resp), almost surely leading to a segfault. In addition to fixing these 6 problems, this patch also makes the following two changes to make the function conform more closely to the style of other libvirt code: 1) Change the handling of return code from "named rc and defaulted to 0, but changed to -1 on error" to the more common "named ret and defaulted to -1, but changed to 0 on success". 2) Rename the "error" label to "cleanup", since the code that follows is executed in success cases as well as failure.
-
- 25 3月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
-
- 18 3月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
Any source file which calls the logging APIs now needs to have a VIR_LOG_INIT("source.name") declaration at the start of the file. This provides a static variable of the virLogSource type. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 21 11月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/util/vircommand.c: Consistently use commas. * src/util/virlog.c: Likewise. * src/util/virnetdevbandwidth.c: Likewise. * src/util/virnetdevmacvlan.c: Likewise. * src/util/virnetdevvportprofile.c: Likewise. * src/util/virnetlink.c: Likewise. * src/util/virpci.c: Likewise. * src/util/virsysinfo.c: Likewise. * src/util/virusb.c: Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 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>
-
- 11 7月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 10 7月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 14 5月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Use of the select() system call is inherantly dangerous since applications will hit a buffer overrun if any FD number exceeds the size of the select set size (typically 1024). Replace the two uses of select() with poll() and use cfg.mk to ban any future use of select(). NB: This changes the phyp driver so that it uses an infinite timeout, instead of busy-waiting for 1ms at a time. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 16 4月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
The second param of virNetlinkCommand should be struct nlmsghdr, not unsigned char. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 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>
-
- 21 12月, 2012 4 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
- 21 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
-
- 22 8月, 2012 3 次提交
-
-
由 Daniel P. Berrange 提交于
The virNetlinkEventAddClient / virNetlinkEventRemoveClient stub impls had syntax errors in their parameter lists, using a ')' after the second-to-last parameter instead of a ',' Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Tang Chen 提交于
This patch introduce virNetlinkEventServiceStopAll() to stop all the monitors to receive netlink messages for libvirtd. Signed-off-by: NTang Chen <tangchen@cn.fujitsu.com>
-
由 Tang Chen 提交于
This patch improve all the API in virnetlink.c to support all kinds of netlink protocols, and make all netlink sockets be able to join in groups. Signed-off-by: NTang Chen <tangchen@cn.fujitsu.com>
-
- 23 7月, 2012 1 次提交
-
-
由 Osier Yang 提交于
Per the FSF address could be changed from time to time, and GNU recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html) You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. This patch removes the explicit FSF address, and uses above instead (of course, with inserting 'Lesser' before 'General'). Except a bunch of files for security driver, all others are changed automatically, the copyright for securify files are not complete, that's why to do it manually: src/security/security_selinux.h src/security/security_driver.h src/security/security_selinux.c src/security/security_apparmor.h src/security/security_apparmor.c src/security/security_driver.c
-
- 19 7月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Detected on Cygwin. Broken in commit 387117ad. * src/util/virnetdev.c (virNetDevValidateConfig) (virNetDevReplaceNetConfig): Fix prototypes. * src/util/virnetlink.c (virNetlinkEventAddClient) (virNetlinkEventRemoveClient): Likewise.
-
- 18 7月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
This removes nearly all the per-file error reporting macros from the code in src/util/. A few custom macros remain for the case, where the file needs to report errors with a variety of different codes or parameters Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 17 7月, 2012 1 次提交
-
-
由 Stefan Berger 提交于
Introduce new members in the virMacAddr 'class' - virMacAddrSet: set virMacAddr from a virMacAddr - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer - virMacAddrCmp: comparing two virMacAddr - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer then replace raw MAC addresses by replacing - 'unsigned char *' with virMacAddrPtr - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr and introduce usage of above functions where necessary.
-
- 15 6月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
To facilitate future troubleshooting add a bunch more debugging statements into important startup parts of libvirt
-
- 24 5月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The libvirt_private.syms file exports virNetlinkEventServiceLocalPid so there needs to be a no-op stub for Win32 to avoid linker errors Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 09 5月, 2012 1 次提交
-
-
由 Jiri Denemark 提交于
Commit 64297313 added three direct references to nl_handle_* instead of using our aliases which hide differences between libnl-3 and libnl-1.
-
- 08 5月, 2012 1 次提交
-
-
由 Laine Stump 提交于
This value will be needed to set the src_pid when sending netlink messages to lldpad. It is part of the solution to: https://bugzilla.redhat.com/show_bug.cgi?id=816465 Note that libnl's port generation algorithm guarantees that the nl_socket_get_local_port() will always be > 0 (since it is "getpid() + (n << 22>" where n is always < 1024), so it is okay to cast the uint32_t to int (thus allowing us to use -1 as an error sentinel).
-