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

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



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


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