- 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 3 次提交
-
-
由 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).
-
由 Laine Stump 提交于
Until now, virNetlinkCommand has assumed that the nl_pid in the source address of outgoing netlink messages should always be the return value of getpid(). In most cases it actually doesn't matter, but in the case of communication with lldpad, lldpad saves this info and later uses it to send netlink messages back to libvirt. A recent patch to fix Bug 816465 changed the order of the universe such that the netlink event service socket is no longer bound with nl_pid == getpid(), so lldpad could no longer send unsolicited messages to libvirtd. Adding src_pid as an argument to virNetlinkCommand() is the first step in notifying lldpad of the proper address of the netlink event service socket.
-
由 Laine Stump 提交于
This is part of the solution to the problem detailed in: https://bugzilla.redhat.com/show_bug.cgi?id=816465 and further detailed in https://www.redhat.com/archives/libvir-list/2012-May/msg00202.htm A short explanation is included in the comments of the patch itself. Note that this patch by itself breaks communication between lldpad and libvirtd, so the other 3 patches in the series must be applied at the same time as this patch.
-
- 05 5月, 2012 1 次提交
-
-
由 Laine Stump 提交于
These two functions are called from main() on all platforms, and always return success on platforms that don't support libnl. They still log an error message, though, which doesn't make sense - they should just be NOPs on those platforms. (Per a suggestion during review, I've turned the logs into debug messages rather than removing them completely).
-
- 04 5月, 2012 2 次提交
-
-
由 Osier Yang 提交于
-
由 Serge Hallyn 提交于
configure.ac: check for libnl-3 in addition to libnl-1 src/Makefile.am: link against libnl when needed src/util/virnetlink.c: support libnl3 api. To minimize impact on code flow, wrap the differences under the virNetlink* namespace. Unfortunately libnl3 moves netlink/msg.h to /usr/include/libnl3/netlink/msg.h, so the LIBNL_CFLAGS need to be added to a bunch of places where they weren't needed with libnl1. Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 27 4月, 2012 1 次提交
-
-
由 Laine Stump 提交于
Some of the error messages in this function should have been virReportSystemError (since they have an errno they want to log), but were mistakenly written as netlinkError, which expects a libvirt error code instead. The result was that when one of the errors was encountered, "No error message provided" would be printed instead of something meaningful (see https://bugzilla.redhat.com/show_bug.cgi?id=816465 for an example).
-
- 27 3月, 2012 2 次提交
-
-
由 D. Herrendoerfer 提交于
When libvirtd is restarted, also restart the netlink event message callbacks for existing VEPA connections and send a message to lldpad for these existing links, so it learns the new libvirtd pid. Signed-off-by: ND. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
-
由 Martin Kletzander 提交于
Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
-
- 09 3月, 2012 1 次提交
-
-
由 Laine Stump 提交于
There are special stub versions of all public functions in this file that are compiled when either libnl isn't available or the platform isn't linux. Each of these functions had two almost identical message, differing only in the function name included in the message. Since log messages already contain the function name, we can just define a const char* with the common part of the string, and use that same string for all the log messages. Also, rather than doing #if defined ... #else ... #endif *inside the error log macro invocation*, this patch does #if defined ... just once, using it to decide which single string to define. This turns the error log in each function from 6 lines, to 1 line.
-
- 07 3月, 2012 1 次提交
-
-
由 Duncan Rance 提交于
I'm building on OSX with no libnl. I had to do this to get src/util/virnetlink.c to compile:
-
- 06 3月, 2012 1 次提交
-
-
由 Jim Fehlig 提交于
Commit e3ba4025 introduced a few build errors with HAVE_LIBNL undefined.
-