]> xenbits.xensource.com Git - libvirt.git/commitdiff
Pass additional parameter into applyDHCPOnly function
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 22 Nov 2011 20:59:26 +0000 (15:59 -0500)
committerStefan Berger <stefanb@us.ibm.com>
Tue, 22 Nov 2011 20:59:26 +0000 (15:59 -0500)
In preparation for the DHCP Snooping code:
Pass an additional parameter into the applyDHCPOnly function
of the 'techdriver'.

src/conf/nwfilter_conf.h
src/nwfilter/nwfilter_ebiptables_driver.c
src/nwfilter/nwfilter_learnipaddr.c

index 61923aa5a414c8e7afb784a024bb76759943b251..90162f63678e42e5522bf4313f89b9de85c10e50 100644 (file)
@@ -630,7 +630,8 @@ typedef int (*virNWFilterApplyBasicRules)(const char *ifname,
 
 typedef int (*virNWFilterApplyDHCPOnlyRules)(const char *ifname,
                                              const unsigned char *macaddr,
-                                             const char *dhcpserver);
+                                             const char *dhcpserver,
+                                             bool leaveTemporary);
 
 typedef int (*virNWFilterRemoveBasicRules)(const char *ifname);
 
index ef2ee679d407e3bcbd6ebd7ee115318bc9d974e3..434a9b04885a983412b2b9d78402cf701f8b72fe 100644 (file)
@@ -3191,6 +3191,9 @@ tear_down_tmpebchains:
  *    interface
  * @dhcpserver: The DHCP server from which the VM may receive traffic
  *    from; may be NULL
+ * @leaveTemporary: Whether to leave the table names with their temporary
+ *    names (true) or also perform the renaming to their final names as
+ *    part of this call (false)
  *
  * Returns 0 on success, 1 on failure with the rules removed
  *
@@ -3200,7 +3203,8 @@ tear_down_tmpebchains:
 static int
 ebtablesApplyDHCPOnlyRules(const char *ifname,
                            const unsigned char *macaddr,
-                           const char *dhcpserver)
+                           const char *dhcpserver,
+                           bool leaveTemporary)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char chain_in [MAX_CHAINNAME_LENGTH],
@@ -3281,8 +3285,11 @@ ebtablesApplyDHCPOnlyRules(const char *ifname,
 
     ebtablesLinkTmpRootChain(&buf, 1, ifname, 1);
     ebtablesLinkTmpRootChain(&buf, 0, ifname, 1);
-    ebtablesRenameTmpRootChain(&buf, 1, ifname);
-    ebtablesRenameTmpRootChain(&buf, 0, ifname);
+
+    if (!leaveTemporary) {
+        ebtablesRenameTmpRootChain(&buf, 1, ifname);
+        ebtablesRenameTmpRootChain(&buf, 0, ifname);
+    }
 
     if (ebiptablesExecCLI(&buf, NULL, NULL) < 0)
         goto tear_down_tmpebchains;
index d1e5648a22be113a44f4ffc56bb177de9358579a..6e066eeb5e61e7810b4075338f1be76bb8cb5dc4 100644 (file)
@@ -460,7 +460,7 @@ learnIPAddressThread(void *arg)
     case DETECT_DHCP:
         if (techdriver->applyDHCPOnlyRules(req->ifname,
                                            req->macaddr,
-                                           NULL)) {
+                                           NULL, false)) {
             req->status = EINVAL;
             goto done;
         }