[PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory

Laine Stump posted 27 patches 1 year, 9 months ago
There is a newer version of this series
[PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory
Posted by Laine Stump 1 year, 9 months ago
These functions are only ever used by the network driver, and are so
specific to the network driver's usage of iptables that they likely
won't ever be used elsewhere. The files are renamed to
network_iptables.[ch] to be more in line with driver-specific file
naming conventions.

Signed-off-by: Laine Stump <laine@redhat.com>
---
 po/POTFILES                                   |  2 +-
 src/libvirt_private.syms                      | 31 -------------------
 src/network/bridge_driver_linux.c             |  2 +-
 src/network/meson.build                       |  1 +
 .../network_iptables.c}                       |  7 +++--
 .../network_iptables.h}                       |  2 +-
 src/util/meson.build                          |  1 -
 7 files changed, 8 insertions(+), 38 deletions(-)
 rename src/{util/viriptables.c => network/network_iptables.c} (99%)
 rename src/{util/viriptables.h => network/network_iptables.h} (99%)

diff --git a/po/POTFILES b/po/POTFILES
index 6fbff4bef2..8b89fcf832 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -144,6 +144,7 @@ src/network/bridge_driver.c
 src/network/bridge_driver_conf.c
 src/network/bridge_driver_linux.c
 src/network/leaseshelper.c
+src/network/network_iptables.c
 src/node_device/node_device_driver.c
 src/node_device/node_device_udev.c
 src/nwfilter/nwfilter_dhcpsnoop.c
@@ -288,7 +289,6 @@ src/util/virhostmem.c
 src/util/virhostuptime.c
 src/util/viridentity.c
 src/util/virinitctl.c
-src/util/viriptables.c
 src/util/viriscsi.c
 src/util/virjson.c
 src/util/virlease.c
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 839fe4f545..e4fbb905d4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2573,37 +2573,6 @@ virIdentitySetX509DName;
 virInitctlFifos;
 virInitctlSetRunLevel;
 
-
-# util/viriptables.h
-iptablesAddDontMasquerade;
-iptablesAddForwardAllowCross;
-iptablesAddForwardAllowIn;
-iptablesAddForwardAllowOut;
-iptablesAddForwardAllowRelatedIn;
-iptablesAddForwardMasquerade;
-iptablesAddForwardRejectIn;
-iptablesAddForwardRejectOut;
-iptablesAddOutputFixUdpChecksum;
-iptablesAddTcpInput;
-iptablesAddTcpOutput;
-iptablesAddUdpInput;
-iptablesAddUdpOutput;
-iptablesRemoveDontMasquerade;
-iptablesRemoveForwardAllowCross;
-iptablesRemoveForwardAllowIn;
-iptablesRemoveForwardAllowOut;
-iptablesRemoveForwardAllowRelatedIn;
-iptablesRemoveForwardMasquerade;
-iptablesRemoveForwardRejectIn;
-iptablesRemoveForwardRejectOut;
-iptablesRemoveOutputFixUdpChecksum;
-iptablesRemoveTcpInput;
-iptablesRemoveTcpOutput;
-iptablesRemoveUdpInput;
-iptablesRemoveUdpOutput;
-iptablesSetupPrivateChains;
-
-
 # util/viriscsi.h
 virISCSIConnectionLogin;
 virISCSIConnectionLogout;
diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_linux.c
index b8893bfed2..fd4bf7b61c 100644
--- a/src/network/bridge_driver_linux.c
+++ b/src/network/bridge_driver_linux.c
@@ -22,11 +22,11 @@
 #include <config.h>
 
 #include "virfile.h"
-#include "viriptables.h"
 #include "virstring.h"
 #include "virlog.h"
 #include "virfirewall.h"
 #include "virfirewalld.h"
+#include "network_iptables.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/network/meson.build b/src/network/meson.build
index eb171ae779..305e2d52fb 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -2,6 +2,7 @@ network_driver_sources = [
   'bridge_driver.c',
   'bridge_driver_conf.c',
   'bridge_driver_platform.c',
+  'network_iptables.c',
 ]
 
 driver_source_files += files(network_driver_sources)
diff --git a/src/util/viriptables.c b/src/network/network_iptables.c
similarity index 99%
rename from src/util/viriptables.c
rename to src/network/network_iptables.c
index 018021bc1b..bf6e3065f5 100644
--- a/src/util/viriptables.c
+++ b/src/network/network_iptables.c
@@ -1,5 +1,5 @@
 /*
- * viriptables.c: helper APIs for managing iptables
+ * network_iptables.c: helper APIs for managing iptables in network driver
  *
  * Copyright (C) 2007-2014 Red Hat, Inc.
  *
@@ -27,13 +27,14 @@
 #include <sys/stat.h>
 
 #include "internal.h"
-#include "viriptables.h"
 #include "virfirewalld.h"
 #include "virerror.h"
 #include "virlog.h"
 #include "virhash.h"
+#include "virenum.h"
+#include "network_iptables.h"
 
-VIR_LOG_INIT("util.iptables");
+VIR_LOG_INIT("network.iptables");
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/viriptables.h b/src/network/network_iptables.h
similarity index 99%
rename from src/util/viriptables.h
rename to src/network/network_iptables.h
index bb13f3292d..bfb6bbe0e7 100644
--- a/src/util/viriptables.h
+++ b/src/network/network_iptables.h
@@ -1,5 +1,5 @@
 /*
- * viriptables.h: helper APIs for managing iptables
+ * network_iptables.h: helper APIs for managing iptables in network driver
  *
  * Copyright (C) 2007, 2008 Red Hat, Inc.
  *
diff --git a/src/util/meson.build b/src/util/meson.build
index c2175f1098..896c795150 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -46,7 +46,6 @@ util_sources = [
   'virhostuptime.c',
   'viridentity.c',
   'virinitctl.c',
-  'viriptables.c',
   'viriscsi.c',
   'virjson.c',
   'virkeycode.c',
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory
Posted by Daniel P. Berrangé 1 year, 9 months ago
On Sun, Apr 21, 2024 at 10:53:09PM -0400, Laine Stump wrote:
> These functions are only ever used by the network driver, and are so
> specific to the network driver's usage of iptables that they likely
> won't ever be used elsewhere. The files are renamed to
> network_iptables.[ch] to be more in line with driver-specific file
> naming conventions.
> 
> Signed-off-by: Laine Stump <laine@redhat.com>
> ---
>  po/POTFILES                                   |  2 +-
>  src/libvirt_private.syms                      | 31 -------------------
>  src/network/bridge_driver_linux.c             |  2 +-
>  src/network/meson.build                       |  1 +
>  .../network_iptables.c}                       |  7 +++--
>  .../network_iptables.h}                       |  2 +-
>  src/util/meson.build                          |  1 -
>  7 files changed, 8 insertions(+), 38 deletions(-)
>  rename src/{util/viriptables.c => network/network_iptables.c} (99%)
>  rename src/{util/viriptables.h => network/network_iptables.h} (99%)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

with one question below...

> diff --git a/src/util/viriptables.c b/src/network/network_iptables.c
> similarity index 99%
> rename from src/util/viriptables.c
> rename to src/network/network_iptables.c
> index 018021bc1b..bf6e3065f5 100644
> --- a/src/util/viriptables.c
> +++ b/src/network/network_iptables.c
> @@ -1,5 +1,5 @@
>  /*
> - * viriptables.c: helper APIs for managing iptables
> + * network_iptables.c: helper APIs for managing iptables in network driver
>   *
>   * Copyright (C) 2007-2014 Red Hat, Inc.
>   *
> @@ -27,13 +27,14 @@
>  #include <sys/stat.h>
>  
>  #include "internal.h"
> -#include "viriptables.h"
>  #include "virfirewalld.h"
>  #include "virerror.h"
>  #include "virlog.h"
>  #include "virhash.h"
> +#include "virenum.h"

Presume this virenum.h addition is an accident, that should be in a
later commit ?

> +#include "network_iptables.h"
>  
> -VIR_LOG_INIT("util.iptables");
> +VIR_LOG_INIT("network.iptables");
>  
>  #define VIR_FROM_THIS VIR_FROM_NONE
>  

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [PATCH v2 01/27] util/network: move viriptables.[ch] from util to network directory
Posted by Laine Stump 1 year, 9 months ago
On 4/23/24 5:52 AM, Daniel P. Berrangé wrote:
> On Sun, Apr 21, 2024 at 10:53:09PM -0400, Laine Stump wrote:
>> These functions are only ever used by the network driver, and are so
>> specific to the network driver's usage of iptables that they likely
>> won't ever be used elsewhere. The files are renamed to
>> network_iptables.[ch] to be more in line with driver-specific file
>> naming conventions.
>>
>> Signed-off-by: Laine Stump <laine@redhat.com>
>> ---
>>   po/POTFILES                                   |  2 +-
>>   src/libvirt_private.syms                      | 31 -------------------
>>   src/network/bridge_driver_linux.c             |  2 +-
>>   src/network/meson.build                       |  1 +
>>   .../network_iptables.c}                       |  7 +++--
>>   .../network_iptables.h}                       |  2 +-
>>   src/util/meson.build                          |  1 -
>>   7 files changed, 8 insertions(+), 38 deletions(-)
>>   rename src/{util/viriptables.c => network/network_iptables.c} (99%)
>>   rename src/{util/viriptables.h => network/network_iptables.h} (99%)
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> with one question below...
> 
>> diff --git a/src/util/viriptables.c b/src/network/network_iptables.c
>> similarity index 99%
>> rename from src/util/viriptables.c
>> rename to src/network/network_iptables.c
>> index 018021bc1b..bf6e3065f5 100644
>> --- a/src/util/viriptables.c
>> +++ b/src/network/network_iptables.c
>> @@ -1,5 +1,5 @@
>>   /*
>> - * viriptables.c: helper APIs for managing iptables
>> + * network_iptables.c: helper APIs for managing iptables in network driver
>>    *
>>    * Copyright (C) 2007-2014 Red Hat, Inc.
>>    *
>> @@ -27,13 +27,14 @@
>>   #include <sys/stat.h>
>>   
>>   #include "internal.h"
>> -#include "viriptables.h"
>>   #include "virfirewalld.h"
>>   #include "virerror.h"
>>   #include "virlog.h"
>>   #include "virhash.h"
>> +#include "virenum.h"
> 
> Presume this virenum.h addition is an accident, that should be in a
> later commit ?

Yes. I had moved around the order of the patches (actually created this 
branch by cherry-picking some patches from the old branch in a very 
different order, interspersed with new patches as well as not bring in 
several of the old patches). Anyway, this was the result of all that.

Thanks for your close scrutiny!
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org