Re: Bugs in ebtables-restore extension presence checks and other, suggestion for /proc interface

Peter Volkov <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <1191005879.21962.19.camel@localhost>
В Чтв, 20/09/2007 в 22:53 +0200, Lech Perczak пишет:   
> Your patch works for me. At the time Gentoo script uses manual config,
> but maybe we can simply fall back for managing every of 3 tables. I've
> modified ebtables-save script for getting tables names from
> command-line, and then falling back to grepping /proc/modules stuff. I
> think the /proc interface will be just nice, but you don't need to hurry
> with it. Patch and files are available on
> http://bugs.gentoo.org/show_bug.cgi?id=189315. I'd like to hear what
> Peter thinks about the thing, but I think we're pretty done by now.

Well, I'd say with some typo fixes and patch you posted in our bugzilla
(attached here too) init script is working here too and I'm going to
commit it now. Thank you, Lech and Bart, for your work.

-- 
Peter.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Ebtables-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ebtables-devel
ebtables-2.0.8.1-ebt-save.diff (text/x-patch, 1.1 KB)
--- ./ebtables-save.orig	2007-09-28 22:50:35.000000000 +0400
+++ ./ebtables-save	2007-09-28 22:51:22.000000000 +0400
@@ -12,6 +12,7 @@
 my $cnt = "";
 my $version = "1.0";
 my $table_name;
+my @table_names;
 
 # ========================================================
 # Process filter table
@@ -49,12 +50,19 @@
 }
 # ========================================================
 
+if ($#ARGV + 1 == 0) {
+   @table_names =split("\n", `grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//`);
+}
+else {
+   @table_names = @ARGV;
+}
+# ========================================================
 unless (-x $ebtables) { exit -1 };
 print "# Generated by ebtables-save v$version on " . `date`;
 if (defined($ENV{'EBTABLES_SAVE_COUNTER'}) && $ENV{'EBTABLES_SAVE_COUNTER'} eq "yes") {
     $cnt = "--Lc";
 }
-foreach $table_name (split("\n", `grep -E '^ebtable_' /proc/modules | cut -f1 -d' ' | sed s/ebtable_//`)) {
+foreach $table_name (@table_names) {
     $table =`$ebtables -t $table_name -L $cnt`;
     unless ($? == 0) { print $table; exit -1 };
     &process_table($table);
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG/U6wz6tlgEWSarMRAnpWAJ9IzHYqdPTH0mi4fepRbg7pUIL/4gCgiX+B
6w9bRgzxORRzRZLipyrY/bs=
=dE4a
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.