Skip to contentSkip to conversation

p-o-m-ng patch

PATCH Eric Leblond 4 participants 6 messages Feb 20, 2004 – Feb 26, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

The best match code has a problem with selection of best directory when initiating patchlet. Existence of a best directory was sufficient to decide to choose this directory even if it is empty.
I attach a patch to Netfilter_POM.pm that solves the problem.

BR,

Signature · 2 lines
Eric Leblond
NuFW, Now User Filtering Works (http://www.nufw.org)
Netfilter_POM.pm.new renamed from Netfilter_POM.pm +6 -3
@@ -224,9 +224,11 @@
 					: version_compare($ver, "==", $version{$proj});
 				if ($match && $match > $bingo) {
 					$bingo = $match;
+                                        if (($type eq "patch") or (scalar @{$$patchlet{$type}{$proj}{$ver}})){
 					$$patchlet{$type}{$proj}{best} =
 						$$patchlet{$type}{$proj}{$ver};
 					$$patchlet{$type}{$proj}{best_prefix} = $ver ? "-$ver" : '';
+                                        }
 				}
 			}
 			if ($bingo < 0) {
@@ -515,7 +517,7 @@
 	my $lookingfor;
 
 	if (!open(LADD, $laddir.'/'.$laddfile)) {
-		$ERRMSG = "unable to open ladd $laddfile";
+		$ERRMSG = "unable to open ladd $laddir/$laddfile";
 		return 0;
 	}
 
@@ -533,7 +535,7 @@
 
 	if (!open(SRC, $kerneldir.'/'.$srcfile)) {
 		close(LADD);
-		$ERRMSG = "unable to open ladd src $srcfile";
+		$ERRMSG = "unable to open ladd src $kerneldir/$srcfile";
 		return 0;
 	}
 
@@ -690,6 +692,7 @@
 	for my $file (@{$$patchlet{ladds}{$proj}{best}}) {
 		my $destdir = ($projdir . "/" . File::Basename::dirname($file));
 		my $basename = File::Basename::basename($file);
+
 		if ($proj eq 'linux') {
 			if ($version{'linux'} =~ /^2\.4\.\d+/ &&
 			    $basename =~ /^Kconfig/) {
@@ -705,7 +708,7 @@
 		#		die("unable to mkpath($destdir): $!\n");
 		#}
 		if (!apply_lineadd($patchlet, $file,
-				   $$patchlet{basedir}.'/'.$proj.$$patchlet{files}{$proj}{best_prefix}.'/', 
+				   $$patchlet{basedir}.'/'.$proj.$$patchlet{ladds}{$proj}{best_prefix}.'/', 
 				   $projdir, $revert, $test)) {
 			# don't override $ERRMSG
 			return 0;
#1 lore raw

Some adjustement, this patch does not solve the issue of Documentation/Configure.help.ladd in the CONNMARK patch. This ladd should not be applied if we're compiling a 2.6 kernel.

I resend a corrected version.

BR,

Quoted 8 lines · Eric Leblond

Hi,

The best match code has a problem with selection of best directory when initiating patchlet. Existence of a best directory was sufficient to decide to choose this directory even if it is empty.
I attach a patch to Netfilter_POM.pm that solves the problem.

BR,

Signature · 2 lines
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)
Netfilter_POM.pm.new renamed from Netfilter_POM.pm +7 -4
@@ -224,9 +224,11 @@
 					: version_compare($ver, "==", $version{$proj});
 				if ($match && $match > $bingo) {
 					$bingo = $match;
+                                        if (($type eq "patch") or (scalar @{$$patchlet{$type}{$proj}{$ver}})){
 					$$patchlet{$type}{$proj}{best} =
 						$$patchlet{$type}{$proj}{$ver};
 					$$patchlet{$type}{$proj}{best_prefix} = $ver ? "-$ver" : '';
+                                        }
 				}
 			}
 			if ($bingo < 0) {
@@ -515,7 +517,7 @@
 	my $lookingfor;
 
 	if (!open(LADD, $laddir.'/'.$laddfile)) {
-		$ERRMSG = "unable to open ladd $laddfile";
+		$ERRMSG = "unable to open ladd $laddir/$laddfile";
 		return 0;
 	}
 
@@ -533,7 +535,7 @@
 
 	if (!open(SRC, $kerneldir.'/'.$srcfile)) {
 		close(LADD);
-		$ERRMSG = "unable to open ladd src $srcfile";
+		$ERRMSG = "unable to open ladd src $kerneldir/$srcfile";
 		return 0;
 	}
 
@@ -690,13 +692,14 @@
 	for my $file (@{$$patchlet{ladds}{$proj}{best}}) {
 		my $destdir = ($projdir . "/" . File::Basename::dirname($file));
 		my $basename = File::Basename::basename($file);
+
 		if ($proj eq 'linux') {
 			if ($version{'linux'} =~ /^2\.4\.\d+/ &&
 			    $basename =~ /^Kconfig/) {
 			    	next;
 			}
 			if ($version{'linux'} =~ /^2\.6\.\d+/ &&
-			    $basename =~ /^Config\.in/) {
+			    ( ($basename =~ /^Config\.in/) or ($basename =~ /^Configure.help/ ))) {
 			    	next;
 			}
 		}
@@ -705,7 +708,7 @@
 		#		die("unable to mkpath($destdir): $!\n");
 		#}
 		if (!apply_lineadd($patchlet, $file,
-				   $$patchlet{basedir}.'/'.$proj.$$patchlet{files}{$proj}{best_prefix}.'/', 
+				   $$patchlet{basedir}.'/'.$proj.$$patchlet{ladds}{$proj}{best_prefix}.'/', 
 				   $projdir, $revert, $test)) {
 			# don't override $ERRMSG
 			return 0;
#2 lore raw

Sorry for the disturbance, I do a test from a clean 2.6.3 kernel tree and there's compilation problem with CONNMARK.

The best match now correctly found the best directory for each type (patch,file,ladd) but in the CONNMARK patch the files are split between the 2 directories (linux linux-2.6). So we miss a subset of the files. So my question :
- Do we change p-o-m-ng or do we change CONNMARK patch ?
BR,

Quoted 17 lines · Eric Leblond

Some adjustement, this patch does not solve the issue of Documentation/Configure.help.ladd in the CONNMARK patch. This ladd should not be applied if we're compiling a 2.6 kernel.

I resend a corrected version.

BR,

Quoted 8 lines · Eric Leblond

Hi,

The best match code has a problem with selection of best directory when initiating patchlet. Existence of a best directory was sufficient to decide to choose this directory even if it is empty.
I attach a patch to Netfilter_POM.pm that solves the problem.

BR,

Signature · 2 lines
Eric Leblond
Nufw, Now User Filtering Works (http://www.nufw.org)
#3 lore raw
Quoted 8 lines · Eric Leblond

Sorry for the disturbance, I do a test from a clean 2.6.3 kernel tree and there's compilation problem with CONNMARK.

The best match now correctly found the best directory for each type (patch,file,ladd) but in the CONNMARK patch the files are split between the 2 directories (linux linux-2.6). So we miss a subset of the files. So my question :
- Do we change p-o-m-ng or do we change CONNMARK patch ?

we need to change p-o-m. Actually this issue doesn't only effect
CONNMARK, but almost all patches by now.

Most of them share a common Makefile.ladd, a common ipt_whatever.h and maybe even a common linux.patch - but they have differetn ipt_whatever.c files, since the syntax of struct ipt_{match,target} is slightly different in both kernels [by intention].

So we need to iterate over all files in all linux* subdirectories and build a list of 'best matches' for every single file.

Quoted 1 line

BR,

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#4 lore raw
Quoted 10 lines · Harald Welte
Quoted 8 lines · Eric Leblond

Sorry for the disturbance, I do a test from a clean 2.6.3 kernel tree and there's compilation problem with CONNMARK.

The best match now correctly found the best directory for each type (patch,file,ladd) but in the CONNMARK patch the files are split between the 2 directories (linux linux-2.6). So we miss a subset of the files. So my question :
- Do we change p-o-m-ng or do we change CONNMARK patch ?

Quoted 7 lines

we need to change p-o-m. Actually this issue doesn't only effect
CONNMARK, but almost all patches by now.

Most of them share a common Makefile.ladd, a common ipt_whatever.h and maybe even a common linux.patch - but they have differetn ipt_whatever.c files, since the syntax of struct ipt_{match,target} is slightly different in both kernels [by intention].

I believe we should change the CONNMARK and all other patches instead and both the linux (i.e linux-2.4) and linux-2.6 trees should contain all required files for the given versions. The structure were less error-prone, maintenance and Netfilter_POM.pm were simpler.

The best match algorithm should not descend into subdirectories, otherwise Netfilter_POM.pm would catch whole files/ladds in an earlier release as best match when that file were intentionally missing in later releases.

I think other modifications in pom-ng are required as well. The current best match algorithm is too strict. Presently

linux-2.6 initial release, matches anyting above 2.6
linux-2.6.5 currently matches only 2.6.5

But linux-2.6.5 should match 2.6.5 and anything *above* 2.6.5 as well.

I also suggest that let us tightly integrate netfilter and iptables into pom-ng. What I mean is that the feature patches have (always) got two parts: kernel module for netfilter and shared library for iptables. Let's start to store the shared libary part in pom-ng and not in the source of iptables:

	CONNMARK/iptables/extensions/.connmark-test (just as example)
	CONNMARK/iptables/extensions/libipt_connmark.c
	CONNMARK/iptables/extensions/libipt_connmark.man.ladd
	...

As a result, pom-ng would truly hold every required bit for a patch and iptables releases could be independent from pom-ng additions.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#5 lore raw
Quoted 1 line · Jozsef Kadlecsik

But linux-2.6.5 should match 2.6.5 and anything *above* 2.6.5 as well.

unless obviously if there is a closer match.

Quoted 5 lines

I also suggest that let us tightly integrate netfilter and iptables into pom-ng. What I mean is that the feature patches have (always) got two parts: kernel module for netfilter and shared library for iptables. Let's start to store the shared libary part in pom-ng and not in the source of iptables:

This basically requires the module interface of iptables to be well defined, allowing packaging of iptables development files to build extension modules. I like this idea btw, would make the development process of an iptables extension much cleaner as it can then be written a trivial compile wrapper to compile iptables extensions from pom-ng without having to rebuild the whole of iptables.

People building static iptable binaries obviously would need to patch their iptables sources, but that is no problem either.

Regards
Henrik