Re: [PATCH V13 2/5] nwfilter: add DHCP snooping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/25/2012 08:59 AM, Stefan Berger wrote:
+
+/*
+ * Create a new Snoop request. Initialize it with the given
+ * interface key. The caller must release the request with a call
+ * to virNWFilerSnoopReqPut(req).
+ */
+static virNWFilterSnoopReqPtr
+virNWFilterSnoopReqNew(const char *ifkey)
+{
+    virNWFilterSnoopReqPtr req;
+
+    if (ifkey == NULL || strlen(ifkey) != VIR_IFKEY_LEN - 1) {
+        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("virNWFilterSnoopReqNew called with invalid "
+                                 "key \"%s\" (%u)"),
+                               ifkey ? ifkey : "",
+                               (unsigned int)strlen(ifkey));
+        return NULL;
+    }
+
+    if (VIR_ALLOC(req)<  0) {
+        virReportOOMError();
+        return NULL;
+    }
+
+    virNWFilterSnoopReqGet(req);

In case someone wanted to try this out, the above line must be removed...

+
+    req->threadStatus = THREAD_STATUS_NONE;
+
+    if (virAtomicIntInit(&req->refctr)<  0 ||
+        virMutexInitRecursive(&req->lock)<  0 ||
+        virStrcpyStatic(req->ifkey, ifkey) == NULL ||
+        virCondInit(&req->threadStatusCond)<  0)
+        VIR_FREE(req);
+

...and the following inserted here.

    if (req)
        virNWFilterSnoopReqGet(req);


   Stefan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]