Skip to contentSkip to conversation

Patch-o-matic says "unable to find ladd slot" in Makefile

PATCH In review Glen Turner 4 participants 9 messages Oct 4, 2006 – Oct 12, 2006 netfilter

lore
Share & tools
lore
#0 lore raw

Hi folks,

I've written a patch for the Linux kernel and for iptables which adds a TCPCONG netfilter target to set the TCP congestion control algorithm. Now I can run a different algorithm for traffic using the the WLAN interface than for traffic using the wired interface. Code at
<http://www.aarnet.edu.au/~gdt/patch/tcpcong/>

I've tried my best to follow the instructions at
.../patch-o-matic-ng/README.newpatches
which I think asks that a file
.../patch-o-matic-ng/patchlets/TCPCONG/linux-2.6/net/ipv4/netfilter/Makefile.ladd
be created containing
obj-$(CONFIG_IP_NF_TARGET_TCPCONG) += ipt_TCPCONG.o
rather than this being left in the
.../patch-o-matic-ng/patchlets/TCPCONG/linux-2.6.patch
file.

Unfortunately when I run patch-o-matic
KERNEL_DIR=~/linux-2.6.18 \
IPTABLES_DIR=~/iptables-1.3.6 \
./runme base
I get this error

Quoted 9 lines

Testing TCPCONG... not applied
The TCPCONG patch:
Author: Glen Turner, <glen d turner a aarnet d edu d au>
Status: Beta
This target sets the TCP congestion control algorithm.
-----------------------------------------------------------------
Do you want to apply this patch [N/y/t/f/a/r/b/w/q/?] y
unable to find ladd slot in src /home/gdt/linux-2.6.18/net/ipv4/netfilter/Makefile (./patchlets/TCPCONG/linux-2.6/./net/ipv4/netfilter/Makefile.ladd)
-----------------------------------------------------------------

Should I have left the change to net/ipv4/netfilter/Makefile in the file linux-2.6.patch? Or is some other magic required?

Thanks muchly,
Glen

Signature · 2 lines
 Glen Turner         Tel: (08) 8303 3936 or +61 8 8303 3936
 Australia's Academic & Research Network  www.aarnet.edu.au
#1 lore raw
Quoted 10 lines · Glen Turner

Hi folks,

I've written a patch for the Linux kernel and for iptables which adds a TCPCONG netfilter target to set the TCP congestion control algorithm. Now I can run a different algorithm for traffic using the the WLAN interface than for traffic using the wired interface. Code at
<http://www.aarnet.edu.au/~gdt/patch/tcpcong/>

Quoted 8 lines

I've tried my best to follow the instructions at
.../patch-o-matic-ng/README.newpatches
which I think asks that a file

.../patch-o-matic-ng/patchlets/TCPCONG/linux-2.6/net/ipv4/netfilter/Makefile.ladd

be created containing
obj-$(CONFIG_IP_NF_TARGET_TCPCONG) += ipt_TCPCONG.o

You have to add some context to let pom know where you want to place that line, for example:

:~/SVN/trunk/patch-o-matic-ng/patchlets/XOR/linux-2.6/net/ipv4/netfilter$
cat Makefile.ladd
obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o obj-$(CONFIG_IP_NF_TARGET_XOR) += ipt_XOR.o

This tells that the ipt_XOR must be after the ipt_LOG line.

Signature · 2 lines
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
#2 lore raw

PATCH 1/1 Add TCPCONG target to patch-o-matic

Hi folks,

I have created a kernel module and iptables shared library to allow netfilter to set the TCP congestion control algorithm.

This has three major uses: selecting differing algorithms for wired and non-wired interfaces; selecting differing algorithms for close and far hosts; and selecting differing algorithms for comparison testing.

Thanks to the hint from Pablo Neira Ayuso I have put this into the patch-o-matic format. This has been tested against iptables-1.3.6 and linux-2.6.18.

A SVN diff against patch-o-matic follows, which I'm hoping Thunderbird doesn't mangle. Since I'm not familiar with SVN please let me know if this isn't the desired patch format.

I would hope that this facility can become a standard part of the kernel and iptables. Please let me know what I need to do to follow that path.

Thanks,
Glen

TCPCONG/linux-2.6.patch +10 -0
Index: patchlets/TCPCONG/linux-2.6.patch
===================================================================
@@ -0,0 +1,10 @@
+--- linux-2.6.18/net/ipv4/tcp_cong.c	2006-09-20 13:12:06.000000000 +0930
++++ linux-2.6.18-new/net/ipv4/tcp_cong.c	2006-10-04 15:10:59.000000000 +0930
+@@ -172,6 +172,7 @@
+ 	rcu_read_unlock();
+ 	return err;
+ }
++EXPORT_SYMBOL_GPL(tcp_set_congestion_control);
+
+
+ /*
TCPCONG/linux-2.6/include/linux/netfilter_ipv4/ipt_TCPCONG.h +25 -0
Index: patchlets/TCPCONG/linux-2.6/include/linux/netfilter_ipv4/ipt_TCPCONG.h
===================================================================
@@ -0,0 +1,25 @@
+/* iptables module for setting the TCP congestion control algorithm.
+ *
+ * For information see net/ipv4/netfilter/ipt_TCPCONG.c.
+ *
+ * Copyright © Glen David Turner of Semaphore, South Australia, 2006.
+ * <http://www.aarnet.edu.au/~gdt/>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ */
+
+#ifndef _IPT_TCPCONG_TARGET_H
+#define _IPT_TCPCONG_TARGET_H
+
+/* Value from tcp.h, but this header needs to work for both kernel and user compile. */
+#define TCP_CA_NAME_MAX 16
+
+/* Target attributes */
+struct ipt_TCPCONG {
+	char algorithm_name[TCP_CA_NAME_MAX];
+};
+
+#endif /* _IPT_TCPCONG_TARGET_H */

Property changes on: patchlets/TCPCONG/linux-2.6/include/linux/netfilter_ipv4/ipt_TCPCONG.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native

TCPCONG/linux-2.6/net/ipv4/netfilter/Makefile.ladd +2 -0
Index: patchlets/TCPCONG/linux-2.6/net/ipv4/netfilter/Makefile.ladd
===================================================================
@@ -0,0 +1,2 @@
+obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
+obj-$(CONFIG_IP_NF_TARGET_TCPCONG) += ipt_TCPCONG.o
TCPCONG/linux-2.6/net/ipv4/netfilter/Kconfig.ladd +13 -0
Index: patchlets/TCPCONG/linux-2.6/net/ipv4/netfilter/Kconfig.ladd
===================================================================
@@ -0,0 +1,13 @@
+config IP_NF_TARGET_TCPCONG
+	tristate "TCP congeston control algorithm target support"
+	depends on TCP_CONG_ADVANCED
+	---help---
+	  This option adds a TCPCONG target. This allows the TCP
+	  congestion control algorithm to be selected from Netfilter.
+
+	  The TCPCONG target requires the kernel compilation option
+	  TCP_CONG_ADVANCED, which can be found at Networking |
+	  Networking support | Networking options | TCP/IP networking |
+	  TCP: advanced congestion control.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
TCPCONG/linux-2.6/net/ipv4/netfilter/ipt_TCPCONG.c +125 -0

125 lines not on this page · raw message

Property changes on: patchlets/TCPCONG/linux-2.6/net/ipv4/netfilter/ipt_TCPCONG.c
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native

TCPCONG/iptables/extensions/libipt_TCPCONG.c +279 -0

279 lines not on this page · raw message

Property changes on: patchlets/TCPCONG/iptables/extensions/libipt_TCPCONG.c
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native

TCPCONG/iptables/extensions/.TCPCONG-test +2 -0
Index: patchlets/TCPCONG/iptables/extensions/.TCPCONG-test
===================================================================
@@ -0,0 +1,2 @@
+#!/bin/sh
+[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_TCPCONG.c ] && echo TCPCONG

Property changes on: patchlets/TCPCONG/iptables/extensions/.TCPCONG-test
___________________________________________________________________
Name: svn:executable
+ *

TCPCONG/iptables/extensions/libipt_TCPCONG.man +123 -0

123 lines not on this page · raw message

TCPCONG/help +3 -0
Index: patchlets/TCPCONG/help
===================================================================
@@ -0,0 +1,3 @@
+
+This target sets the TCP congestion control algorithm.
+
TCPCONG/info +10 -0
Index: patchlets/TCPCONG/info
===================================================================
@@ -0,0 +1,10 @@
+Title:		Sets TCP congestion control algorithm
+Author:		Glen Turner, <[email protected]>
+Status:		Beta
+Repository:	base
+Requires:	linux-2.6 >= 2.6.13
+Requires:	linux-2.6.patch >= 2.6.13
+Recompile:	kernel
+Recompile:	iptables
+
+Target to set TCP congestion control algorithm.
sources.list +3 -0
Index: sources.list
===================================================================
@@ -9,3 +9,6 @@
 
 # ipp2p, time, IPMARK and connlimit maintained by Krzysztof Oledzki <[email protected]>
 http://people.netfilter.org/ole/pom/
+
+# TCPCONG maintained by Glen Turner <[email protected]>
+http://www.aarnet.edu.au/~gdt/patch/tcpcong/
#3 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 16 lines · Glen Turner

Hi folks,

I have created a kernel module and iptables shared library to allow netfilter to set the TCP congestion control algorithm.

This has three major uses: selecting differing algorithms for wired and non-wired interfaces; selecting differing algorithms for close and far hosts; and selecting differing algorithms for comparison testing.

Thanks to the hint from Pablo Neira Ayuso I have put this into the patch-o-matic format. This has been tested against iptables-1.3.6 and linux-2.6.18.

Quoted 7 lines

A SVN diff against patch-o-matic follows, which I'm hoping Thunderbird doesn't mangle. Since I'm not familiar with SVN please let me know if this isn't the desired patch format.

I would hope that this facility can become a standard part of the kernel and iptables. Please let me know what I need to do to follow that path.

I don't think iptables is the right place to do this. It should be controllable through routing IMO (which can already control some aspects of congestion control).

#4 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 3 lines · Patrick McHardy

I don't think iptables is the right place to do this. It should be controllable through routing IMO (which can already control some aspects of congestion control).

I too think the choice should usually be done through routing, with the route holding the preferred congestion control algorithm for traffic with that prefix. Whereas now the preferred algorithm is read from a global parameter.

But the algorithm for a particular connection should still be able to be changed through iptables.

Firstly, not every application can be easily altered to use setsockopt() to select a differing algorithm from the default. This is the argument used for the TCPMSS and similar targets. As the range of congestion control algorithms grows sysadmins will want to choose differing algorithms for differing applications. For example, most algorithm's Ack strategies interact poorly with transactional and remote procedure call traffic, so choosing an algorithm which handles this well could make, say, NFS over TCP traffic run a lot faster.

Secondly, I want to make it easy for kernel and protocol developers to run differing algorithms on differing port numbers to test inter-algorithm fairness. Some TCP algorithms are quite unfair -- unable even to share a link 50:50 between two identical flows started a few seconds apart. A TCPCONG target makes it much easier to do this testing. Now that the kernel developers are getting good performance on long fat pipes the fairness and other attributes of that performance will be their next concern.

Hope this helps,
Glen

Signature · 2 lines
 Glen Turner         Tel: (08) 8303 3936 or +61 8 8303 3936
 Australia's Academic & Research Network  www.aarnet.edu.au
#5 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 12 lines · Glen Turner
Quoted 3 lines · Patrick McHardy

I don't think iptables is the right place to do this. It should be controllable through routing IMO (which can already control some aspects of congestion control).

I too think the choice should usually be done through routing, with the route holding the preferred congestion control algorithm for traffic with that prefix. Whereas now the preferred algorithm is read from a global parameter.

Quoted 6 lines

But the algorithm for a particular connection should still be able to be changed through iptables.

Firstly, not every application can be easily altered to use setsockopt() to select a differing algorithm from the default. This is the argument used for the TCPMSS and similar targets.

The difference is that TCPMSS changes packet data (also for forwarded packets) and doesn't fiddle around with sockets.

Quoted 7 lines

As the range of congestion control algorithms grows sysadmins will want to choose differing algorithms for differing applications. For example, most algorithm's Ack strategies interact poorly with transactional and remote procedure call traffic, so choosing an algorithm which handles this well could make, say, NFS over TCP traffic run a lot faster.

Quoted 9 lines

Secondly, I want to make it easy for kernel and protocol developers to run differing algorithms on differing port numbers to test inter-algorithm fairness. Some TCP algorithms are quite unfair -- unable even to share a link 50:50 between two identical flows started a few seconds apart. A TCPCONG target makes it much easier to do this testing. Now that the kernel developers are getting good performance on long fat pipes the fairness and other attributes of that performance will be their next concern.

It still strikes me as a bit of a hack. Lets see what Stephen thinks.

#6 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 16 lines · On Wed, 11 Oct 2006 07:32:18 +0200 Patrick McHardy <[email protected]> wrote:
Quoted 15 lines · Glen Turner
Quoted 3 lines · Patrick McHardy

I don't think iptables is the right place to do this. It should be controllable through routing IMO (which can already control some aspects of congestion control).

I too think the choice should usually be done through routing, with the route holding the preferred congestion control algorithm for traffic with that prefix. Whereas now the preferred algorithm is read from a global parameter.

But the algorithm for a particular connection should still be able to be changed through iptables.

Quoted 13 lines
Quoted 3 lines

Firstly, not every application can be easily altered to use setsockopt() to select a differing algorithm from the default. This is the argument used for the TCPMSS and similar targets.

The difference is that TCPMSS changes packet data (also for forwarded packets) and doesn't fiddle around with sockets.

Quoted 6 lines

As the range of congestion control algorithms grows sysadmins will want to choose differing algorithms for differing applications. For example, most algorithm's Ack strategies interact poorly with transactional and remote procedure call traffic, so choosing an algorithm which handles this well could make, say, NFS over TCP traffic run a lot faster.

That's a problem with delayed ack's not the congestion control stuff.

Quoted 10 lines
Quoted 9 lines

Secondly, I want to make it easy for kernel and protocol developers to run differing algorithms on differing port numbers to test inter-algorithm fairness. Some TCP algorithms are quite unfair -- unable even to share a link 50:50 between two identical flows started a few seconds apart. A TCPCONG target makes it much easier to do this testing. Now that the kernel developers are getting good performance on long fat pipes the fairness and other attributes of that performance will be their next concern.

Quoted 3 lines

It still strikes me as a bit of a hack. Lets see what Stephen thinks.

I don't like iptables interacting back with the socket state. The only congestion control that makes sense to be application specific is the TCP-LP stuff. The others are just duking it out, to see which one should be the default.

I want to put the congestion choice in the route metrics as an option, just haven't got around to doing it that way. The only advantage do doing it in IP tables is that you can make rules by port etc.

Signature · 1 line
Stephen Hemminger <[email protected]>
#7 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 1 line · Stephen Hemminger

I don't like iptables interacting back with the socket state.

Sounds like a no to me :-)

Patrick, what's the easiest way to maintain this out of Netfilter? As a patch to patch-o-matic or as a direct patch to iptables and the kernel?

[ For those following this from the archive at some time in the
future, I'll put the patch at
<http://www.aarnet.edu.au/~gdt/patch/tcpcong/> ]

Quoted 3 lines

The only congestion control that makes sense to be application specific is the TCP-LP stuff. The others are just duking it out, to see which one should be the default.

I'd expect to see more application-specific and link-specific algorithms in the future. In the long run you might need more pseudo-algorithms (eg: "default-lossy-link" to select the kernel's default algorithm for wireless links).

Quoted 3 lines

I want to put the congestion choice in the route metrics as an option, just haven't got around to doing it that way. The only advantage do doing it in IP tables is that you can make rules by port etc.

I think it's more complex than that to get a nice behaviour:
socket, which gets its default from
route, which gets its default from
interface, which get its default from
the global sysctl.
I'm not sure how much of this behaviour can be implemented from user space.

Thanks for your response,
Glen

Signature · 2 lines
 Glen Turner         Tel: (08) 8303 3936 or +61 8 8303 3936
 Australia's Academic & Research Network  www.aarnet.edu.au
#8 lore raw

Re: [PATCH] Add TCPCONG target to patch-o-matic

Quoted 3 lines · Glen Turner

Patrick, what's the easiest way to maintain this out of Netfilter? As a patch to patch-o-matic or as a direct patch to iptables and the kernel?

I depends on your workflow I guess. I personally prefer to keep patches in git trees, for long-term maintenance patch-o-matic might save you a bit of work by resolving Kconfig and Makefile conflicts automatically. If you're going to set up an external patch-o-matic repository we can add it to the distributed sources.list if you want.