* [PATCH 5/7] IrDA: sti/cli removal from EP7211 IrDA driver
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch replaces the deprecated sti/cli routines with the corresponding
spin_lock ones.
Signed-off-by: David Chosrova <david.chosrova-TDf4sKD1mxeHlu7OokbhRg@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/net/irda/ep7211_ir.c b/drivers/net/irda/ep7211_ir.c
index 3189626..6edf988 100644
--- a/drivers/net/irda/ep7211_ir.c
+++ b/drivers/net/irda/ep7211_ir.c
@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/tty.h>
#include <linux/init.h>
+#include <linux/spinlock.h>
#include <net/irda/irda.h>
#include <net/irda/irda_device.h>
@@ -15,6 +16,7 @@
#include <asm/io.h>
#include <asm/hardware.h>
+
#define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
#define MAX_DELAY 10000 /* 1 ms */
@@ -23,6 +25,7 @@ static void ep7211_ir_close(dongle_t *se
static int ep7211_ir_change_speed(struct irda_task *task);
static int ep7211_ir_reset(struct irda_task *task);
+static spinlock_t ep7211_lock;
static struct dongle_reg dongle = {
.type = IRDA_EP7211_IR,
.open = ep7211_ir_open,
@@ -36,7 +39,7 @@ static void ep7211_ir_open(dongle_t *sel
{
unsigned int syscon1, flags;
- save_flags(flags); cli();
+ spin_lock_irqsave(&ep7211_lock, flags);
/* Turn on the SIR encoder. */
syscon1 = clps_readl(SYSCON1);
@@ -46,14 +49,14 @@ static void ep7211_ir_open(dongle_t *sel
/* XXX: We should disable modem status interrupts on the first
UART (interrupt #14). */
- restore_flags(flags);
+ spin_lock_irqrestore(&ep7211_lock, flags);
}
static void ep7211_ir_close(dongle_t *self)
{
unsigned int syscon1, flags;
- save_flags(flags); cli();
+ spin_lock_irqsave(&ep7211_lock, flags);
/* Turn off the SIR encoder. */
syscon1 = clps_readl(SYSCON1);
@@ -63,7 +66,7 @@ static void ep7211_ir_close(dongle_t *se
/* XXX: If we've disabled the modem status interrupts, we should
reset them back to their original state. */
- restore_flags(flags);
+ spin_lock_irqrestore(&ep7211_lock, flags);
}
/*
@@ -99,6 +102,7 @@ static int ep7211_ir_reset(struct irda_t
*/
static int __init ep7211_ir_init(void)
{
+ spin_lock_init(&ep7211_lock);
return irda_device_register_dongle(&dongle);
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply related
* [PATCH 6/7] IrDA: pci_register_driver conversion
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch converts 2 IrDA drivers pci_module_init() calls to
pci_register_driver().
Signed-off-by: Christophe Lucas <clucas-6bugY6I12JBBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Domen Puncer <domen-CvScVCPLwOZg9hUCZPvPmw@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 3137592..910c0ca 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -1778,7 +1778,7 @@ static struct pci_driver donauboe_pci_dr
static int __init
donauboe_init (void)
{
- return pci_module_init(&donauboe_pci_driver);
+ return pci_register_driver(&donauboe_pci_driver);
}
static void __exit
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index a9f49f0..97a49e0 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1887,7 +1887,7 @@ static int __init vlsi_mod_init(void)
vlsi_proc_root->owner = THIS_MODULE;
}
- ret = pci_module_init(&vlsi_irda_driver);
+ ret = pci_register_driver(&vlsi_irda_driver);
if (ret && vlsi_proc_root)
remove_proc_entry(PROC_DIR, NULL);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply related
* [PATCH 7/7] IrDA: out of range array access
From: Samuel Ortiz @ 2006-02-09 21:32 UTC (permalink / raw)
To: ext David S. Miller
Cc: ext Jean Tourrilhes, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
This patch fixes an out of range array access in irnet_irda.c.
Author: David Binderman <dcb314-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index 07ec326..e477a8d 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -696,7 +696,7 @@ irnet_daddr_to_dname(irnet_socket * self
{
/* Yes !!! Get it.. */
strlcpy(self->rname, discoveries[i].info, sizeof(self->rname));
- self->rname[NICKNAME_MAX_LEN + 1] = '\0';
+ self->rname[sizeof(self->rname) - 1] = '\0';
DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n",
self->daddr, self->rname);
kfree(discoveries);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply related
* Re: [GIT PULL] bcm43xx: Update B6PHY initialization
From: John W. Linville @ 2006-02-10 0:51 UTC (permalink / raw)
To: Danny van Dyk
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w
In-Reply-To: <200602011051.00973.kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
In the future, please include a Signed-off-by: line in your patches
or git commits...thanks!
John
On Wed, Feb 01, 2006 at 10:51:00AM +0100, Danny van Dyk wrote:
> John, please
>
> git pull rsync://pitr.amd64.dev.gentoo.org/kugelfang/wireless-2.6.git
>
> which will provide this changeset:
>
> Danny van Dyk:
> [bcm43xx] Sync bcm43xx_phy_initb6() with specs
>
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> index f5e7a6a..d90f207 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
> @@ -947,7 +947,7 @@ static void bcm43xx_phy_initb6(struct bc
> bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
> if ((bcm->current_core->radio->manufact == 0x17F) &&
> (bcm->current_core->radio->version == 0x2050) &&
> - (bcm->current_core->radio->revision == 2)) {
> + (bcm->current_core->radio->revision <= 2)) {
> bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
> bcm43xx_radio_write16(bcm, 0x005A, 0x0070);
> bcm43xx_radio_write16(bcm, 0x005B, 0x007B);
> @@ -984,10 +984,15 @@ static void bcm43xx_phy_initb6(struct bc
> bcm43xx_write16(bcm, 0x03E4, 0x0009);
> if (phy->type == BCM43xx_PHYTYPE_B) {
> bcm43xx_write16(bcm, 0x03E6, 0x8140);
> - bcm43xx_phy_write(bcm, 0x0016, 0x5410);
> - bcm43xx_phy_write(bcm, 0x0017, 0xA820);
> - bcm43xx_phy_write(bcm, 0x0007, 0x0062);
> - TODO();//TODO: calibrate stuff.
> + bcm43xx_phy_write(bcm, 0x0016, 0x0410);
> + bcm43xx_phy_write(bcm, 0x0017, 0x0820);
> + bcm43xx_phy_write(bcm, 0x0062, 0x0007);
> + (void) bcm43xx_radio_calibrationvalue(bcm);
> + bcm43xx_phy_lo_b_measure(bcm);
> + if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) {
> + bcm43xx_calc_nrssi_slope(bcm);
> + bcm43xx_calc_nrssi_threshold(bcm);
> + }
> bcm43xx_phy_init_pctl(bcm);
> } else
> bcm43xx_write16(bcm, 0x03E6, 0x0);
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> index 5ce6ace..3901aa9 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
> @@ -1184,7 +1184,7 @@ int bcm43xx_radio_set_interference_mitig
> return 0;
> }
>
> -static u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
> +u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
> {
> u16 reg, index, ret;
>
> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> b/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> index 89fe292..a5d2e10 100644
> --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
> @@ -89,5 +89,6 @@ void bcm43xx_nrssi_hw_update(struct bcm4
> void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm);
>
> void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm);
> +u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm);
>
> #endif /* BCM43xx_RADIO_H_ */
> --
> Danny van Dyk <kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> Gentoo/AMD64 Project, Gentoo Scientific Project
>
> --
> Danny van Dyk <kugelfang-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> Gentoo/AMD64 Project, Gentoo Scientific Project
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
^ permalink raw reply
* Re: [PATCH 4/7] IrDA: Set proper IrLAP device address length
From: David S. Miller @ 2006-02-10 0:58 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: jt-sDzT885Ts8HQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602090323140.19426@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:32:16 +0200 (EET)
> This patch set IrDA's addr_len properly, i.e to 4 bytes, the size of the
> IrLAP device address.
>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Bug fix, so applied to net-2.6
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply
* Re: [PATCH 7/7] IrDA: out of range array access
From: David S. Miller @ 2006-02-10 1:00 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: jt-sDzT885Ts8HQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602092231470.4121@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:32:43 +0200 (EET)
> This patch fixes an out of range array access in irnet_irda.c.
>
> Author: David Binderman <dcb314-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Bug fix, so applied to net-2.6
thanks
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply
* Re: [PATCH 0/7] IrDA updates
From: David S. Miller @ 2006-02-10 1:04 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jt-sDzT885Ts8HQT0dZR+AlfA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.LNX.4.58.0602090248090.19426@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 9 Feb 2006 23:31:31 +0200 (EET)
> So, next will come a set of 7 patches. Some of them are patches that have
> been floating around the irda mailing list and others are fixes or
> improvements based on Jean's latest TODO list.
I applied patches 4 and 7 to net-2.6 by hand, and I didn't attempt
to put the others, which were feature patches into net-2.6.17.
Something in your email client corrupts the patches. For one
thing, it turns lines with just spaces in them into empty lines.
I've seen this transformation before, in patches from other
people.
So please try to send patches 1, 2, 3, 5, and 6 to yourself until
the emails you send out give clean applyable patches.
Thanks a lot.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
^ permalink raw reply
* Re: [PATCH 2/3] bridge: netfilter handle RCU during removal
From: David S. Miller @ 2006-02-10 1:09 UTC (permalink / raw)
To: shemminger; +Cc: netdev, netfilter-devel
In-Reply-To: <20060206222853.844546000@dxpl.pdx.osdl.net>
From: Stephen Hemminger <shemminger@osdl.org>
Date: Mon, 06 Feb 2006 14:27:34 -0800
> Bridge netfilter code needs to handle the case where device is
> removed from bridge while packet in process. In these cases the
> bridge_parent can be come null while processing.
>
> This should fix: http://bugzilla.kernel.org/show_bug.cgi?id=5803
>
> Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Applied to net-2.6, thanks a lot.
^ permalink raw reply
* [PATCH] TC: bug fixes to the "sample" clause
From: Russell Stuart @ 2006-02-10 2:33 UTC (permalink / raw)
To: netdev, lartc, shemminger
PATCH 1
=======
On my machine tc does not parse filter "sample" for the u32
filter. Eg:
tc filter add dev eth2 parent 1:0 protocol ip prio 1 u32 ht 801: \
classid 1:3 \
sample ip protocol 1 0xff match ip protocol 1 0xff
Illegal "sample"
The reason is a missing memset. This patch fixes it.
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2005-01-19 08:11:58.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-01-12 17:12:43.000000000 +1000
@@ -878,6 +878,7 @@
struct tc_u32_sel sel;
struct tc_u32_key keys[4];
} sel2;
+ memset(&sel2, 0, sizeof(sel2));
NEXT_ARG();
if (parse_selector(&argc, &argv, &sel2.sel, n)) {
fprintf(stderr, "Illegal \"sample\"\n");
PATCH 2
=======
In tc, the u32 sample clause uses the 2.4 hashing algorithm.
The hashing algorithm used by the kernel changed in 2.6,
consequently "sample" hasn't work since then.
This patch makes the sample clause work for both 2.4 and 2.6:
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2006-01-12 17:34:37.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-02-07 17:10:29.000000000 +1000
@@ -17,6 +17,7 @@
#include <syslog.h>
#include <fcntl.h>
#include <sys/socket.h>
+#include <sys/utsname.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
@@ -874,6 +875,7 @@
htid = (handle&0xFFFFF000);
} else if (strcmp(*argv, "sample") == 0) {
__u32 hash;
+ struct utsname utsname;
struct {
struct tc_u32_sel sel;
struct tc_u32_key keys[4];
@@ -889,8 +891,19 @@
return -1;
}
hash = sel2.sel.keys[0].val&sel2.sel.keys[0].mask;
- hash ^= hash>>16;
- hash ^= hash>>8;
+ uname(&utsname);
+ if (strncmp(utsname.release, "2.4.", 4) == 0) {
+ hash ^= hash>>16;
+ hash ^= hash>>8;
+ }
+ else {
+ __u32 mask = sel2.sel.keys[0].mask;
+ while (mask && !(mask & 1)) {
+ mask >>= 1;
+ hash >>= 1;
+ }
+ hash &= 0xFF;
+ }
htid = ((hash<<12)&0xFF000)|(htid&0xFFF00000);
sample_ok = 1;
continue;
PATCH 3
=======
"tc" does not allow you to specify the divisor for the
"sample" clause, it always assumes a divisor of 256.
If the divisor isn't 256, (ie it is something less),
the kernel will usually whinge because the bucket given
to it by "tc" is typically too big.
This patch adds a "divisor" option to tc's "sample"
clause:
diff -Nur iproute-20051007.keep/tc/f_u32.c iproute-20051007/tc/f_u32.c
--- iproute-20051007.keep/tc/f_u32.c 2006-02-10 11:40:16.000000000 +1000
+++ iproute-20051007/tc/f_u32.c 2006-02-10 11:47:14.000000000 +1000
@@ -35,7 +35,7 @@
fprintf(stderr, "or u32 divisor DIVISOR\n");
fprintf(stderr, "\n");
fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n");
- fprintf(stderr, " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark } SAMPLE_ARGS\n");
+ fprintf(stderr, " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark } SAMPLE_ARGS [divisor DIVISOR]\n");
fprintf(stderr, " FILTERID := X:Y:Z\n");
}
@@ -835,7 +835,7 @@
unsigned divisor;
NEXT_ARG();
if (get_unsigned(&divisor, *argv, 0) || divisor == 0 ||
- divisor > 0x100) {
+ divisor > 0x100 || (divisor - 1 & divisor)) {
fprintf(stderr, "Illegal \"divisor\"\n");
return -1;
}
@@ -875,6 +875,7 @@
htid = (handle&0xFFFFF000);
} else if (strcmp(*argv, "sample") == 0) {
__u32 hash;
+ unsigned divisor = 0x100;
struct utsname utsname;
struct {
struct tc_u32_sel sel;
@@ -890,6 +891,15 @@
fprintf(stderr, "\"sample\" must contain exactly ONE key.\n");
return -1;
}
+ if (*argv != 0 && strcmp(*argv, "divisor") == 0) {
+ NEXT_ARG();
+ if (get_unsigned(&divisor, *argv, 0) || divisor == 0 ||
+ divisor > 0x100 || (divisor - 1 & divisor)) {
+ fprintf(stderr, "Illegal sample \"divisor\"\n");
+ return -1;
+ }
+ NEXT_ARG();
+ }
hash = sel2.sel.keys[0].val&sel2.sel.keys[0].mask;
uname(&utsname);
if (strncmp(utsname.release, "2.4.", 4) == 0) {
@@ -904,7 +913,7 @@
}
hash &= 0xFF;
}
- htid = ((hash<<12)&0xFF000)|(htid&0xFFF00000);
+ htid = ((hash%divisor)<<12)|(htid&0xFFF00000);
sample_ok = 1;
continue;
} else if (strcmp(*argv, "indev") == 0) {
^ permalink raw reply
* Re: [Patch] 2.4.32 - Neighbour Cache (ARP) State machine bug Fixed
From: Bill Davidsen @ 2006-02-10 20:35 UTC (permalink / raw)
To: gcoady; +Cc: netdev, linux-kernel
In-Reply-To: <4skiu150r13a2a78i68bg28cvdb67a8qjb@4ax.com>
Grant Coady wrote:
> On Tue, 7 Feb 2006 17:50:03 -0800, Pradeep Vincent <pradeep.vincent@gmail.com> wrote:
>
>
>>One more attempt. Attaching the diff file as well.
>>
>>Signed off by: Pradeep Vincent <pradeep.vincent@gmail.com>
>>
>>--- old/net/core/neighbour.c Wed Nov 9 16:48:10 2005
>>+++ new/net/core/neighbour.c Tue Feb 7 17:38:26 2006
>>@@ -14,6 +14,7 @@
>> * Vitaly E. Lavrov releasing NULL neighbor in neigh_add.
>> * Harald Welte Add neighbour cache statistics like rtstat
>> * Harald Welte port neighbour cache rework from 2.6.9-rcX
>>+ * Pradeep Vincent fix neighbour cache state machine
>> */
>>
>>#include <linux/config.h>
>>@@ -705,6 +706,13 @@
>> neigh_release(n);
>> continue;
>> }
>>+ /* Move to NUD_STALE state */
>>+ if (n->nud_state&NUD_REACHABLE &&
>>+ now - n->confirmed > n->parms->reachable_time) {
>
>
> Hmm, you're suffering tab -> space conversion syndrome :(
>
> Grant.
The attachment has tabs here, don't know what you're seeing.
--
bill davidsen <davidsen@tmr.com>
CTO TMR Associates, Inc
Doing interesting things with small computers since 1979
^ permalink raw reply
* [PATCH] ACX: Delete .owner field in usb.c
From: Carlos Martín @ 2006-02-10 21:46 UTC (permalink / raw)
To: acx100-devel; +Cc: netdev
diff-tree e0f5be38b5dea8bbfc486edbf9d88d5ee94941d9 (from
29292af943e12ace0115497616569f0629ed1cd7)
Author: Carlos <carlos@pepe.(none)>
Date: Fri Feb 10 21:02:39 2006 +0000
Delete .owner field in usb.c
It's no longer there. We already deleted it. Andi, I'm looking at you...
diff --git a/usb.c b/usb.c
index 45a95dd..1e64b15 100644
--- a/usb.c
+++ b/usb.c
@@ -155,7 +155,6 @@ MODULE_DEVICE_TABLE(usb, acxusb_ids);
/* USB driver data structure as required by the kernel's USB core */
static struct usb_driver
acxusb_driver = {
- .owner = THIS_MODULE,
.name = "acx_usb",
.probe = acxusb_e_probe,
.disconnect = acxusb_e_disconnect,
--
Carlos Martín Nieto | http://www.cmartin.tk
Hobbyist programmer |
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x103432&bid#0486&dat\x121642
^ permalink raw reply related
* [PATCH] IPv6: Cleanups for net/ipv6/addrconf.c (kzalloc, early exit) v2
From: Ingo Oeser @ 2006-02-11 16:37 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: linux-kernel, netdev
In-Reply-To: <20060210.014853.13643277.yoshfuji@linux-ipv6.org>
From: Ingo Oeser <ioe-lkml@rameria.de>
Here are some possible (and trivial) cleanups.
- use kzalloc() where possible
- remove unused label
- invert allocation failure test like
if (object) {
/* Rest of function here */
}
to
if (object == NULL)
return NULL;
/* Rest of function here */
The last one moves quite some code, because it changes indention.
I can split that up, if needed.
Signed-off-by: Ingo Oeser <ioe-lkml@rameria.de>
---
Hello,
On Thursday 09 February 2006 17:48, YOSHIFUJI Hideaki wrote:
> Please keep nlmsg_failure, which is used by NLMSG_NEW().
This issue has been adressed now.
Patch is against latest git from Linus. It has been compile tested with
allyesconfig on ix86.
Many thanks for your patience!
Regards
Ingo Oeer
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b7d8822..984a9bc 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -327,86 +327,85 @@ static struct inet6_dev * ipv6_add_dev(s
if (dev->mtu < IPV6_MIN_MTU)
return NULL;
- ndev = kmalloc(sizeof(struct inet6_dev), GFP_KERNEL);
+ ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL);
- if (ndev) {
- memset(ndev, 0, sizeof(struct inet6_dev));
+ if (ndev == NULL)
+ return NULL;
- rwlock_init(&ndev->lock);
- ndev->dev = dev;
- memcpy(&ndev->cnf, &ipv6_devconf_dflt, sizeof(ndev->cnf));
- ndev->cnf.mtu6 = dev->mtu;
- ndev->cnf.sysctl = NULL;
- ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl);
- if (ndev->nd_parms == NULL) {
- kfree(ndev);
- return NULL;
- }
- /* We refer to the device */
- dev_hold(dev);
+ rwlock_init(&ndev->lock);
+ ndev->dev = dev;
+ memcpy(&ndev->cnf, &ipv6_devconf_dflt, sizeof(ndev->cnf));
+ ndev->cnf.mtu6 = dev->mtu;
+ ndev->cnf.sysctl = NULL;
+ ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl);
+ if (ndev->nd_parms == NULL) {
+ kfree(ndev);
+ return NULL;
+ }
+ /* We refer to the device */
+ dev_hold(dev);
- if (snmp6_alloc_dev(ndev) < 0) {
- ADBG((KERN_WARNING
- "%s(): cannot allocate memory for statistics; dev=%s.\n",
- __FUNCTION__, dev->name));
- neigh_parms_release(&nd_tbl, ndev->nd_parms);
- ndev->dead = 1;
- in6_dev_finish_destroy(ndev);
- return NULL;
- }
+ if (snmp6_alloc_dev(ndev) < 0) {
+ ADBG((KERN_WARNING
+ "%s(): cannot allocate memory for statistics; dev=%s.\n",
+ __FUNCTION__, dev->name));
+ neigh_parms_release(&nd_tbl, ndev->nd_parms);
+ ndev->dead = 1;
+ in6_dev_finish_destroy(ndev);
+ return NULL;
+ }
- if (snmp6_register_dev(ndev) < 0) {
- ADBG((KERN_WARNING
- "%s(): cannot create /proc/net/dev_snmp6/%s\n",
- __FUNCTION__, dev->name));
- neigh_parms_release(&nd_tbl, ndev->nd_parms);
- ndev->dead = 1;
- in6_dev_finish_destroy(ndev);
- return NULL;
- }
+ if (snmp6_register_dev(ndev) < 0) {
+ ADBG((KERN_WARNING
+ "%s(): cannot create /proc/net/dev_snmp6/%s\n",
+ __FUNCTION__, dev->name));
+ neigh_parms_release(&nd_tbl, ndev->nd_parms);
+ ndev->dead = 1;
+ in6_dev_finish_destroy(ndev);
+ return NULL;
+ }
- /* One reference from device. We must do this before
- * we invoke __ipv6_regen_rndid().
- */
- in6_dev_hold(ndev);
+ /* One reference from device. We must do this before
+ * we invoke __ipv6_regen_rndid().
+ */
+ in6_dev_hold(ndev);
#ifdef CONFIG_IPV6_PRIVACY
- get_random_bytes(ndev->rndid, sizeof(ndev->rndid));
- get_random_bytes(ndev->entropy, sizeof(ndev->entropy));
- init_timer(&ndev->regen_timer);
- ndev->regen_timer.function = ipv6_regen_rndid;
- ndev->regen_timer.data = (unsigned long) ndev;
- if ((dev->flags&IFF_LOOPBACK) ||
- dev->type == ARPHRD_TUNNEL ||
- dev->type == ARPHRD_NONE ||
- dev->type == ARPHRD_SIT) {
- printk(KERN_INFO
- "%s: Disabled Privacy Extensions\n",
- dev->name);
- ndev->cnf.use_tempaddr = -1;
- } else {
- in6_dev_hold(ndev);
- ipv6_regen_rndid((unsigned long) ndev);
- }
+ get_random_bytes(ndev->rndid, sizeof(ndev->rndid));
+ get_random_bytes(ndev->entropy, sizeof(ndev->entropy));
+ init_timer(&ndev->regen_timer);
+ ndev->regen_timer.function = ipv6_regen_rndid;
+ ndev->regen_timer.data = (unsigned long) ndev;
+ if ((dev->flags&IFF_LOOPBACK) ||
+ dev->type == ARPHRD_TUNNEL ||
+ dev->type == ARPHRD_NONE ||
+ dev->type == ARPHRD_SIT) {
+ printk(KERN_INFO
+ "%s: Disabled Privacy Extensions\n",
+ dev->name);
+ ndev->cnf.use_tempaddr = -1;
+ } else {
+ in6_dev_hold(ndev);
+ ipv6_regen_rndid((unsigned long) ndev);
+ }
#endif
- if (netif_carrier_ok(dev))
- ndev->if_flags |= IF_READY;
+ if (netif_carrier_ok(dev))
+ ndev->if_flags |= IF_READY;
- write_lock_bh(&addrconf_lock);
- dev->ip6_ptr = ndev;
- write_unlock_bh(&addrconf_lock);
+ write_lock_bh(&addrconf_lock);
+ dev->ip6_ptr = ndev;
+ write_unlock_bh(&addrconf_lock);
- ipv6_mc_init_dev(ndev);
- ndev->tstamp = jiffies;
+ ipv6_mc_init_dev(ndev);
+ ndev->tstamp = jiffies;
#ifdef CONFIG_SYSCTL
- neigh_sysctl_register(dev, ndev->nd_parms, NET_IPV6,
- NET_IPV6_NEIGH, "ipv6",
- &ndisc_ifinfo_sysctl_change,
- NULL);
- addrconf_sysctl_register(ndev, &ndev->cnf);
+ neigh_sysctl_register(dev, ndev->nd_parms, NET_IPV6,
+ NET_IPV6_NEIGH, "ipv6",
+ &ndisc_ifinfo_sysctl_change,
+ NULL);
+ addrconf_sysctl_register(ndev, &ndev->cnf);
#endif
- }
return ndev;
}
@@ -524,7 +523,7 @@ ipv6_add_addr(struct inet6_dev *idev, co
goto out;
}
- ifa = kmalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC);
+ ifa = kzalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC);
if (ifa == NULL) {
ADBG(("ipv6_add_addr: malloc failed\n"));
@@ -538,7 +537,6 @@ ipv6_add_addr(struct inet6_dev *idev, co
goto out;
}
- memset(ifa, 0, sizeof(struct inet6_ifaddr));
ipv6_addr_copy(&ifa->addr, addr);
spin_lock_init(&ifa->lock);
@@ -2668,11 +2666,10 @@ static int if6_seq_open(struct inode *in
{
struct seq_file *seq;
int rc = -ENOMEM;
- struct if6_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ struct if6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s)
goto out;
- memset(s, 0, sizeof(*s));
rc = seq_open(file, &if6_seq_ops);
if (rc)
^ permalink raw reply related
* Re: [PATCH] IPv6: Cleanups for net/ipv6/addrconf.c (kzalloc, early exit) v2
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-02-11 17:11 UTC (permalink / raw)
To: davem; +Cc: ioe-lkml, linux-kernel, netdev, yoshfuji
In-Reply-To: <200602111737.20010.ioe-lkml@rameria.de>
Hello.
In article <200602111737.20010.ioe-lkml@rameria.de> (at Sat, 11 Feb 2006 17:37:18 +0100), Ingo Oeser <ioe-lkml@rameria.de> says:
> From: Ingo Oeser <ioe-lkml@rameria.de>
>
> Here are some possible (and trivial) cleanups.
> - use kzalloc() where possible
> - remove unused label
> - invert allocation failure test like
:
> Signed-off-by: Ingo Oeser <ioe-lkml@rameria.de>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
--yoshfuji
^ permalink raw reply
* [RFC: 2.6 patch] CONFIG_FORCEDETH updates
From: Adrian Bunk @ 2006-02-12 17:52 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linux-kernel
This patch contains the following possible updates:
- let FORCEDETH no longer depend on EXPERIMENTAL
- remove the "Reverse Engineered" from the option text:
for the user it's important which hardware the driver supports, not
how it was developed
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.16-rc2-mm1-full/drivers/net/Kconfig.old 2006-02-12 02:23:31.000000000 +0100
+++ linux-2.6.16-rc2-mm1-full/drivers/net/Kconfig 2006-02-12 02:24:04.000000000 +0100
@@ -1370,10 +1370,10 @@
<file:Documentation/networking/net-modules.txt>. The module will be
called b44.
config FORCEDETH
- tristate "Reverse Engineered nForce Ethernet support (EXPERIMENTAL)"
- depends on NET_PCI && PCI && EXPERIMENTAL
+ tristate "nForce Ethernet support"
+ depends on NET_PCI && PCI
help
If you have a network (Ethernet) controller of this type, say Y and
read the Ethernet-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.
^ permalink raw reply
* [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: Harald Welte @ 2006-02-12 17:56 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, Netfilter Development Mailinglist
[-- Attachment #1: Type: text/plain, Size: 25127 bytes --]
Hi Dave!
This is net-2.6.17 stuff, please apply.
Thanks!
[NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
This patch moves all helper related data fields of 'struct nf_conn' into a
separate structure 'struct nf_conn_help'. This new structure is only
present in conntrack entries for which we actually have a helper loaded.
Also, this patch cleans up the nf_conntrack 'features' mechanism to
resemble what the original idea was: Just glue the feature-specific
data structures at the end of 'struct nf_conn', and explicitly re-calculate
the pointer to it when needed rather than keeping pointers around.
Saves 20 bytes per conntrack on my x86_64 box. A non-helped conntrack is
276 bytes. We still need to save another 20 bytes in order to fit into to
target of 256bytes.
Signed-off-by: Harald Welte <laforge@netfilter.org>
---
commit aba8cf3ac5b60e10eb1ce9f30b6bb4c007ab9868
tree 758aedbe80b8306c1991a05c47eab8905d33a13b
parent 94d3d40c84672b74e59ea5252f61602610e1513e
author Harald Welte <laforge@netfilter.org> Sun, 29 Jan 2006 19:19:06 +0100
committer Harald Welte <laforge@netfilter.org> Sun, 29 Jan 2006 19:19:06 +0100
include/net/netfilter/nf_conntrack.h | 56 +++++++----
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 22 ++---
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 39 +++++---
net/netfilter/nf_conntrack_core.c | 117 ++++++++++--------------
net/netfilter/nf_conntrack_ftp.c | 2
net/netfilter/nf_conntrack_netlink.c | 39 +++++---
net/netfilter/nf_conntrack_standalone.c | 1
net/netfilter/xt_helper.c | 8 +-
8 files changed, 147 insertions(+), 137 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6d075ca..9d1f0e6 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -67,6 +67,18 @@ do { \
struct nf_conntrack_helper;
+/* nf_conn feature for connections that have a helper */
+struct nf_conn_help {
+ /* Helper. if any */
+ struct nf_conntrack_helper *helper;
+
+ union nf_conntrack_help help;
+
+ /* Current number of expected connections */
+ unsigned int expecting;
+};
+
+
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
struct nf_conn
{
@@ -81,6 +93,9 @@ struct nf_conn
/* Have we seen traffic both ways yet? (bitset) */
unsigned long status;
+ /* If we were expected by an expectation, this will be it */
+ struct nf_conn *master;
+
/* Timer function; drops refcnt when it goes off. */
struct timer_list timeout;
@@ -88,38 +103,22 @@ struct nf_conn
/* Accounting Information (same cache line as other written members) */
struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
#endif
- /* If we were expected by an expectation, this will be it */
- struct nf_conn *master;
-
- /* Current number of expected connections */
- unsigned int expecting;
/* Unique ID that identifies this conntrack*/
unsigned int id;
- /* Helper. if any */
- struct nf_conntrack_helper *helper;
-
/* features - nat, helper, ... used by allocating system */
u_int32_t features;
- /* Storage reserved for other modules: */
-
- union nf_conntrack_proto proto;
-
#if defined(CONFIG_NF_CONNTRACK_MARK)
u_int32_t mark;
#endif
- /* These members are dynamically allocated. */
-
- union nf_conntrack_help *help;
+ /* Storage reserved for other modules: */
+ union nf_conntrack_proto proto;
- /* Layer 3 dependent members. (ex: NAT) */
- union {
- struct nf_conntrack_ipv4 *ipv4;
- } l3proto;
- void *data[0];
+ /* features dynamically at the end: helper, nat (both optional) */
+ char data[0];
};
struct nf_conntrack_expect
@@ -373,10 +372,23 @@ nf_conntrack_expect_event(enum ip_conntr
#define NF_CT_F_NUM 4
extern int
-nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size,
- int (*init_conntrack)(struct nf_conn *, u_int32_t));
+nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
extern void
nf_conntrack_unregister_cache(u_int32_t features);
+/* valid combinations:
+ * basic: nf_conn, nf_conn .. nf_conn_help
+ * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help
+ */
+static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
+{
+ unsigned int offset = sizeof(struct nf_conn);
+
+ if (!(ct->features & NF_CT_F_HELP))
+ return NULL;
+
+ return (struct nf_conn_help *) ((void *)ct + offset);
+}
+
#endif /* __KERNEL__ */
#endif /* _NF_CONNTRACK_H */
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 167619f..e52b50b 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -141,19 +141,21 @@ static unsigned int ipv4_conntrack_help(
{
struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
+ struct nf_conn_help *help;
/* This is where we call the helper: as the packet goes out. */
ct = nf_ct_get(*pskb, &ctinfo);
- if (ct && ct->helper) {
- unsigned int ret;
- ret = ct->helper->help(pskb,
- (*pskb)->nh.raw - (*pskb)->data
- + (*pskb)->nh.iph->ihl*4,
- ct, ctinfo);
- if (ret != NF_ACCEPT)
- return ret;
- }
- return NF_ACCEPT;
+ if (!ct)
+ return NF_ACCEPT;
+
+ help = nfct_help(ct);
+ if (!help || !help->helper)
+ return NF_ACCEPT;
+
+ return help->helper->help(pskb,
+ (*pskb)->nh.raw - (*pskb)->data
+ + (*pskb)->nh.iph->ihl*4,
+ ct, ctinfo);
}
static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index ac702a2..ac35f95 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -179,31 +179,36 @@ static unsigned int ipv6_confirm(unsigne
int (*okfn)(struct sk_buff *))
{
struct nf_conn *ct;
+ struct nf_conn_help *help;
enum ip_conntrack_info ctinfo;
+ unsigned int ret, protoff;
+ unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
+ - (*pskb)->data;
+ unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
+
/* This is where we call the helper: as the packet goes out. */
ct = nf_ct_get(*pskb, &ctinfo);
- if (ct && ct->helper) {
- unsigned int ret, protoff;
- unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
- - (*pskb)->data;
- unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
-
- protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
- (*pskb)->len - extoff);
- if (protoff < 0 || protoff > (*pskb)->len ||
- pnum == NEXTHDR_FRAGMENT) {
- DEBUGP("proto header not found\n");
- return NF_ACCEPT;
- }
+ if (!ct)
+ goto out;
- ret = ct->helper->help(pskb, protoff, ct, ctinfo);
- if (ret != NF_ACCEPT)
- return ret;
+ help = nfct_help(ct);
+ if (!help || !help->helper)
+ goto out;
+
+ protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
+ (*pskb)->len - extoff);
+ if (protoff < 0 || protoff > (*pskb)->len ||
+ pnum == NEXTHDR_FRAGMENT) {
+ DEBUGP("proto header not found\n");
+ return NF_ACCEPT;
}
+ ret = help->helper->help(pskb, protoff, ct, ctinfo);
+ if (ret != NF_ACCEPT)
+ return ret;
+out:
/* We've seen it coming out the other side: confirm it */
-
return nf_conntrack_confirm(pskb);
}
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 62bb509..873afa6 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -3,7 +3,7 @@
extension. */
/* (C) 1999-2001 Paul `Rusty' Russell
- * (C) 2002-2005 Netfilter Core Team <coreteam@netfilter.org>
+ * (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org>
* (C) 2003,2004 USAGI/WIDE Project <http://www.linux-ipv6.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,9 @@
* - generalize L3 protocol denendent part.
* 23 Mar 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
* - add support various size of conntrack structures.
+ * 26 Jan 2006: Harald Welte <laforge@netfilter.org>
+ * - restructure nf_conn (introduce nf_conn_help)
+ * - redesign 'features' how they were originally intended
*
* Derived from net/ipv4/netfilter/ip_conntrack_core.c
*/
@@ -55,7 +58,7 @@
#include <net/netfilter/nf_conntrack_core.h>
#include <linux/netfilter_ipv4/listhelp.h>
-#define NF_CONNTRACK_VERSION "0.4.1"
+#define NF_CONNTRACK_VERSION "0.5.0"
#if 0
#define DEBUGP printk
@@ -259,21 +262,8 @@ static inline u_int32_t hash_conntrack(c
nf_conntrack_hash_rnd);
}
-/* Initialize "struct nf_conn" which has spaces for helper */
-static int
-init_conntrack_for_helper(struct nf_conn *conntrack, u_int32_t features)
-{
-
- conntrack->help = (union nf_conntrack_help *)
- (((unsigned long)conntrack->data
- + (__alignof__(union nf_conntrack_help) - 1))
- & (~((unsigned long)(__alignof__(union nf_conntrack_help) -1))));
- return 0;
-}
-
int nf_conntrack_register_cache(u_int32_t features, const char *name,
- size_t size,
- int (*init)(struct nf_conn *, u_int32_t))
+ size_t size)
{
int ret = 0;
char *cache_name;
@@ -296,8 +286,7 @@ int nf_conntrack_register_cache(u_int32_
DEBUGP("nf_conntrack_register_cache: already resisterd.\n");
if ((!strncmp(nf_ct_cache[features].name, name,
NF_CT_FEATURES_NAMELEN))
- && nf_ct_cache[features].size == size
- && nf_ct_cache[features].init_conntrack == init) {
+ && nf_ct_cache[features].size == size) {
DEBUGP("nf_conntrack_register_cache: reusing.\n");
nf_ct_cache[features].use++;
ret = 0;
@@ -340,7 +329,6 @@ int nf_conntrack_register_cache(u_int32_
write_lock_bh(&nf_ct_cache_lock);
nf_ct_cache[features].use = 1;
nf_ct_cache[features].size = size;
- nf_ct_cache[features].init_conntrack = init;
nf_ct_cache[features].cachep = cachep;
nf_ct_cache[features].name = cache_name;
write_unlock_bh(&nf_ct_cache_lock);
@@ -377,7 +365,6 @@ void nf_conntrack_unregister_cache(u_int
name = nf_ct_cache[features].name;
nf_ct_cache[features].cachep = NULL;
nf_ct_cache[features].name = NULL;
- nf_ct_cache[features].init_conntrack = NULL;
nf_ct_cache[features].size = 0;
write_unlock_bh(&nf_ct_cache_lock);
@@ -432,11 +419,15 @@ nf_ct_invert_tuple(struct nf_conntrack_t
/* nf_conntrack_expect helper functions */
void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
{
+ struct nf_conn_help *master_help = nfct_help(exp->master);
+
+ NF_CT_ASSERT(master_help);
ASSERT_WRITE_LOCK(&nf_conntrack_lock);
NF_CT_ASSERT(!timer_pending(&exp->timeout));
+
list_del(&exp->list);
NF_CT_STAT_INC(expect_delete);
- exp->master->expecting--;
+ master_help->expecting--;
nf_conntrack_expect_put(exp);
}
@@ -508,9 +499,10 @@ find_expectation(const struct nf_conntra
void nf_ct_remove_expectations(struct nf_conn *ct)
{
struct nf_conntrack_expect *i, *tmp;
+ struct nf_conn_help *help = nfct_help(ct);
/* Optimization: most connection never expect any others. */
- if (ct->expecting == 0)
+ if (!help || help->expecting == 0)
return;
list_for_each_entry_safe(i, tmp, &nf_conntrack_expect_list, list) {
@@ -713,6 +705,7 @@ __nf_conntrack_confirm(struct sk_buff **
conntrack_tuple_cmp,
struct nf_conntrack_tuple_hash *,
&ct->tuplehash[IP_CT_DIR_REPLY].tuple, NULL)) {
+ struct nf_conn_help *help;
/* Remove from unconfirmed list */
list_del(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list);
@@ -726,7 +719,8 @@ __nf_conntrack_confirm(struct sk_buff **
set_bit(IPS_CONFIRMED_BIT, &ct->status);
NF_CT_STAT_INC(insert);
write_unlock_bh(&nf_conntrack_lock);
- if (ct->helper)
+ help = nfct_help(ct);
+ if (help && help->helper)
nf_conntrack_event_cache(IPCT_HELPER, *pskb);
#ifdef CONFIG_NF_NAT_NEEDED
if (test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status) ||
@@ -842,8 +836,9 @@ __nf_conntrack_alloc(const struct nf_con
{
struct nf_conn *conntrack = NULL;
u_int32_t features = 0;
+ void *helper;
- if (!nf_conntrack_hash_rnd_initted) {
+ if (unlikely(!nf_conntrack_hash_rnd_initted)) {
get_random_bytes(&nf_conntrack_hash_rnd, 4);
nf_conntrack_hash_rnd_initted = 1;
}
@@ -863,8 +858,11 @@ __nf_conntrack_alloc(const struct nf_con
/* find features needed by this conntrack. */
features = l3proto->get_features(orig);
+
+ /* FIXME: protect helper list per RCU */
read_lock_bh(&nf_conntrack_lock);
- if (__nf_ct_helper_find(repl) != NULL)
+ helper = __nf_ct_helper_find(repl);
+ if (helper)
features |= NF_CT_F_HELP;
read_unlock_bh(&nf_conntrack_lock);
@@ -872,7 +870,7 @@ __nf_conntrack_alloc(const struct nf_con
read_lock_bh(&nf_ct_cache_lock);
- if (!nf_ct_cache[features].use) {
+ if (unlikely(!nf_ct_cache[features].use)) {
DEBUGP("nf_conntrack_alloc: not supported features = 0x%x\n",
features);
goto out;
@@ -886,12 +884,10 @@ __nf_conntrack_alloc(const struct nf_con
memset(conntrack, 0, nf_ct_cache[features].size);
conntrack->features = features;
- if (nf_ct_cache[features].init_conntrack &&
- nf_ct_cache[features].init_conntrack(conntrack, features) < 0) {
- DEBUGP("nf_conntrack_alloc: failed to init\n");
- kmem_cache_free(nf_ct_cache[features].cachep, conntrack);
- conntrack = NULL;
- goto out;
+ if (helper) {
+ struct nf_conn_help *help = nfct_help(conntrack);
+ NF_CT_ASSERT(help);
+ help->helper = helper;
}
atomic_set(&conntrack->ct_general.use, 1);
@@ -972,11 +968,8 @@ init_conntrack(const struct nf_conntrack
#endif
nf_conntrack_get(&conntrack->master->ct_general);
NF_CT_STAT_INC(expect_new);
- } else {
- conntrack->helper = __nf_ct_helper_find(&repl_tuple);
-
+ } else
NF_CT_STAT_INC(new);
- }
/* Overload tuple linked list to put us in unconfirmed list. */
list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
@@ -1206,14 +1199,16 @@ void nf_conntrack_expect_put(struct nf_c
static void nf_conntrack_expect_insert(struct nf_conntrack_expect *exp)
{
+ struct nf_conn_help *master_help = nfct_help(exp->master);
+
atomic_inc(&exp->use);
- exp->master->expecting++;
+ master_help->expecting++;
list_add(&exp->list, &nf_conntrack_expect_list);
init_timer(&exp->timeout);
exp->timeout.data = (unsigned long)exp;
exp->timeout.function = expectation_timed_out;
- exp->timeout.expires = jiffies + exp->master->helper->timeout * HZ;
+ exp->timeout.expires = jiffies + master_help->helper->timeout * HZ;
add_timer(&exp->timeout);
exp->id = ++nf_conntrack_expect_next_id;
@@ -1239,10 +1234,12 @@ static void evict_oldest_expect(struct n
static inline int refresh_timer(struct nf_conntrack_expect *i)
{
+ struct nf_conn_help *master_help = nfct_help(i->master);
+
if (!del_timer(&i->timeout))
return 0;
- i->timeout.expires = jiffies + i->master->helper->timeout*HZ;
+ i->timeout.expires = jiffies + master_help->helper->timeout*HZ;
add_timer(&i->timeout);
return 1;
}
@@ -1251,8 +1248,11 @@ int nf_conntrack_expect_related(struct n
{
struct nf_conntrack_expect *i;
struct nf_conn *master = expect->master;
+ struct nf_conn_help *master_help = nfct_help(master);
int ret;
+ NF_CT_ASSERT(master_help);
+
DEBUGP("nf_conntrack_expect_related %p\n", related_to);
DEBUGP("tuple: "); NF_CT_DUMP_TUPLE(&expect->tuple);
DEBUGP("mask: "); NF_CT_DUMP_TUPLE(&expect->mask);
@@ -1271,8 +1271,8 @@ int nf_conntrack_expect_related(struct n
}
}
/* Will be over limit? */
- if (master->helper->max_expected &&
- master->expecting >= master->helper->max_expected)
+ if (master_help->helper->max_expected &&
+ master_help->expecting >= master_help->helper->max_expected)
evict_oldest_expect(master);
nf_conntrack_expect_insert(expect);
@@ -1283,24 +1283,6 @@ out:
return ret;
}
-/* Alter reply tuple (maybe alter helper). This is for NAT, and is
- implicitly racy: see __nf_conntrack_confirm */
-void nf_conntrack_alter_reply(struct nf_conn *conntrack,
- const struct nf_conntrack_tuple *newreply)
-{
- write_lock_bh(&nf_conntrack_lock);
- /* Should be unconfirmed, so not in hash table yet */
- NF_CT_ASSERT(!nf_ct_is_confirmed(conntrack));
-
- DEBUGP("Altering reply tuple of %p to ", conntrack);
- NF_CT_DUMP_TUPLE(newreply);
-
- conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
- if (!conntrack->master && conntrack->expecting == 0)
- conntrack->helper = __nf_ct_helper_find(newreply);
- write_unlock_bh(&nf_conntrack_lock);
-}
-
int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
{
int ret;
@@ -1309,8 +1291,7 @@ int nf_conntrack_helper_register(struct
ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help",
sizeof(struct nf_conn)
+ sizeof(union nf_conntrack_help)
- + __alignof__(union nf_conntrack_help),
- init_conntrack_for_helper);
+ + __alignof__(union nf_conntrack_help));
if (ret < 0) {
printk(KERN_ERR "nf_conntrack_helper_reigster: Unable to create slab cache for conntracks\n");
return ret;
@@ -1338,9 +1319,12 @@ __nf_conntrack_helper_find_byname(const
static inline int unhelp(struct nf_conntrack_tuple_hash *i,
const struct nf_conntrack_helper *me)
{
- if (nf_ct_tuplehash_to_ctrack(i)->helper == me) {
- nf_conntrack_event(IPCT_HELPER, nf_ct_tuplehash_to_ctrack(i));
- nf_ct_tuplehash_to_ctrack(i)->helper = NULL;
+ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(i);
+ struct nf_conn_help *help = nfct_help(ct);
+
+ if (help && help->helper == me) {
+ nf_conntrack_event(IPCT_HELPER, ct);
+ help->helper = NULL;
}
return 0;
}
@@ -1356,7 +1340,8 @@ void nf_conntrack_helper_unregister(stru
/* Get rid of expectations */
list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list, list) {
- if (exp->master->helper == me && del_timer(&exp->timeout)) {
+ struct nf_conn_help *help = nfct_help(exp->master);
+ if (help->helper == me && del_timer(&exp->timeout)) {
nf_ct_unlink_expect(exp);
nf_conntrack_expect_put(exp);
}
@@ -1695,7 +1680,7 @@ int __init nf_conntrack_init(void)
}
ret = nf_conntrack_register_cache(NF_CT_F_BASIC, "nf_conntrack:basic",
- sizeof(struct nf_conn), NULL);
+ sizeof(struct nf_conn));
if (ret < 0) {
printk(KERN_ERR "Unable to create nf_conn slab cache\n");
goto err_free_hash;
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index ab0c920..280c5c2 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -440,7 +440,7 @@ static int help(struct sk_buff **pskb,
u32 seq;
int dir = CTINFO2DIR(ctinfo);
unsigned int matchlen, matchoff;
- struct ip_ct_ftp_master *ct_ftp_info = &ct->help->ct_ftp_info;
+ struct ip_ct_ftp_master *ct_ftp_info = &nfct_help(ct)->help.ct_ftp_info;
struct nf_conntrack_expect *exp;
struct nf_conntrack_man cmd = {};
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 73ab16b..bd42186 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2,7 +2,7 @@
* protocol helpers and general trouble making from userspace.
*
* (C) 2001 by Jay Schulist <jschlst@samba.org>
- * (C) 2002-2005 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org>
* (C) 2003 by Patrick Mchardy <kaber@trash.net>
* (C) 2005 by Pablo Neira Ayuso <pablo@eurodev.net>
*
@@ -44,7 +44,7 @@
MODULE_LICENSE("GPL");
-static char __initdata version[] = "0.92";
+static char __initdata version[] = "0.93";
#if 0
#define DEBUGP printk
@@ -165,15 +165,16 @@ static inline int
ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct nf_conn *ct)
{
struct nfattr *nest_helper;
+ const struct nf_conn_help *help = nfct_help(ct);
- if (!ct->helper)
+ if (!help)
return 0;
nest_helper = NFA_NEST(skb, CTA_HELP);
- NFA_PUT(skb, CTA_HELP_NAME, strlen(ct->helper->name), ct->helper->name);
+ NFA_PUT(skb, CTA_HELP_NAME, strlen(help->helper->name), help->helper->name);
- if (ct->helper->to_nfattr)
- ct->helper->to_nfattr(skb, ct);
+ if (help->helper->to_nfattr)
+ help->helper->to_nfattr(skb, ct);
NFA_NEST_END(skb, nest_helper);
@@ -903,11 +904,17 @@ static inline int
ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
{
struct nf_conntrack_helper *helper;
+ struct nf_conn_help *help = nfct_help(ct);
char *helpname;
int err;
DEBUGP("entered %s\n", __FUNCTION__);
+ if (!help) {
+ /* FIXME: we need to reallocate and rehash */
+ return -EBUSY;
+ }
+
/* don't change helper of sibling connections */
if (ct->master)
return -EINVAL;
@@ -924,18 +931,18 @@ ctnetlink_change_helper(struct nf_conn *
return -EINVAL;
}
- if (ct->helper) {
+ if (help->helper) {
if (!helper) {
/* we had a helper before ... */
nf_ct_remove_expectations(ct);
- ct->helper = NULL;
+ help->helper = NULL;
} else {
/* need to zero data of old helper */
- memset(&ct->help, 0, sizeof(ct->help));
+ memset(&help->help, 0, sizeof(help->help));
}
}
- ct->helper = helper;
+ help->helper = helper;
return 0;
}
@@ -1050,14 +1057,9 @@ ctnetlink_create_conntrack(struct nfattr
ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
#endif
- ct->helper = nf_ct_helper_find_get(rtuple);
-
add_timer(&ct->timeout);
nf_conntrack_hash_insert(ct);
- if (ct->helper)
- nf_ct_helper_put(ct->helper);
-
DEBUGP("conntrack with id %u inserted\n", ct->id);
return 0;
@@ -1417,7 +1419,8 @@ ctnetlink_del_expect(struct sock *ctnl,
}
list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list,
list) {
- if (exp->master->helper == h
+ struct nf_conn_help *m_help = nfct_help(exp->master);
+ if (m_help->helper == h
&& del_timer(&exp->timeout)) {
nf_ct_unlink_expect(exp);
nf_conntrack_expect_put(exp);
@@ -1452,6 +1455,7 @@ ctnetlink_create_expect(struct nfattr *c
struct nf_conntrack_tuple_hash *h = NULL;
struct nf_conntrack_expect *exp;
struct nf_conn *ct;
+ struct nf_conn_help *help;
int err = 0;
DEBUGP("entered %s\n", __FUNCTION__);
@@ -1472,8 +1476,9 @@ ctnetlink_create_expect(struct nfattr *c
if (!h)
return -ENOENT;
ct = nf_ct_tuplehash_to_ctrack(h);
+ help = nfct_help(ct);
- if (!ct->helper) {
+ if (!help || !help->helper) {
/* such conntrack hasn't got any helper, abort */
err = -EINVAL;
goto out;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 617599a..290d5a0 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -839,7 +839,6 @@ EXPORT_SYMBOL(nf_conntrack_l3proto_unreg
EXPORT_SYMBOL(nf_conntrack_protocol_register);
EXPORT_SYMBOL(nf_conntrack_protocol_unregister);
EXPORT_SYMBOL(nf_ct_invert_tuplepr);
-EXPORT_SYMBOL(nf_conntrack_alter_reply);
EXPORT_SYMBOL(nf_conntrack_destroyed);
EXPORT_SYMBOL(need_conntrack);
EXPORT_SYMBOL(nf_conntrack_helper_register);
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 38b6715..c451169 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -96,6 +96,7 @@ match(const struct sk_buff *skb,
{
const struct xt_helper_info *info = matchinfo;
struct nf_conn *ct;
+ struct nf_conn_help *master_help;
enum ip_conntrack_info ctinfo;
int ret = info->invert;
@@ -111,7 +112,8 @@ match(const struct sk_buff *skb,
}
read_lock_bh(&nf_conntrack_lock);
- if (!ct->master->helper) {
+ master_help = nfct_help(ct->master);
+ if (!master_help || !master_help->helper) {
DEBUGP("xt_helper: master ct %p has no helper\n",
exp->expectant);
goto out_unlock;
@@ -123,8 +125,8 @@ match(const struct sk_buff *skb,
if (info->name[0] == '\0')
ret ^= 1;
else
- ret ^= !strncmp(ct->master->helper->name, info->name,
- strlen(ct->master->helper->name));
+ ret ^= !strncmp(master_help->helper->name, info->name,
+ strlen(master_help->helper->name));
out_unlock:
read_unlock_bh(&nf_conntrack_lock);
return ret;
--
- Harald Welte <laforge@gnumonks.org> http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related
* [RFC: 2.6 patch] let NET_CLS_ACT no longer depend on EXPERIMENTAL
From: Adrian Bunk @ 2006-02-12 17:56 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
This option should IMHO no longer depend on EXPERIMENTAL.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.16-rc2-mm1-full/net/sched/Kconfig.old 2006-02-12 02:21:30.000000000 +0100
+++ linux-2.6.16-rc2-mm1-full/net/sched/Kconfig 2006-02-12 02:21:58.000000000 +0100
@@ -434,7 +434,6 @@
config NET_CLS_ACT
bool "Actions"
- depends on EXPERIMENTAL
select NET_ESTIMATOR
---help---
Say Y here if you want to use traffic control actions. Actions
^ permalink raw reply
* Re: [RFC: 2.6 patch] CONFIG_FORCEDETH updates
From: Lee Revell @ 2006-02-12 22:03 UTC (permalink / raw)
To: Adrian Bunk; +Cc: jgarzik, netdev, linux-kernel
In-Reply-To: <20060212175202.GK30922@stusta.de>
On Sun, 2006-02-12 at 18:52 +0100, Adrian Bunk wrote:
> This patch contains the following possible updates:
> - let FORCEDETH no longer depend on EXPERIMENTAL
> - remove the "Reverse Engineered" from the option text:
> for the user it's important which hardware the driver supports, not
> how it was developed
Is this driver as stable as one that was developed with proper
documentation? I prefer to know that something as elementary as a fast
ethernet controller had to be reverse engineered so I can avoid
supporting a vendor so hostile to Linux.
Lee
^ permalink raw reply
* Re: [RFC: 2.6 patch] CONFIG_FORCEDETH updates
From: Alistair John Strachan @ 2006-02-12 22:47 UTC (permalink / raw)
To: Lee Revell; +Cc: Adrian Bunk, jgarzik, netdev, linux-kernel
In-Reply-To: <1139781817.19342.300.camel@mindpipe>
On Sunday 12 February 2006 22:03, Lee Revell wrote:
> On Sun, 2006-02-12 at 18:52 +0100, Adrian Bunk wrote:
> > This patch contains the following possible updates:
> > - let FORCEDETH no longer depend on EXPERIMENTAL
> > - remove the "Reverse Engineered" from the option text:
> > for the user it's important which hardware the driver supports, not
> > how it was developed
>
> Is this driver as stable as one that was developed with proper
> documentation? I prefer to know that something as elementary as a fast
> ethernet controller had to be reverse engineered so I can avoid
> supporting a vendor so hostile to Linux.
Although NVIDIA continue to maintain their own driver, I know forcedeth has
had contributions from at least a couple of NVIDIA employees. Also, I've
personally used the driver on nForce2, nForce3 and now nForce4 SLI boards and
it's rock solid.
Adrian's change is a good one, IMO.
--
Cheers,
Alistair.
'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
^ permalink raw reply
* Re: [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: Yasuyuki KOZAKAI @ 2006-02-13 1:32 UTC (permalink / raw)
To: laforge; +Cc: netdev, netfilter-devel, davem
In-Reply-To: <20060212175622.GG4601@sunbeam.de.gnumonks.org>
Hi, Harald,
From: Harald Welte <laforge@gnumonks.org>
Date: Sun, 12 Feb 2006 18:56:22 +0100
> [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
>
> This patch moves all helper related data fields of 'struct nf_conn' into a
> separate structure 'struct nf_conn_help'. This new structure is only
> present in conntrack entries for which we actually have a helper loaded.
>
> Also, this patch cleans up the nf_conntrack 'features' mechanism to
> resemble what the original idea was: Just glue the feature-specific
> data structures at the end of 'struct nf_conn', and explicitly re-calculate
> the pointer to it when needed rather than keeping pointers around.
>
> Saves 20 bytes per conntrack on my x86_64 box. A non-helped conntrack is
> 276 bytes. We still need to save another 20 bytes in order to fit into to
> target of 256bytes.
>
> Signed-off-by: Harald Welte <laforge@netfilter.org>
This patch seems not to include fixes I pointed out and you said "fixed".
Please confirm if you really sent the intended one.
Regards,
-- Yasuyuki Kozakai
^ permalink raw reply
* Re: [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: Harald Welte @ 2006-02-13 8:17 UTC (permalink / raw)
To: Yasuyuki KOZAKAI; +Cc: netdev, netfilter-devel, davem
In-Reply-To: <200602130132.k1D1WoYA003717@toshiba.co.jp>
[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]
On Mon, Feb 13, 2006 at 10:32:49AM +0900, Yasuyuki KOZAKAI wrote:
>
> Hi, Harald,
>
> From: Harald Welte <laforge@gnumonks.org>
> Date: Sun, 12 Feb 2006 18:56:22 +0100
>
> > [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
> >
> > This patch moves all helper related data fields of 'struct nf_conn' into a
> > separate structure 'struct nf_conn_help'. This new structure is only
> > present in conntrack entries for which we actually have a helper loaded.
> >
> > Also, this patch cleans up the nf_conntrack 'features' mechanism to
> > resemble what the original idea was: Just glue the feature-specific
> > data structures at the end of 'struct nf_conn', and explicitly re-calculate
> > the pointer to it when needed rather than keeping pointers around.
> >
> > Saves 20 bytes per conntrack on my x86_64 box. A non-helped conntrack is
> > 276 bytes. We still need to save another 20 bytes in order to fit into to
> > target of 256bytes.
> >
> > Signed-off-by: Harald Welte <laforge@netfilter.org>
>
> This patch seems not to include fixes I pointed out and you said "fixed".
> Please confirm if you really sent the intended one.
oops, thanks for checking. Dave: Please hold, I sent an old version.
You'll get a new one ASAP.
--
- Harald Welte <laforge@netfilter.org> http://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
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [RFC: 2.6 patch] CONFIG_FORCEDETH updates
From: Arthur Othieno @ 2006-02-13 8:36 UTC (permalink / raw)
To: Lee Revell; +Cc: Adrian Bunk, jgarzik, netdev, linux-kernel
In-Reply-To: <1139781817.19342.300.camel@mindpipe>
On Sun, Feb 12, 2006 at 05:03:36PM -0500, Lee Revell wrote:
> On Sun, 2006-02-12 at 18:52 +0100, Adrian Bunk wrote:
> > This patch contains the following possible updates:
> > - let FORCEDETH no longer depend on EXPERIMENTAL
> > - remove the "Reverse Engineered" from the option text:
> > for the user it's important which hardware the driver supports, not
> > how it was developed
>
> Is this driver as stable as one that was developed with proper
> documentation?
Been using it on nForce since v0.19 (circa 2003) with no problems.
I doubt there are that many (significant) users of the binary driver
left..
And like Alistair pointed out:
drivers/net/forcedeth:17: * Copyright (c) 2004 NVIDIA Corporation
> I prefer to know that something as elementary as a fast ethernet
> controller had to be reverse engineered so I can avoid supporting
> a vendor so hostile to Linux.
Then how about moving the "Reverse Engineered" to the help text instead?
^ permalink raw reply
* Re: [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: Harald Welte @ 2006-02-13 10:04 UTC (permalink / raw)
To: David Miller, Netfilter Development Mailinglist,
Linux Netdev List
In-Reply-To: <20060212175622.GG4601@sunbeam.de.gnumonks.org>
[-- Attachment #1: Type: text/plain, Size: 25327 bytes --]
Hi Dave!
This is the correct (latest) version of this patch. Sorry for the
confusion. Please apply to net-2.6.17, thanks!
[NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
This patch moves all helper related data fields of 'struct nf_conn' into a
separate structure 'struct nf_conn_help'. This new structure is only
present in conntrack entries for which we actually have a helper loaded.
Also, this patch cleans up the nf_conntrack 'features' mechanism to
resemble what the original idea was: Just glue the feature-specific
data structures at the end of 'struct nf_conn', and explicitly re-calculate
the pointer to it when needed rather than keeping pointers around.
Saves 20 bytes per conntrack on my x86_64 box. A non-helped conntrack is
276 bytes. We still need to save another 20 bytes in order to fit into to
target of 256bytes.
Signed-off-by: Harald Welte <laforge@netfilter.org>
---
commit aba8cf3ac5b60e10eb1ce9f30b6bb4c007ab9868
tree 758aedbe80b8306c1991a05c47eab8905d33a13b
parent 94d3d40c84672b74e59ea5252f61602610e1513e
author Harald Welte <laforge@netfilter.org> Sun, 29 Jan 2006 19:19:06 +0100
committer Harald Welte <laforge@netfilter.org> Sun, 29 Jan 2006 19:19:06 +0100
include/net/netfilter/nf_conntrack.h | 56 +++++++----
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 22 ++---
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 39 +++++---
net/netfilter/nf_conntrack_core.c | 117 ++++++++++--------------
net/netfilter/nf_conntrack_ftp.c | 2
net/netfilter/nf_conntrack_netlink.c | 39 +++++---
net/netfilter/nf_conntrack_standalone.c | 1
net/netfilter/xt_helper.c | 8 +-
8 files changed, 147 insertions(+), 137 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6d075ca..9d1f0e6 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -67,6 +67,18 @@ do { \
struct nf_conntrack_helper;
+/* nf_conn feature for connections that have a helper */
+struct nf_conn_help {
+ /* Helper. if any */
+ struct nf_conntrack_helper *helper;
+
+ union nf_conntrack_help help;
+
+ /* Current number of expected connections */
+ unsigned int expecting;
+};
+
+
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
struct nf_conn
{
@@ -81,6 +93,9 @@ struct nf_conn
/* Have we seen traffic both ways yet? (bitset) */
unsigned long status;
+ /* If we were expected by an expectation, this will be it */
+ struct nf_conn *master;
+
/* Timer function; drops refcnt when it goes off. */
struct timer_list timeout;
@@ -88,38 +103,22 @@ struct nf_conn
/* Accounting Information (same cache line as other written members) */
struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
#endif
- /* If we were expected by an expectation, this will be it */
- struct nf_conn *master;
-
- /* Current number of expected connections */
- unsigned int expecting;
/* Unique ID that identifies this conntrack*/
unsigned int id;
- /* Helper. if any */
- struct nf_conntrack_helper *helper;
-
/* features - nat, helper, ... used by allocating system */
u_int32_t features;
- /* Storage reserved for other modules: */
-
- union nf_conntrack_proto proto;
-
#if defined(CONFIG_NF_CONNTRACK_MARK)
u_int32_t mark;
#endif
- /* These members are dynamically allocated. */
-
- union nf_conntrack_help *help;
+ /* Storage reserved for other modules: */
+ union nf_conntrack_proto proto;
- /* Layer 3 dependent members. (ex: NAT) */
- union {
- struct nf_conntrack_ipv4 *ipv4;
- } l3proto;
- void *data[0];
+ /* features dynamically at the end: helper, nat (both optional) */
+ char data[0];
};
struct nf_conntrack_expect
@@ -373,10 +372,23 @@ nf_conntrack_expect_event(enum ip_conntr
#define NF_CT_F_NUM 4
extern int
-nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size,
- int (*init_conntrack)(struct nf_conn *, u_int32_t));
+nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
extern void
nf_conntrack_unregister_cache(u_int32_t features);
+/* valid combinations:
+ * basic: nf_conn, nf_conn .. nf_conn_help
+ * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help
+ */
+static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
+{
+ unsigned int offset = sizeof(struct nf_conn);
+
+ if (!(ct->features & NF_CT_F_HELP))
+ return NULL;
+
+ return (struct nf_conn_help *) ((void *)ct + offset);
+}
+
#endif /* __KERNEL__ */
#endif /* _NF_CONNTRACK_H */
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 167619f..e52b50b 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -141,19 +141,21 @@ static unsigned int ipv4_conntrack_help(
{
struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
+ struct nf_conn_help *help;
/* This is where we call the helper: as the packet goes out. */
ct = nf_ct_get(*pskb, &ctinfo);
- if (ct && ct->helper) {
- unsigned int ret;
- ret = ct->helper->help(pskb,
- (*pskb)->nh.raw - (*pskb)->data
- + (*pskb)->nh.iph->ihl*4,
- ct, ctinfo);
- if (ret != NF_ACCEPT)
- return ret;
- }
- return NF_ACCEPT;
+ if (!ct)
+ return NF_ACCEPT;
+
+ help = nfct_help(ct);
+ if (!help || !help->helper)
+ return NF_ACCEPT;
+
+ return help->helper->help(pskb,
+ (*pskb)->nh.raw - (*pskb)->data
+ + (*pskb)->nh.iph->ihl*4,
+ ct, ctinfo);
}
static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index ac702a2..ac35f95 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -179,31 +179,36 @@ static unsigned int ipv6_confirm(unsigne
int (*okfn)(struct sk_buff *))
{
struct nf_conn *ct;
+ struct nf_conn_help *help;
enum ip_conntrack_info ctinfo;
+ unsigned int ret, protoff;
+ unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
+ - (*pskb)->data;
+ unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
+
/* This is where we call the helper: as the packet goes out. */
ct = nf_ct_get(*pskb, &ctinfo);
- if (ct && ct->helper) {
- unsigned int ret, protoff;
- unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
- - (*pskb)->data;
- unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
-
- protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
- (*pskb)->len - extoff);
- if (protoff < 0 || protoff > (*pskb)->len ||
- pnum == NEXTHDR_FRAGMENT) {
- DEBUGP("proto header not found\n");
- return NF_ACCEPT;
- }
+ if (!ct)
+ goto out;
- ret = ct->helper->help(pskb, protoff, ct, ctinfo);
- if (ret != NF_ACCEPT)
- return ret;
+ help = nfct_help(ct);
+ if (!help || !help->helper)
+ goto out;
+
+ protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
+ (*pskb)->len - extoff);
+ if (protoff < 0 || protoff > (*pskb)->len ||
+ pnum == NEXTHDR_FRAGMENT) {
+ DEBUGP("proto header not found\n");
+ return NF_ACCEPT;
}
+ ret = help->helper->help(pskb, protoff, ct, ctinfo);
+ if (ret != NF_ACCEPT)
+ return ret;
+out:
/* We've seen it coming out the other side: confirm it */
-
return nf_conntrack_confirm(pskb);
}
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 0ce337a..ece4e83 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -3,7 +3,7 @@
extension. */
/* (C) 1999-2001 Paul `Rusty' Russell
- * (C) 2002-2005 Netfilter Core Team <coreteam@netfilter.org>
+ * (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org>
* (C) 2003,2004 USAGI/WIDE Project <http://www.linux-ipv6.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,9 @@
* - generalize L3 protocol denendent part.
* 23 Mar 2004: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
* - add support various size of conntrack structures.
+ * 26 Jan 2006: Harald Welte <laforge@netfilter.org>
+ * - restructure nf_conn (introduce nf_conn_help)
+ * - redesign 'features' how they were originally intended
*
* Derived from net/ipv4/netfilter/ip_conntrack_core.c
*/
@@ -55,7 +58,7 @@
#include <net/netfilter/nf_conntrack_core.h>
#include <linux/netfilter_ipv4/listhelp.h>
-#define NF_CONNTRACK_VERSION "0.4.1"
+#define NF_CONNTRACK_VERSION "0.5.0"
#if 0
#define DEBUGP printk
@@ -259,21 +262,8 @@ static inline u_int32_t hash_conntrack(c
nf_conntrack_hash_rnd);
}
-/* Initialize "struct nf_conn" which has spaces for helper */
-static int
-init_conntrack_for_helper(struct nf_conn *conntrack, u_int32_t features)
-{
-
- conntrack->help = (union nf_conntrack_help *)
- (((unsigned long)conntrack->data
- + (__alignof__(union nf_conntrack_help) - 1))
- & (~((unsigned long)(__alignof__(union nf_conntrack_help) -1))));
- return 0;
-}
-
int nf_conntrack_register_cache(u_int32_t features, const char *name,
- size_t size,
- int (*init)(struct nf_conn *, u_int32_t))
+ size_t size)
{
int ret = 0;
char *cache_name;
@@ -296,8 +286,7 @@ int nf_conntrack_register_cache(u_int32_
DEBUGP("nf_conntrack_register_cache: already resisterd.\n");
if ((!strncmp(nf_ct_cache[features].name, name,
NF_CT_FEATURES_NAMELEN))
- && nf_ct_cache[features].size == size
- && nf_ct_cache[features].init_conntrack == init) {
+ && nf_ct_cache[features].size == size) {
DEBUGP("nf_conntrack_register_cache: reusing.\n");
nf_ct_cache[features].use++;
ret = 0;
@@ -340,7 +329,6 @@ int nf_conntrack_register_cache(u_int32_
write_lock_bh(&nf_ct_cache_lock);
nf_ct_cache[features].use = 1;
nf_ct_cache[features].size = size;
- nf_ct_cache[features].init_conntrack = init;
nf_ct_cache[features].cachep = cachep;
nf_ct_cache[features].name = cache_name;
write_unlock_bh(&nf_ct_cache_lock);
@@ -377,7 +365,6 @@ void nf_conntrack_unregister_cache(u_int
name = nf_ct_cache[features].name;
nf_ct_cache[features].cachep = NULL;
nf_ct_cache[features].name = NULL;
- nf_ct_cache[features].init_conntrack = NULL;
nf_ct_cache[features].size = 0;
write_unlock_bh(&nf_ct_cache_lock);
@@ -432,11 +419,15 @@ nf_ct_invert_tuple(struct nf_conntrack_t
/* nf_conntrack_expect helper functions */
void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
{
+ struct nf_conn_help *master_help = nfct_help(exp->master);
+
+ NF_CT_ASSERT(master_help);
ASSERT_WRITE_LOCK(&nf_conntrack_lock);
NF_CT_ASSERT(!timer_pending(&exp->timeout));
+
list_del(&exp->list);
NF_CT_STAT_INC(expect_delete);
- exp->master->expecting--;
+ master_help->expecting--;
nf_conntrack_expect_put(exp);
}
@@ -508,9 +499,10 @@ find_expectation(const struct nf_conntra
void nf_ct_remove_expectations(struct nf_conn *ct)
{
struct nf_conntrack_expect *i, *tmp;
+ struct nf_conn_help *help = nfct_help(ct);
/* Optimization: most connection never expect any others. */
- if (ct->expecting == 0)
+ if (!help || help->expecting == 0)
return;
list_for_each_entry_safe(i, tmp, &nf_conntrack_expect_list, list) {
@@ -713,6 +705,7 @@ __nf_conntrack_confirm(struct sk_buff **
conntrack_tuple_cmp,
struct nf_conntrack_tuple_hash *,
&ct->tuplehash[IP_CT_DIR_REPLY].tuple, NULL)) {
+ struct nf_conn_help *help;
/* Remove from unconfirmed list */
list_del(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list);
@@ -726,7 +719,8 @@ __nf_conntrack_confirm(struct sk_buff **
set_bit(IPS_CONFIRMED_BIT, &ct->status);
NF_CT_STAT_INC(insert);
write_unlock_bh(&nf_conntrack_lock);
- if (ct->helper)
+ help = nfct_help(ct);
+ if (help && help->helper)
nf_conntrack_event_cache(IPCT_HELPER, *pskb);
#ifdef CONFIG_NF_NAT_NEEDED
if (test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status) ||
@@ -842,8 +836,9 @@ __nf_conntrack_alloc(const struct nf_con
{
struct nf_conn *conntrack = NULL;
u_int32_t features = 0;
+ struct nf_conntrack_helper *helper;
- if (!nf_conntrack_hash_rnd_initted) {
+ if (unlikely(!nf_conntrack_hash_rnd_initted)) {
get_random_bytes(&nf_conntrack_hash_rnd, 4);
nf_conntrack_hash_rnd_initted = 1;
}
@@ -863,8 +858,11 @@ __nf_conntrack_alloc(const struct nf_con
/* find features needed by this conntrack. */
features = l3proto->get_features(orig);
+
+ /* FIXME: protect helper list per RCU */
read_lock_bh(&nf_conntrack_lock);
- if (__nf_ct_helper_find(repl) != NULL)
+ helper = __nf_ct_helper_find(repl);
+ if (helper)
features |= NF_CT_F_HELP;
read_unlock_bh(&nf_conntrack_lock);
@@ -872,7 +870,7 @@ __nf_conntrack_alloc(const struct nf_con
read_lock_bh(&nf_ct_cache_lock);
- if (!nf_ct_cache[features].use) {
+ if (unlikely(!nf_ct_cache[features].use)) {
DEBUGP("nf_conntrack_alloc: not supported features = 0x%x\n",
features);
goto out;
@@ -886,12 +884,10 @@ __nf_conntrack_alloc(const struct nf_con
memset(conntrack, 0, nf_ct_cache[features].size);
conntrack->features = features;
- if (nf_ct_cache[features].init_conntrack &&
- nf_ct_cache[features].init_conntrack(conntrack, features) < 0) {
- DEBUGP("nf_conntrack_alloc: failed to init\n");
- kmem_cache_free(nf_ct_cache[features].cachep, conntrack);
- conntrack = NULL;
- goto out;
+ if (helper) {
+ struct nf_conn_help *help = nfct_help(conntrack);
+ NF_CT_ASSERT(help);
+ help->helper = helper;
}
atomic_set(&conntrack->ct_general.use, 1);
@@ -972,11 +968,8 @@ init_conntrack(const struct nf_conntrack
#endif
nf_conntrack_get(&conntrack->master->ct_general);
NF_CT_STAT_INC(expect_new);
- } else {
- conntrack->helper = __nf_ct_helper_find(&repl_tuple);
-
+ } else
NF_CT_STAT_INC(new);
- }
/* Overload tuple linked list to put us in unconfirmed list. */
list_add(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].list, &unconfirmed);
@@ -1206,14 +1199,16 @@ void nf_conntrack_expect_put(struct nf_c
static void nf_conntrack_expect_insert(struct nf_conntrack_expect *exp)
{
+ struct nf_conn_help *master_help = nfct_help(exp->master);
+
atomic_inc(&exp->use);
- exp->master->expecting++;
+ master_help->expecting++;
list_add(&exp->list, &nf_conntrack_expect_list);
init_timer(&exp->timeout);
exp->timeout.data = (unsigned long)exp;
exp->timeout.function = expectation_timed_out;
- exp->timeout.expires = jiffies + exp->master->helper->timeout * HZ;
+ exp->timeout.expires = jiffies + master_help->helper->timeout * HZ;
add_timer(&exp->timeout);
exp->id = ++nf_conntrack_expect_next_id;
@@ -1239,10 +1234,12 @@ static void evict_oldest_expect(struct n
static inline int refresh_timer(struct nf_conntrack_expect *i)
{
+ struct nf_conn_help *master_help = nfct_help(i->master);
+
if (!del_timer(&i->timeout))
return 0;
- i->timeout.expires = jiffies + i->master->helper->timeout*HZ;
+ i->timeout.expires = jiffies + master_help->helper->timeout*HZ;
add_timer(&i->timeout);
return 1;
}
@@ -1251,8 +1248,11 @@ int nf_conntrack_expect_related(struct n
{
struct nf_conntrack_expect *i;
struct nf_conn *master = expect->master;
+ struct nf_conn_help *master_help = nfct_help(master);
int ret;
+ NF_CT_ASSERT(master_help);
+
DEBUGP("nf_conntrack_expect_related %p\n", related_to);
DEBUGP("tuple: "); NF_CT_DUMP_TUPLE(&expect->tuple);
DEBUGP("mask: "); NF_CT_DUMP_TUPLE(&expect->mask);
@@ -1271,8 +1271,8 @@ int nf_conntrack_expect_related(struct n
}
}
/* Will be over limit? */
- if (master->helper->max_expected &&
- master->expecting >= master->helper->max_expected)
+ if (master_help->helper->max_expected &&
+ master_help->expecting >= master_help->helper->max_expected)
evict_oldest_expect(master);
nf_conntrack_expect_insert(expect);
@@ -1283,24 +1283,6 @@ out:
return ret;
}
-/* Alter reply tuple (maybe alter helper). This is for NAT, and is
- implicitly racy: see __nf_conntrack_confirm */
-void nf_conntrack_alter_reply(struct nf_conn *conntrack,
- const struct nf_conntrack_tuple *newreply)
-{
- write_lock_bh(&nf_conntrack_lock);
- /* Should be unconfirmed, so not in hash table yet */
- NF_CT_ASSERT(!nf_ct_is_confirmed(conntrack));
-
- DEBUGP("Altering reply tuple of %p to ", conntrack);
- NF_CT_DUMP_TUPLE(newreply);
-
- conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
- if (!conntrack->master && conntrack->expecting == 0)
- conntrack->helper = __nf_ct_helper_find(newreply);
- write_unlock_bh(&nf_conntrack_lock);
-}
-
int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
{
int ret;
@@ -1308,9 +1290,8 @@ int nf_conntrack_helper_register(struct
ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help",
sizeof(struct nf_conn)
- + sizeof(union nf_conntrack_help)
- + __alignof__(union nf_conntrack_help),
- init_conntrack_for_helper);
+ + sizeof(struct nf_conn_help)
+ + __alignof__(struct nf_conn_help));
if (ret < 0) {
printk(KERN_ERR "nf_conntrack_helper_reigster: Unable to create slab cache for conntracks\n");
return ret;
@@ -1338,9 +1319,12 @@ __nf_conntrack_helper_find_byname(const
static inline int unhelp(struct nf_conntrack_tuple_hash *i,
const struct nf_conntrack_helper *me)
{
- if (nf_ct_tuplehash_to_ctrack(i)->helper == me) {
- nf_conntrack_event(IPCT_HELPER, nf_ct_tuplehash_to_ctrack(i));
- nf_ct_tuplehash_to_ctrack(i)->helper = NULL;
+ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(i);
+ struct nf_conn_help *help = nfct_help(ct);
+
+ if (help && help->helper == me) {
+ nf_conntrack_event(IPCT_HELPER, ct);
+ help->helper = NULL;
}
return 0;
}
@@ -1356,7 +1340,8 @@ void nf_conntrack_helper_unregister(stru
/* Get rid of expectations */
list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list, list) {
- if (exp->master->helper == me && del_timer(&exp->timeout)) {
+ struct nf_conn_help *help = nfct_help(exp->master);
+ if (help->helper == me && del_timer(&exp->timeout)) {
nf_ct_unlink_expect(exp);
nf_conntrack_expect_put(exp);
}
@@ -1695,7 +1680,7 @@ int __init nf_conntrack_init(void)
}
ret = nf_conntrack_register_cache(NF_CT_F_BASIC, "nf_conntrack:basic",
- sizeof(struct nf_conn), NULL);
+ sizeof(struct nf_conn));
if (ret < 0) {
printk(KERN_ERR "Unable to create nf_conn slab cache\n");
goto err_free_hash;
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 6f210f3..cd191b0 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -440,7 +440,7 @@ static int help(struct sk_buff **pskb,
u32 seq;
int dir = CTINFO2DIR(ctinfo);
unsigned int matchlen, matchoff;
- struct ip_ct_ftp_master *ct_ftp_info = &ct->help->ct_ftp_info;
+ struct ip_ct_ftp_master *ct_ftp_info = &nfct_help(ct)->help.ct_ftp_info;
struct nf_conntrack_expect *exp;
struct nf_conntrack_man cmd = {};
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9ff3463..f0d6fc9 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2,7 +2,7 @@
* protocol helpers and general trouble making from userspace.
*
* (C) 2001 by Jay Schulist <jschlst@samba.org>
- * (C) 2002-2005 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org>
* (C) 2003 by Patrick Mchardy <kaber@trash.net>
* (C) 2005 by Pablo Neira Ayuso <pablo@eurodev.net>
*
@@ -44,7 +44,7 @@
MODULE_LICENSE("GPL");
-static char __initdata version[] = "0.92";
+static char __initdata version[] = "0.93";
#if 0
#define DEBUGP printk
@@ -165,15 +165,16 @@ static inline int
ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct nf_conn *ct)
{
struct nfattr *nest_helper;
+ const struct nf_conn_help *help = nfct_help(ct);
- if (!ct->helper)
+ if (!help || !help->helper)
return 0;
nest_helper = NFA_NEST(skb, CTA_HELP);
- NFA_PUT(skb, CTA_HELP_NAME, strlen(ct->helper->name), ct->helper->name);
+ NFA_PUT(skb, CTA_HELP_NAME, strlen(help->helper->name), help->helper->name);
- if (ct->helper->to_nfattr)
- ct->helper->to_nfattr(skb, ct);
+ if (help->helper->to_nfattr)
+ help->helper->to_nfattr(skb, ct);
NFA_NEST_END(skb, nest_helper);
@@ -903,11 +904,17 @@ static inline int
ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
{
struct nf_conntrack_helper *helper;
+ struct nf_conn_help *help = nfct_help(ct);
char *helpname;
int err;
DEBUGP("entered %s\n", __FUNCTION__);
+ if (!help) {
+ /* FIXME: we need to reallocate and rehash */
+ return -EBUSY;
+ }
+
/* don't change helper of sibling connections */
if (ct->master)
return -EINVAL;
@@ -924,18 +931,18 @@ ctnetlink_change_helper(struct nf_conn *
return -EINVAL;
}
- if (ct->helper) {
+ if (help->helper) {
if (!helper) {
/* we had a helper before ... */
nf_ct_remove_expectations(ct);
- ct->helper = NULL;
+ help->helper = NULL;
} else {
/* need to zero data of old helper */
- memset(&ct->help, 0, sizeof(ct->help));
+ memset(&help->help, 0, sizeof(help->help));
}
}
- ct->helper = helper;
+ help->helper = helper;
return 0;
}
@@ -1050,14 +1057,9 @@ ctnetlink_create_conntrack(struct nfattr
ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
#endif
- ct->helper = nf_ct_helper_find_get(rtuple);
-
add_timer(&ct->timeout);
nf_conntrack_hash_insert(ct);
- if (ct->helper)
- nf_ct_helper_put(ct->helper);
-
DEBUGP("conntrack with id %u inserted\n", ct->id);
return 0;
@@ -1417,7 +1419,8 @@ ctnetlink_del_expect(struct sock *ctnl,
}
list_for_each_entry_safe(exp, tmp, &nf_conntrack_expect_list,
list) {
- if (exp->master->helper == h
+ struct nf_conn_help *m_help = nfct_help(exp->master);
+ if (m_help->helper == h
&& del_timer(&exp->timeout)) {
nf_ct_unlink_expect(exp);
nf_conntrack_expect_put(exp);
@@ -1452,6 +1455,7 @@ ctnetlink_create_expect(struct nfattr *c
struct nf_conntrack_tuple_hash *h = NULL;
struct nf_conntrack_expect *exp;
struct nf_conn *ct;
+ struct nf_conn_help *help;
int err = 0;
DEBUGP("entered %s\n", __FUNCTION__);
@@ -1472,8 +1476,9 @@ ctnetlink_create_expect(struct nfattr *c
if (!h)
return -ENOENT;
ct = nf_ct_tuplehash_to_ctrack(h);
+ help = nfct_help(ct);
- if (!ct->helper) {
+ if (!help || !help->helper) {
/* such conntrack hasn't got any helper, abort */
err = -EINVAL;
goto out;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 617599a..290d5a0 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -839,7 +839,6 @@ EXPORT_SYMBOL(nf_conntrack_l3proto_unreg
EXPORT_SYMBOL(nf_conntrack_protocol_register);
EXPORT_SYMBOL(nf_conntrack_protocol_unregister);
EXPORT_SYMBOL(nf_ct_invert_tuplepr);
-EXPORT_SYMBOL(nf_conntrack_alter_reply);
EXPORT_SYMBOL(nf_conntrack_destroyed);
EXPORT_SYMBOL(need_conntrack);
EXPORT_SYMBOL(nf_conntrack_helper_register);
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 38b6715..c451169 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -96,6 +96,7 @@ match(const struct sk_buff *skb,
{
const struct xt_helper_info *info = matchinfo;
struct nf_conn *ct;
+ struct nf_conn_help *master_help;
enum ip_conntrack_info ctinfo;
int ret = info->invert;
@@ -111,7 +112,8 @@ match(const struct sk_buff *skb,
}
read_lock_bh(&nf_conntrack_lock);
- if (!ct->master->helper) {
+ master_help = nfct_help(ct->master);
+ if (!master_help || !master_help->helper) {
DEBUGP("xt_helper: master ct %p has no helper\n",
exp->expectant);
goto out_unlock;
@@ -123,8 +125,8 @@ match(const struct sk_buff *skb,
if (info->name[0] == '\0')
ret ^= 1;
else
- ret ^= !strncmp(ct->master->helper->name, info->name,
- strlen(ct->master->helper->name));
+ ret ^= !strncmp(master_help->helper->name, info->name,
+ strlen(master_help->helper->name));
out_unlock:
read_unlock_bh(&nf_conntrack_lock);
return ret;
--
- Harald Welte <laforge@netfilter.org> http://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
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related
* Re: [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: David S. Miller @ 2006-02-13 10:29 UTC (permalink / raw)
To: laforge; +Cc: netdev, netfilter-devel, yasuyuki.kozakai
In-Reply-To: <20060213081758.GL4601@sunbeam.de.gnumonks.org>
From: Harald Welte <laforge@netfilter.org>
Date: Mon, 13 Feb 2006 09:17:58 +0100
> Dave: Please hold, I sent an old version.
> You'll get a new one ASAP.
OK.
^ permalink raw reply
* Re: [PATCH] [NETFILTER] nf_conntrack: clean up to reduce size of 'struct nf_conn'
From: David S. Miller @ 2006-02-13 10:36 UTC (permalink / raw)
To: laforge; +Cc: netdev, netfilter-devel
In-Reply-To: <20060213100436.GP4601@sunbeam.de.gnumonks.org>
From: Harald Welte <laforge@netfilter.org>
Date: Mon, 13 Feb 2006 11:04:36 +0100
> This is the correct (latest) version of this patch. Sorry for the
> confusion. Please apply to net-2.6.17, thanks!
Applied, thanks.
^ permalink raw reply
* 2.6.16, sk98lin out of date
From: Alistair John Strachan @ 2006-02-13 10:58 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
Hi,
As I'm sure the drivers/net maintainers are well aware, SysKonnect constantly
update their sk98lin/sky2 driver without bothering to sync their changes with
the official linux kernel.
I quickly downloaded driver version 8.31 from http://www.skd.de/ today and
used the install script to generate a diff against 2.6.16-rc3. Even after
fixing up some DOS EOLs in the package, the diff was still well over 1.5MBs.
This is an enormous number of changes.
The reason I'm posting is that my DFI LanParty-UT SLI-D works with this
version of the driver, but not the version 2.6.16-rc3.
[alistair] 10:55 [~] dmesg | grep sk98lin
sk98lin: Could not read VPD data.
sk98lin: probe of 0000:01:0a.0 failed with error -5
I wonder if it's worth just identifying the "quick fix" (I've seen workarounds
for corrupt VPDs like mine) or whether a general merge up would be
beneficial..
If nobody's maintaining this driver I wouldn't mind helping out.
--
Cheers,
Alistair.
'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox