Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: David S. Miller @ 2005-07-28 22:44 UTC (permalink / raw)
  To: dada1; +Cc: netdev
In-Reply-To: <42E94D11.4090002@cosmosbay.com>

From: Eric Dumazet <dada1@cosmosbay.com>
Date: Thu, 28 Jul 2005 23:24:33 +0200

> On a dual opteron machine, this thing from ip_route_input() is very expensive :
> 
>   RT_CACHE_STAT_INC(in_hlist_search);

That's amazing since it's per-cpu.  I don't have any suggestions
besides your idea to increment it once using an accumulation local
variable.

^ permalink raw reply

* Re: [2.6 patch] net: Spelling mistakes threshoulds -> thresholds
From: David S. Miller @ 2005-07-29  3:30 UTC (permalink / raw)
  To: bunk; +Cc: netdev, linux-kernel, baruch
In-Reply-To: <20050728220410.GG4790@stusta.de>

From: Adrian Bunk <bunk@stusta.de>
Date: Fri, 29 Jul 2005 00:04:10 +0200

> Just simple spelling mistake fixes.
> 
> From: aruch Even <baruch@ev-en.org>
> 
> Signed-Off-By: Baruch Even <baruch@ev-en.org>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

The include/net/tcp.h part of this patch no longer
applies cleanly.

^ permalink raw reply

* Re: [2.6 patch] net: Spelling mistakes threshoulds -> thresholds
From: Baruch Even @ 2005-07-29 10:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: bunk, netdev, linux-kernel
In-Reply-To: <20050728.203021.35467760.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 84 bytes --]

Just simple spelling mistake fixes.

Signed-Off-By: Baruch Even <baruch@ev-en.org>


[-- Attachment #2: threshould.diff --]
[-- Type: text/plain, Size: 1676 bytes --]

diff -Nurp 2.6.13-rc4-orig/include/net/tcp.h 2.6.13-rc4/include/net/tcp.h
--- 2.6.13-rc4-orig/include/net/tcp.h	2005-07-29 11:17:25.000000000 +0100
+++ 2.6.13-rc4/include/net/tcp.h	2005-07-29 11:14:28.000000000 +0100
@@ -1236,7 +1236,7 @@ static inline void tcp_sync_left_out(str
 	tp->left_out = tp->sacked_out + tp->lost_out;
 }
 
-/* Set slow start threshould and cwnd not falling to slow start */
+/* Set slow start threshold and cwnd not falling to slow start */
 static inline void __tcp_enter_cwr(struct tcp_sock *tp)
 {
 	tp->undo_marker = 0;
diff -Nurp 2.6.13-rc4-orig/net/ipv4/ipmr.c 2.6.13-rc4/net/ipv4/ipmr.c
--- 2.6.13-rc4-orig/net/ipv4/ipmr.c	2005-07-29 11:17:25.000000000 +0100
+++ 2.6.13-rc4/net/ipv4/ipmr.c	2005-07-29 11:14:28.000000000 +0100
@@ -362,7 +362,7 @@ out:
 
 /* Fill oifs list. It is called under write locked mrt_lock. */
 
-static void ipmr_update_threshoulds(struct mfc_cache *cache, unsigned char *ttls)
+static void ipmr_update_thresholds(struct mfc_cache *cache, unsigned char *ttls)
 {
 	int vifi;
 
@@ -727,7 +727,7 @@ static int ipmr_mfc_add(struct mfcctl *m
 	if (c != NULL) {
 		write_lock_bh(&mrt_lock);
 		c->mfc_parent = mfc->mfcc_parent;
-		ipmr_update_threshoulds(c, mfc->mfcc_ttls);
+		ipmr_update_thresholds(c, mfc->mfcc_ttls);
 		if (!mrtsock)
 			c->mfc_flags |= MFC_STATIC;
 		write_unlock_bh(&mrt_lock);
@@ -744,7 +744,7 @@ static int ipmr_mfc_add(struct mfcctl *m
 	c->mfc_origin=mfc->mfcc_origin.s_addr;
 	c->mfc_mcastgrp=mfc->mfcc_mcastgrp.s_addr;
 	c->mfc_parent=mfc->mfcc_parent;
-	ipmr_update_threshoulds(c, mfc->mfcc_ttls);
+	ipmr_update_thresholds(c, mfc->mfcc_ttls);
 	if (!mrtsock)
 		c->mfc_flags |= MFC_STATIC;
 

^ permalink raw reply

* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: Robert Olsson @ 2005-07-29 14:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, netdev
In-Reply-To: <42E94D11.4090002@cosmosbay.com>


Eric Dumazet writes:

 > I have no profiling info for this exact patch, I'm sorry David.
 > On a dual opteron machine, this thing from ip_route_input() is very expensive :
 > 
 >   RT_CACHE_STAT_INC(in_hlist_search);
 > 
 > ip_route_input() use a total of 3.4563 % of one cpu, but this 'increment' takes 1.20 % !!!

 Very weird if the statscounter taking a third of ip_route_input.

 > Sometime I wonder if oprofile can be trusted :(
 > 
 > Maybe we should increment a counter on the stack and do a final
 >     if (counter != 0)
 >         RT_CACHE_STAT_ADD(in_hlist_search, counter);

 My experiences from playing with prefetching eth_type_trans in this 
 case. One must look in the total performance not just were the 
 prefetching is done. In this case I was able to get eth_type_trans
 down in the profile list but other functions increased so performance
 was the same or lower. This needs to be sorted out... 

 Cheers.
					--ro

^ permalink raw reply

* Re: [hipl-users] Re: [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Diego Beltrami @ 2005-07-29 15:33 UTC (permalink / raw)
  To: herbert; +Cc: infrahip, netdev
In-Reply-To: <E1Dy6gb-00044G-00@gondolin.me.apana.org.au>

> Diego Beltrami <diego.beltrami@hiit.fi> wrote:
> > 
> > we have been working for three months to implement a new IPsec mode,
> > the "BEET" mode, for Linux. Below is a link to the BEET specification
> > and
> > the abstract:
> > 
> > http://www.ietf.org/internet-drafts/draft-nikander-esp-beet-mode-03.txt
> 
> Thanks for the patch guys, this is really interesting.

Thanks Herbert for your feedback!


> > extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type);
> > diff -urN linux-2.6.12.2/net/ipv4/esp4.c
> > linux-beet-2.6.12.2/net/ipv4/esp4.c
> > --- linux-2.6.12.2/net/ipv4/esp4.c      2005-06-30 02:00:53.000000000 +0300
> > +++ linux-beet-2.6.12.2/net/ipv4/esp4.c 2005-07-25 14:39:11.000000000
> 
> Although the document only talks about ESP, as far as I can see
> the encapsulation can be applied to AH/IPComp just as well.
> So how about moving this stuff to the generic xfrm_input/xfrm_output
> functions?

The BEET code is already present in xfrm_input/xfrm_output functions and
it applies ESP encapsulation merely because of SA and SP set by means
setkey. As a consequence, if SA and SP are correctly set for AH the flow
goes through the AH functions. 

The modifications in the ESP functions are due to the hybrid cases when
Inner and Outer address families are different; in those cases the
values returned by espX functions are not coherent.

I tried to change SA and SP so that AH is used and the flow correctly
goes through AH functions but the problem has been revealed to be
something else. In particular, it seems that the AH functions deal with
the pointers contained in skb (skb->data, skb->nh, skb->h etc) in a
slightly different way than ESP functions. (Can anyone say more?)

Surely BEET will work also for AH with minor changes, even though we
only tried the ESP encapsulation.
This will require some time to inspect and analyze the exact situation.

In any case, as a result, I would say the code is already generic
itself.


On the other hand I don't know about IPComp, so I wouldn't say anything.
Hence if You could please give some hints, they will be more than
appreciated.

> 
> Also, if you're going to do cross-family transforms, it should be
> done for both BEET and plain tunnel-mode.

Potentially it could be possible also for plain tunnel-mode: this will
require further analysis.

For further discussion and advice, please give feedback.
Thank You very much!

Cheers,

--Diego

^ permalink raw reply

* Re: [Infrahip] Re: [hipl-users] Re: [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Pekka Nikander @ 2005-07-29 15:45 UTC (permalink / raw)
  To: diego.beltrami; +Cc: herbert, netdev, infrahip
In-Reply-To: <1122651216.25842.67.camel@odysse>

> Surely BEET will work also for AH with minor changes, even though we
> only tried the ESP encapsulation.

I wouldn't be so sure.  IIRC, tunnel mode is not specified for AH but  
for ESP only.  Consequently, defining BEET mode for AH might be  
pretty tricky.  OTOH, I don't know the linux IPsec implementation so  
that it might be possible to make BEET to "work" for AH, for some  
value of "work", but it probably would require some careful thinking  
to define the exact semantics, like what addresses (inner or outer)  
are covered by the AH integrity protection, what does the integrity  
protection really assert, etc.

--Pekka

^ permalink raw reply

* RE: [PATCH 2.6.12.1 5/12] S2io: Performance improvements
From: Ravinandan Arakali @ 2005-07-29 16:37 UTC (permalink / raw)
  To: 'David S. Miller'
  Cc: hch, raghavendra.koushik, jgarzik, netdev, leonid.grossman,
	rapuru.sriram
In-Reply-To: <20050712.140411.41107257.davem@davemloft.net>

David,
We are trying to use the "default" directive in Kconfig. We tried
using an unconditional directive(just to test it out) such as
"default y" and a conditional one such as "default y if
CONFIG_IA64_SGI_SN2".

But when we run "make menuconfig", it does not seem to pickup any of these
changes from Kconfig.
Any idea what we might be missing ?

Once this is fixed, we'll send out a patch to address comments from
previous 12 patches as well as couple of issues we found in the
meantime.

Thanks,
Ravi

-----Original Message-----
From: David S. Miller [mailto:davem@davemloft.net]
Sent: Tuesday, July 12, 2005 2:04 PM
To: ravinandan.arakali@neterion.com
Cc: hch@infradead.org; raghavendra.koushik@neterion.com;
jgarzik@pobox.com; netdev@oss.sgi.com; leonid.grossman@neterion.com;
rapuru.sriram@neterion.com
Subject: Re: [PATCH 2.6.12.1 5/12] S2io: Performance improvements


From: "Ravinandan Arakali" <ravinandan.arakali@neterion.com>
Subject: RE: [PATCH 2.6.12.1 5/12] S2io: Performance improvements
Date: Tue, 12 Jul 2005 14:00:52 -0700

> The two-buffer mode was added as a configurable option
> to Kconfig file several months ago. Hence the macro
> is CONFIG_2BUFF_MODE.

We're saying that you should choose CONFIG_2BUFF_MODE, when
CONFIG_IA64_SGI_SN2 is set, inside the Kconfig file using the
"default" Kconfig directive.

You should never change the setting of CONFIG_* macros in C source.

^ permalink raw reply

* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: Rick Jones @ 2005-07-29 17:06 UTC (permalink / raw)
  To: netdev
In-Reply-To: <17130.16951.581026.863431@robur.slu.se>

Robert Olsson wrote:
> Eric Dumazet writes:
> 
>  > I have no profiling info for this exact patch, I'm sorry David.
>  > On a dual opteron machine, this thing from ip_route_input() is very expensive :
>  > 
>  >   RT_CACHE_STAT_INC(in_hlist_search);
>  > 
>  > ip_route_input() use a total of 3.4563 % of one cpu, but this 'increment' takes 1.20 % !!!
> 
>  Very weird if the statscounter taking a third of ip_route_input.
> 
>  > Sometime I wonder if oprofile can be trusted :(
>  > 
>  > Maybe we should increment a counter on the stack and do a final
>  >     if (counter != 0)
>  >         RT_CACHE_STAT_ADD(in_hlist_search, counter);
> 
>  My experiences from playing with prefetching eth_type_trans in this 
>  case. One must look in the total performance not just were the 
>  prefetching is done. In this case I was able to get eth_type_trans
>  down in the profile list but other functions increased so performance
>  was the same or lower. This needs to be sorted out... 

How many of the architectures have PMU's that can give us cache miss statistics? 
  Itanium does, and can go so far as to tell us which addresses and instructions 
are involved - do the others?

That sort of data would seem to be desirable in this sort of situation.

rick jones

^ permalink raw reply

* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: Robert Olsson @ 2005-07-29 17:44 UTC (permalink / raw)
  To: Rick Jones; +Cc: netdev
In-Reply-To: <42EA6202.703@hp.com>


Rick Jones writes:

 > >  My experiences from playing with prefetching eth_type_trans in this 
 > >  case. One must look in the total performance not just were the 
 > >  prefetching is done. In this case I was able to get eth_type_trans
 > >  down in the profile list but other functions increased so performance
 > >  was the same or lower. This needs to be sorted out... 
 > 
 > How many of the architectures have PMU's that can give us cache miss statistics? 
 >   Itanium does, and can go so far as to tell us which addresses and instructions 
 > are involved - do the others?

 I've seem XEON and Opterons has performance counters for this that can 
 be used with oprofile. Intel has a document (was it an application note?) 
 describing prefetching. Really a lot of things to consider to become 
 successful.

 > That sort of data would seem to be desirable in this sort of situation.

 Also what scenario code patch and load we optimizing for Eric mentioned 
 this briefly. 

 Cheers.
					--ro


 

^ permalink raw reply

* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: Eric Dumazet @ 2005-07-29 17:57 UTC (permalink / raw)
  To: Rick Jones; +Cc: netdev, David S. Miller, Robert Olsson
In-Reply-To: <42EA6202.703@hp.com>

Rick Jones a écrit :
> Robert Olsson wrote:
> 
>> Eric Dumazet writes:
>>
>>  > I have no profiling info for this exact patch, I'm sorry David.
>>  > On a dual opteron machine, this thing from ip_route_input() is very 
>> expensive :
>>  >  >   RT_CACHE_STAT_INC(in_hlist_search);
>>  >  > ip_route_input() use a total of 3.4563 % of one cpu, but this 
>> 'increment' takes 1.20 % !!!
>>
>>  Very weird if the statscounter taking a third of ip_route_input.
>>
>>  > Sometime I wonder if oprofile can be trusted :(
>>  >  > Maybe we should increment a counter on the stack and do a final
>>  >     if (counter != 0)
>>  >         RT_CACHE_STAT_ADD(in_hlist_search, counter);
>>
>>  My experiences from playing with prefetching eth_type_trans in this 
>>  case. One must look in the total performance not just were the 
>>  prefetching is done. In this case I was able to get eth_type_trans
>>  down in the profile list but other functions increased so performance
>>  was the same or lower. This needs to be sorted out... 
> 
> 
> How many of the architectures have PMU's that can give us cache miss 
> statistics?  Itanium does, and can go so far as to tell us which 
> addresses and instructions are involved - do the others?
> 
> That sort of data would seem to be desirable in this sort of situation.
> 
> rick jones
> 
> 

oprofile on AMD64 can gather lots of data, DATA_CACHE_MISSES for example...

But I think I know what happens...

nm -v /usr/src/linux/vmlinux | grep -5 rt_cache_stat

ffffffff804c6a80 b rover.5
ffffffff804c6a88 b last_gc.2
ffffffff804c6a90 b rover.3
ffffffff804c6a94 b equilibrium.4
ffffffff804c6a98 b ip_fallback_id.7
ffffffff804c6aa0 B rt_cache_stat
ffffffff804c6aa8 b ip_rt_max_size
ffffffff804c6aac b ip_rt_debug
ffffffff804c6ab0 b rt_deadline

So rt_cache_stat (which is a read only pointer) is in the middle of a hot cache line (some parts of it are written over and over), that 
probably ping pong between CPUS.

Time to provide a patch to carefully place all the static data from net/ipv4/route.c into 2 parts : mostly readonly, and others... :)

Eric

^ permalink raw reply

* Re: [PATCH] Add prefetches in net/ipv4/route.c
From: Rick Jones @ 2005-07-29 18:25 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, David S. Miller, Robert Olsson
In-Reply-To: <42EA6E0F.8060705@cosmosbay.com>


> oprofile on AMD64 can gather lots of data, DATA_CACHE_MISSES for example...
> 
> But I think I know what happens...
> 
> nm -v /usr/src/linux/vmlinux | grep -5 rt_cache_stat
> 
> ffffffff804c6a80 b rover.5
> ffffffff804c6a88 b last_gc.2
> ffffffff804c6a90 b rover.3
> ffffffff804c6a94 b equilibrium.4
> ffffffff804c6a98 b ip_fallback_id.7
> ffffffff804c6aa0 B rt_cache_stat
> ffffffff804c6aa8 b ip_rt_max_size
> ffffffff804c6aac b ip_rt_debug
> ffffffff804c6ab0 b rt_deadline
> 
> So rt_cache_stat (which is a read only pointer) is in the middle of a 
> hot cache line (some parts of it are written over and over), that 
> probably ping pong between CPUS.
> 
> Time to provide a patch to carefully place all the static data from 
> net/ipv4/route.c into 2 parts : mostly readonly, and others... :)

Which of course begs the question - what cache line size should be ass-u-me-d 
when blocking these things?  I'll put-forth 128 bytes.

rick jones

^ permalink raw reply

* Re: [patch] net/tulip: LAN driver for ULI M5261/M5263
From: Jeff Garzik @ 2005-07-29 19:37 UTC (permalink / raw)
  To: Peer.Chen; +Cc: alan, Clear.Zhang, linux-kernel, Emily.Jiang, Netdev List
In-Reply-To: <OF9922119A.7A6623CD-ON4825704D.0040B00E@uli.com.tw>

Peer.Chen@uli.com.tw wrote:
> We want to extract our LAN card driver from tulip core driver and make a
> new file uli526x.c at tulip folder,
> because we have added some ethtool interface support and non-eprom support
> in our driver and may be other change
> in the futher. If our controllers support are still contained in the tulip
> core driver, I think it'll increase the
> complexity of maintenance,


After some thought, I agree with this assessment.

It has been my goal for a long time to separate out the various chips 
from the tulip driver, for easier maintenance.  One of the reasons I 
have not applied a "fix tulip for ULi" patch is that it changes PHY 
details that I am not sure are OK for the myriad tulip clones.  A 
separate driver eliminates this objection.

I have applied your patch to the new 'uli-tulip' branch of git 
repository 
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

Please now do the following tasks:

1) Submit an incremental patch addressing Alexey Dobriyan's minor complaints

2) Submit a patch removing all ULi support from the 'tulip' driver


I will then conduct a final review, and probably request another patch, 
with more updates.

After that, your driver will be sent upstream, to be included in the 
official 2.6.x kernel.

Thanks and regards,

	Jeff

^ permalink raw reply

* Re: [PATCH RFC]: PHY Abstraction Layer III
From: Jeff Garzik @ 2005-07-29 21:46 UTC (permalink / raw)
  To: Andy Fleming; +Cc: netdev, Embedded PPC Linux list
In-Reply-To: <23F9076F-9FBB-43C8-83CD-F630E694203D@freescale.com>

Andy Fleming wrote:
> Here's the latest version of the patch, done against a cogito  linux-2.6 
> branch.  It has a handful of small changes, which I hope  will speed 
> acceptance:
> 
> * Interrupts are no longer requested at interrupt time
> * There is a function to print out PHY status
> * The PHY drivers' probe function now serves only to initialize  driver 
> state
> * A new config_init functor has been created to configure PHY state  
> just after reset (so that the PHYs will be returned to a sane state  if 
> they don't start up that way)
> * Stephen Hemminger's patch to allow better module support in the  
> drivers has been included

OK, DaveM and I are OK with merging this.

Send me a single One Big Patch which adds all the new files and such, 
I'll give it a final review, and queue it for 2.6.14.

	Jeff

^ permalink raw reply

* Re: [Infrahip] Re: [hipl-users] Re: [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Herbert Xu @ 2005-07-29 23:48 UTC (permalink / raw)
  To: Pekka Nikander; +Cc: diego.beltrami, netdev, infrahip
In-Reply-To: <B9CA81E3-5A80-4629-8D32-42A8C37142E2@nomadiclab.com>

On Fri, Jul 29, 2005 at 05:45:24PM +0200, Pekka Nikander wrote:
> >Surely BEET will work also for AH with minor changes, even though we
> >only tried the ESP encapsulation.
> 
> I wouldn't be so sure.  IIRC, tunnel mode is not specified for AH but  
> for ESP only.  Consequently, defining BEET mode for AH might be  

Well plain tunnel mode certainly is specified for AH as well as IPComp.
But you're right the semantics of BEET mode for AH needs to be thought
out.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH] add new nfnetlink_log subsystem
From: Harald Welte @ 2005-07-30 10:30 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, Netfilter Development Mailinglist


[-- Attachment #1.1: Type: text/plain, Size: 688 bytes --]

Hi Dave!

This (long-awaited) patch adds the generic nfnetlink-based userspace
logging.  nfnetlink_log can be used for any protocol family, and
supports upt to 65535 logging groups (that could go to separate logging
daemons, e.g.).

The patch is incremental to my nf_log update in
<20050728200434.GA3763@rama.de.gnumonks.org>.

Please apply to net-2.6.14,
	thanks.
-- 
- 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 #1.2: 17-nfnetlink_log.patch --]
[-- Type: text/plain, Size: 29793 bytes --]

[NETFILTER] Add new "nfnetlink_log" userspace packet logging facility

This is a generic (layer3 independent) version of what ipt_ULOG is already
doing for IPv4 today.  ipt_ULOG, ebt_ulog and finally also ip[6]t_LOG will
be deprecated by this mechanism in the long term.

Signed-off-by: Harald Welte <laforge@netfilter.org>

---
commit 66ad9b079da5c6a181506fba350aa33d26417431
tree 4b4bda3788bf34d1946ff0239100a4f235cfa120
parent 3770e25a01055bfa8bee52ed16666db1f3a5141f
author laforge <laforge@netfilter.org> Sa, 30 Jul 2005 12:11:19 +0200
committer laforge <laforge@netfilter.org> Sa, 30 Jul 2005 12:11:19 +0200

 include/linux/netfilter/nfnetlink_log.h |   85 +++
 net/netfilter/Kconfig                   |   11 
 net/netfilter/Makefile                  |    1 
 net/netfilter/nfnetlink_log.c           |  992 +++++++++++++++++++++++++++++++
 4 files changed, 1089 insertions(+), 0 deletions(-)

diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
new file mode 100644
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -0,0 +1,85 @@
+#ifndef _NFNETLINK_LOG_H
+#define _NFNETLINK_LOG_H
+
+/* This file describes the netlink messages (i.e. 'protocol packets'),
+ * and not any kind of function definitions.  It is shared between kernel and
+ * userspace.  Don't put kernel specific stuff in here */
+
+#include <linux/netfilter/nfnetlink.h>
+
+enum nfulnl_msg_types {
+	NFULNL_MSG_PACKET,		/* packet from kernel to userspace */
+	NFULNL_MSG_CONFIG,		/* connect to a particular queue */
+
+	NFULNL_MSG_MAX
+};
+
+struct nfulnl_msg_packet_hdr {
+	u_int16_t	hw_protocol;	/* hw protocol (network order) */
+	u_int8_t	hook;		/* netfilter hook */
+	u_int8_t	_pad;
+} __attribute__ ((packed));
+
+struct nfulnl_msg_packet_hw {
+	u_int16_t	hw_addrlen;
+	u_int16_t	_pad;
+	u_int8_t	hw_addr[8];
+} __attribute__ ((packed));
+
+struct nfulnl_msg_packet_timestamp {
+	u_int64_t	sec;
+	u_int64_t	usec;
+} __attribute__ ((packed));
+
+#define NFULNL_PREFIXLEN	30	/* just like old log target */
+
+enum nfulnl_attr_type {
+	NFULA_UNSPEC,
+	NFULA_PACKET_HDR,
+	NFULA_MARK,			/* u_int32_t nfmark */
+	NFULA_TIMESTAMP,		/* nfulnl_msg_packet_timestamp */
+	NFULA_IFINDEX_INDEV,		/* u_int32_t ifindex */
+	NFULA_IFINDEX_OUTDEV,		/* u_int32_t ifindex */
+	NFULA_HWADDR,			/* nfulnl_msg_packet_hw */
+	NFULA_PAYLOAD,			/* opaque data payload */
+	NFULA_PREFIX,			/* string prefix */
+	NFULA_UID,			/* user id of socket */
+
+	__NFULA_MAX
+};
+#define NFULA_MAX (__NFULA_MAX - 1)
+
+enum nfulnl_msg_config_cmds {
+	NFULNL_CFG_CMD_NONE,
+	NFULNL_CFG_CMD_BIND,
+	NFULNL_CFG_CMD_UNBIND,
+	NFULNL_CFG_CMD_PF_BIND,
+	NFULNL_CFG_CMD_PF_UNBIND,
+};
+
+struct nfulnl_msg_config_cmd {
+	u_int8_t	command;	/* nfulnl_msg_config_cmds */
+} __attribute__ ((packed));
+
+struct nfulnl_msg_config_mode {
+	u_int32_t	copy_range;
+	u_int8_t	copy_mode;
+	u_int8_t	_pad;
+} __attribute__ ((packed));
+
+enum nfulnl_attr_config {
+	NFULA_CFG_UNSPEC,
+	NFULA_CFG_CMD,			/* nfulnl_msg_config_cmd */
+	NFULA_CFG_MODE,			/* nfulnl_msg_config_mode */
+	NFULA_CFG_NLBUFSIZ,		/* u_int32_t buffer size */
+	NFULA_CFG_TIMEOUT,		/* u_int32_t in 1/100 s */
+	NFULA_CFG_QTHRESH,		/* u_int32_t */
+	__NFULA_CFG_MAX
+};
+#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
+
+#define NFULNL_COPY_NONE	0x00
+#define NFULNL_COPY_META	0x01
+#define NFULNL_COPY_PACKET	0x02
+
+#endif /* _NFNETLINK_LOG_H */
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -11,3 +11,14 @@ config NETFILTER_NETLINK_QUEUE
 	  If this option isenabled, the kernel will include support
 	  for queueing packets via NFNETLINK.
 	  
+config NETFILTER_NETLINK_LOG
+	tristate "Netfilter LOG over NFNETLINK interface"
+	depends on NETFILTER_NETLINK
+	help
+	  If this option is enabled, the kernel will include support
+	  for logging packets via NFNETLINK.
+
+	  This obsoletes the existing ipt_ULOG and ebg_ulog mechanisms,
+	  and is also scheduled to replace the old syslog-based ipt_LOG
+	  and ip6t_LOG modules.
+
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_NETFILTER_NETLINK) += nfnetlink.o
 obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += nfnetlink_queue.o
+obj-$(CONFIG_NETFILTER_NETLINK_LOG) += nfnetlink_log.o
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
new file mode 100644
--- /dev/null
+++ b/net/netfilter/nfnetlink_log.c
@@ -0,0 +1,992 @@
+/*
+ * This is a module which is used for logging packets to userspace via
+ * nfetlink.
+ *
+ * (C) 2005 by Harald Welte <laforge@netfilter.org>
+ *
+ * Based on the old ipv4-only ipt_ULOG.c:
+ * (C) 2000-2004 by Harald Welte <laforge@netfilter.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/init.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/netdevice.h>
+#include <linux/netfilter.h>
+#include <linux/netlink.h>
+#include <linux/netfilter/nfnetlink.h>
+#include <linux/netfilter/nfnetlink_log.h>
+#include <linux/spinlock.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+#include <linux/security.h>
+#include <linux/list.h>
+#include <linux/jhash.h>
+#include <linux/random.h>
+#include <net/sock.h>
+
+#include <asm/atomic.h>
+
+#define NFULNL_NLBUFSIZ_DEFAULT	4096
+#define NFULNL_TIMEOUT_DEFAULT 	100	/* every second */
+#define NFULNL_QTHRESH_DEFAULT 	100	/* 100 packets */
+
+#define PRINTR(x, args ...)	do { if (net_ratelimit()) \
+				     printk(x, ## args); } while (0);
+
+#if 0
+#define UDEBUG(x, args ...)	printk(KERN_DEBUG "%s(%d):%s():	" x, 	   \
+					__FILE__, __LINE__, __FUNCTION__,  \
+					## args)
+#else
+#define UDEBUG(x, ...)
+#endif
+
+struct nfulnl_instance {
+	struct hlist_node hlist;	/* global list of instances */
+	spinlock_t lock;
+	atomic_t use;			/* use count */
+
+	unsigned int qlen;		/* number of nlmsgs in skb */
+	struct sk_buff *skb;		/* pre-allocatd skb */
+	struct nlmsghdr *lastnlh;	/* netlink header of last msg in skb */
+	struct timer_list timer;
+	int peer_pid;			/* PID of the peer process */
+
+	/* configurable parameters */
+	unsigned int flushtimeout;	/* timeout until queue flush */
+	unsigned int nlbufsiz;		/* netlink buffer allocation size */
+	unsigned int qthreshold;	/* threshold of the queue */
+	u_int32_t copy_range;
+	u_int16_t group_num;		/* number of this queue */
+	u_int8_t copy_mode;	
+};
+
+static DEFINE_RWLOCK(instances_lock);
+
+#define INSTANCE_BUCKETS	16
+static struct hlist_head instance_table[INSTANCE_BUCKETS];
+static unsigned int hash_init;
+
+static inline u_int8_t instance_hashfn(u_int16_t group_num)
+{
+	return ((group_num & 0xff) % INSTANCE_BUCKETS);
+}
+
+static struct nfulnl_instance *
+__instance_lookup(u_int16_t group_num)
+{
+	struct hlist_head *head;
+	struct hlist_node *pos;
+	struct nfulnl_instance *inst;
+
+	UDEBUG("entering (group_num=%u)\n", group_num);
+
+	head = &instance_table[instance_hashfn(group_num)];
+	hlist_for_each_entry(inst, pos, head, hlist) {
+		if (inst->group_num == group_num)
+			return inst;
+	}
+	return NULL;
+}
+
+static inline void
+instance_get(struct nfulnl_instance *inst)
+{
+	atomic_inc(&inst->use);
+}
+
+static struct nfulnl_instance *
+instance_lookup_get(u_int16_t group_num)
+{
+	struct nfulnl_instance *inst;
+
+	read_lock_bh(&instances_lock);
+	inst = __instance_lookup(group_num);
+	if (inst)
+		instance_get(inst);
+	read_unlock_bh(&instances_lock);
+
+	return inst;
+}
+
+static void
+instance_put(struct nfulnl_instance *inst)
+{
+	if (inst && atomic_dec_and_test(&inst->use)) {
+		UDEBUG("kfree(inst=%p)\n", inst);
+		kfree(inst);
+	}
+}
+
+static void nfulnl_timer(unsigned long data);
+
+static struct nfulnl_instance *
+instance_create(u_int16_t group_num, int pid)
+{
+	struct nfulnl_instance *inst;
+
+	UDEBUG("entering (group_num=%u, pid=%d)\n", group_num,
+		pid);
+
+	write_lock_bh(&instances_lock);	
+	if (__instance_lookup(group_num)) {
+		inst = NULL;
+		UDEBUG("aborting, instance already exists\n");
+		goto out_unlock;
+	}
+
+	inst = kmalloc(sizeof(*inst), GFP_ATOMIC);
+	if (!inst)
+		goto out_unlock;
+
+	memset(inst, 0, sizeof(*inst));
+	INIT_HLIST_NODE(&inst->hlist);
+	inst->lock = SPIN_LOCK_UNLOCKED;
+	/* needs to be two, since we _put() after creation */
+	atomic_set(&inst->use, 2);
+
+	init_timer(&inst->timer);
+	inst->timer.function = nfulnl_timer;
+	inst->timer.data = (unsigned long)inst;
+	/* don't start timer yet. (re)start it  with every packet */
+
+	inst->peer_pid = pid;
+	inst->group_num = group_num;
+
+	inst->qthreshold 	= NFULNL_QTHRESH_DEFAULT;
+	inst->flushtimeout 	= NFULNL_TIMEOUT_DEFAULT;
+	inst->nlbufsiz 		= NFULNL_NLBUFSIZ_DEFAULT;
+	inst->copy_mode 	= NFULNL_COPY_PACKET;
+	inst->copy_range 	= 0xffff;
+
+	if (!try_module_get(THIS_MODULE))
+		goto out_free;
+
+	hlist_add_head(&inst->hlist, 
+		       &instance_table[instance_hashfn(group_num)]);
+
+	UDEBUG("newly added node: %p, next=%p\n", &inst->hlist, 
+		inst->hlist.next);
+
+	write_unlock_bh(&instances_lock);
+
+	return inst;
+
+out_free:
+	instance_put(inst);
+out_unlock:
+	write_unlock_bh(&instances_lock);
+	return NULL;
+}
+
+static int __nfulnl_send(struct nfulnl_instance *inst);
+
+static void
+_instance_destroy2(struct nfulnl_instance *inst, int lock)
+{
+	/* first pull it out of the global list */
+	if (lock)
+		write_lock_bh(&instances_lock);
+
+	UDEBUG("removing instance %p (queuenum=%u) from hash\n",
+		inst, inst->group_num);
+
+	hlist_del(&inst->hlist);
+
+	if (lock)
+		write_unlock_bh(&instances_lock);
+
+	/* then flush all pending packets from skb */
+
+	spin_lock_bh(&inst->lock);
+	if (inst->skb) {
+		if (inst->qlen)
+			__nfulnl_send(inst);
+		if (inst->skb) {
+			kfree_skb(inst->skb);
+			inst->skb = NULL;
+		}
+	}
+	spin_unlock_bh(&inst->lock);
+
+	/* and finally put the refcount */
+	instance_put(inst);
+
+	module_put(THIS_MODULE);
+}
+
+static inline void
+__instance_destroy(struct nfulnl_instance *inst)
+{
+	_instance_destroy2(inst, 0);
+}
+
+static inline void
+instance_destroy(struct nfulnl_instance *inst)
+{
+	_instance_destroy2(inst, 1);
+}
+
+static int
+nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode,
+		  unsigned int range)
+{
+	int status = 0;
+
+	spin_lock_bh(&inst->lock);
+	
+	switch (mode) {
+	case NFULNL_COPY_NONE:
+	case NFULNL_COPY_META:
+		inst->copy_mode = mode;
+		inst->copy_range = 0;
+		break;
+		
+	case NFULNL_COPY_PACKET:
+		inst->copy_mode = mode;
+		/* we're using struct nfattr which has 16bit nfa_len */
+		if (range > 0xffff)
+			inst->copy_range = 0xffff;
+		else
+			inst->copy_range = range;
+		break;
+		
+	default:
+		status = -EINVAL;
+		break;
+	}
+
+	spin_unlock_bh(&inst->lock);
+
+	return status;
+}
+
+static int
+nfulnl_set_nlbufsiz(struct nfulnl_instance *inst, u_int32_t nlbufsiz)
+{
+	int status;
+
+	spin_lock_bh(&inst->lock);
+	if (nlbufsiz < NFULNL_NLBUFSIZ_DEFAULT)
+		status = -ERANGE;
+	else if (nlbufsiz > 131072)
+		status = -ERANGE;
+	else {
+		inst->nlbufsiz = nlbufsiz;
+		status = 0;
+	}
+	spin_unlock_bh(&inst->lock);
+
+	return status;
+}
+
+static int
+nfulnl_set_timeout(struct nfulnl_instance *inst, u_int32_t timeout)
+{
+	spin_lock_bh(&inst->lock);
+	inst->flushtimeout = timeout;
+	spin_unlock_bh(&inst->lock);
+
+	return 0;
+}
+
+static int
+nfulnl_set_qthresh(struct nfulnl_instance *inst, u_int32_t qthresh)
+{
+	spin_lock_bh(&inst->lock);
+	inst->qthreshold = qthresh;
+	spin_unlock_bh(&inst->lock);
+
+	return 0;
+}
+
+static struct sk_buff *nfulnl_alloc_skb(unsigned int inst_size, 
+					unsigned int pkt_size)
+{
+	struct sk_buff *skb;
+
+	UDEBUG("entered (%u, %u)\n", inst_size, pkt_size);
+
+	/* alloc skb whihc should be big enough for a whole multipart
+	 * message.  WARNING: has to be <= 128k due to slab restrictions */
+
+	skb = alloc_skb(inst_size, GFP_ATOMIC);
+	if (!skb) {
+		PRINTR("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
+			inst_size);
+
+		/* try to allocate only as much as we need for current
+		 * packet */
+
+		skb = alloc_skb(pkt_size, GFP_ATOMIC);
+		if (!skb)
+			PRINTR("nfnetlink_log: can't even alloc %u bytes\n",
+				pkt_size);
+	}
+
+	return skb;
+}
+
+static int
+__nfulnl_send(struct nfulnl_instance *inst)
+{
+	int status;
+
+	if (timer_pending(&inst->timer))
+		del_timer(&inst->timer);
+
+	if (inst->qlen > 1)
+		inst->lastnlh->nlmsg_type = NLMSG_DONE;
+
+	status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
+	if (status < 0) {
+		UDEBUG("netlink_unicast() failed\n");
+		/* FIXME: statistics */
+	}
+
+	inst->qlen = 0;
+	inst->skb = NULL;
+	inst->lastnlh = NULL;
+
+	return status;
+}
+
+static void nfulnl_timer(unsigned long data)
+{
+	struct nfulnl_instance *inst = (struct nfulnl_instance *)data; 
+
+	UDEBUG("timer function called, flushing buffer\n");
+
+	spin_lock_bh(&inst->lock);
+	__nfulnl_send(inst);
+	instance_put(inst);
+	spin_unlock_bh(&inst->lock);
+}
+
+static inline int 
+__build_packet_message(struct nfulnl_instance *inst,
+			const struct sk_buff *skb, 
+			unsigned int data_len,
+			unsigned int pf,
+			unsigned int hooknum,
+			const struct net_device *indev,
+			const struct net_device *outdev,
+			const struct nf_loginfo *li,
+			const char *prefix)
+{
+	unsigned char *old_tail;
+	struct nfulnl_msg_packet_hdr pmsg;
+	struct nlmsghdr *nlh;
+	struct nfgenmsg *nfmsg;
+	u_int32_t tmp_uint;
+
+	UDEBUG("entered\n");
+		
+	old_tail = inst->skb->tail;
+	nlh = NLMSG_PUT(inst->skb, 0, 0, 
+			NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET,
+			sizeof(struct nfgenmsg));
+	nfmsg = NLMSG_DATA(nlh);
+	nfmsg->nfgen_family = pf;
+	nfmsg->version = NFNETLINK_V0;
+	nfmsg->res_id = htons(inst->group_num);
+
+	pmsg.hw_protocol	= htons(skb->protocol);
+	pmsg.hook		= hooknum;
+
+	NFA_PUT(inst->skb, NFULA_PACKET_HDR, sizeof(pmsg), &pmsg);
+
+	if (prefix) {
+		int slen = strlen(prefix);
+		if (slen > NFULNL_PREFIXLEN)
+			slen = NFULNL_PREFIXLEN;
+		NFA_PUT(inst->skb, NFULA_PREFIX, slen, prefix);
+	}
+
+	if (indev) {
+		tmp_uint = htonl(indev->ifindex);
+		NFA_PUT(inst->skb, NFULA_IFINDEX_INDEV, sizeof(tmp_uint),
+			&tmp_uint);
+	}
+
+	if (outdev) {
+		tmp_uint = htonl(outdev->ifindex);
+		NFA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, sizeof(tmp_uint),
+			&tmp_uint);
+	}
+
+	if (skb->nfmark) {
+		tmp_uint = htonl(skb->nfmark);
+		NFA_PUT(inst->skb, NFULA_MARK, sizeof(tmp_uint), &tmp_uint);
+	}
+
+	if (indev && skb->dev && skb->dev->hard_header_parse) {
+		struct nfulnl_msg_packet_hw phw;
+
+		phw.hw_addrlen = 
+			skb->dev->hard_header_parse((struct sk_buff *)skb, 
+						    phw.hw_addr);
+		phw.hw_addrlen = htons(phw.hw_addrlen);
+		NFA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw);
+	}
+
+	if (skb->stamp.tv_sec) {
+		struct nfulnl_msg_packet_timestamp ts;
+
+		ts.sec = cpu_to_be64(skb->stamp.tv_sec);
+		ts.usec = cpu_to_be64(skb->stamp.tv_usec);
+
+		NFA_PUT(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts);
+	}
+
+	/* UID */
+	if (skb->sk) {
+		read_lock_bh(&skb->sk->sk_callback_lock);
+		if (skb->sk->sk_socket && skb->sk->sk_socket->file) {
+			u_int32_t uid = htonl(skb->sk->sk_socket->file->f_uid);
+			/* need to unlock here since NFA_PUT may goto */
+			read_unlock_bh(&skb->sk->sk_callback_lock);
+			NFA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid);
+		} else
+			read_unlock_bh(&skb->sk->sk_callback_lock);
+	}
+
+	if (data_len) {
+		struct nfattr *nfa;
+		int size = NFA_LENGTH(data_len);
+
+		if (skb_tailroom(inst->skb) < (int)NFA_SPACE(data_len)) {
+			printk(KERN_WARNING "nfnetlink_log: no tailroom!\n");
+			goto nlmsg_failure;
+		}
+
+		nfa = (struct nfattr *)skb_put(inst->skb, NFA_ALIGN(size));
+		nfa->nfa_type = NFULA_PAYLOAD;
+		nfa->nfa_len = size;
+
+		if (skb_copy_bits(skb, 0, NFA_DATA(nfa), data_len))
+			BUG();
+	}
+		
+	nlh->nlmsg_len = inst->skb->tail - old_tail;
+	return 0;
+
+nlmsg_failure:
+	UDEBUG("nlmsg_failure\n");
+nfattr_failure:
+	PRINTR(KERN_ERR "nfnetlink_log: error creating log nlmsg\n");
+	return -1;
+}
+
+#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0)
+
+static struct nf_loginfo default_loginfo = {
+	.type =		NF_LOG_TYPE_ULOG,
+	.u.ulog = {
+		.copy_len	= 0xffff,
+		.group		= 0,
+		.qthreshold	= 1,
+	},
+};
+
+/* log handler for internal netfilter logging api */
+static void
+nfulnl_log_packet(unsigned int pf,
+		  unsigned int hooknum,
+		  const struct sk_buff *skb,
+		  const struct net_device *in,
+		  const struct net_device *out,
+		  const struct nf_loginfo *li_user,
+		  const char *prefix)
+{
+	unsigned int size, data_len;
+	struct nfulnl_instance *inst;
+	const struct nf_loginfo *li;
+	unsigned int qthreshold;
+	unsigned int nlbufsiz;
+
+	if (li_user && li_user->type == NF_LOG_TYPE_ULOG) 
+		li = li_user;
+	else
+		li = &default_loginfo;
+
+	inst = instance_lookup_get(li->u.ulog.group);
+	if (!inst)
+		inst = instance_lookup_get(0);
+	if (!inst) {
+		PRINTR("nfnetlink_log: trying to log packet, "
+			"but no instance for group %u\n", li->u.ulog.group);
+		return;
+	}
+
+	/* all macros expand to constant values at compile time */
+	/* FIXME: do we want to make the size calculation conditional based on
+	 * what is actually present?  way more branches and checks, but more
+	 * memory efficient... */
+	size =    NLMSG_SPACE(sizeof(struct nfgenmsg))
+		+ NFA_SPACE(sizeof(struct nfulnl_msg_packet_hdr))
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* ifindex */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* mark */
+		+ NFA_SPACE(sizeof(u_int32_t))	/* uid */
+		+ NFA_SPACE(NFULNL_PREFIXLEN)	/* prefix */
+		+ NFA_SPACE(sizeof(struct nfulnl_msg_packet_hw))
+		+ NFA_SPACE(sizeof(struct nfulnl_msg_packet_timestamp));
+
+	UDEBUG("initial size=%u\n", size);
+
+	spin_lock_bh(&inst->lock);
+
+	qthreshold = inst->qthreshold;
+	/* per-rule qthreshold overrides per-instance */
+	if (qthreshold > li->u.ulog.qthreshold)
+		qthreshold = li->u.ulog.qthreshold;
+	
+	switch (inst->copy_mode) {
+	case NFULNL_COPY_META:
+	case NFULNL_COPY_NONE:
+		data_len = 0;
+		break;
+	
+	case NFULNL_COPY_PACKET:
+		if (inst->copy_range == 0 
+		    || inst->copy_range > skb->len)
+			data_len = skb->len;
+		else
+			data_len = inst->copy_range;
+		
+		size += NFA_SPACE(data_len);
+		UDEBUG("copy_packet, therefore size now %u\n", size);
+		break;
+	
+	default:
+		spin_unlock_bh(&inst->lock);
+		instance_put(inst);
+		return;
+	}
+
+	if (size > inst->nlbufsiz)
+		nlbufsiz = size;
+	else
+		nlbufsiz = inst->nlbufsiz;
+
+	if (!inst->skb) {
+		if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) {
+			UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n",
+				inst->nlbufsiz, size);
+			goto alloc_failure;
+		}
+	} else if (inst->qlen >= qthreshold ||
+		   size > skb_tailroom(inst->skb)) {
+		/* either the queue len is too high or we don't have
+		 * enough room in the skb left. flush to userspace. */
+		UDEBUG("flushing old skb\n");
+
+		__nfulnl_send(inst);
+
+		if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) {
+			UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n",
+				inst->nlbufsiz, size);
+			goto alloc_failure;
+		}
+	}
+
+	UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold);
+	inst->qlen++;
+
+	__build_packet_message(inst, skb, data_len, pf,
+				hooknum, in, out, li, prefix);
+
+	/* timer_pending always called within inst->lock, so there
+	 * is no chance of a race here */
+	if (!timer_pending(&inst->timer)) {
+		instance_get(inst);
+		inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100);
+		add_timer(&inst->timer);
+	}
+	spin_unlock_bh(&inst->lock);
+
+	return;
+
+alloc_failure:
+	spin_unlock_bh(&inst->lock);
+	instance_put(inst);
+	UDEBUG("error allocating skb\n");
+	/* FIXME: statistics */
+}
+
+static int
+nfulnl_rcv_nl_event(struct notifier_block *this,
+		   unsigned long event, void *ptr)
+{
+	struct netlink_notify *n = ptr;
+
+	if (event == NETLINK_URELEASE &&
+	    n->protocol == NETLINK_NETFILTER && n->pid) {
+		int i;
+
+		/* destroy all instances for this pid */
+		write_lock_bh(&instances_lock);
+		for  (i = 0; i < INSTANCE_BUCKETS; i++) {
+			struct hlist_node *tmp, *t2;
+			struct nfulnl_instance *inst;
+			struct hlist_head *head = &instance_table[i];
+
+			hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
+				UDEBUG("node = %p\n", inst);
+				if (n->pid == inst->peer_pid)
+					__instance_destroy(inst);
+			}
+		}
+		write_unlock_bh(&instances_lock);
+	}
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block nfulnl_rtnl_notifier = {
+	.notifier_call	= nfulnl_rcv_nl_event,
+};
+
+static int
+nfulnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb,
+		  struct nlmsghdr *nlh, struct nfattr *nfqa[], int *errp)
+{
+	return -ENOTSUPP;
+}
+
+static struct nf_logger nfulnl_logger = {
+	.name	= "nfnetlink_log",
+	.logfn	= &nfulnl_log_packet,
+	.me	= THIS_MODULE,
+};
+
+static const int nfula_min[NFULA_MAX] = {
+	[NFULA_PACKET_HDR-1]	= sizeof(struct nfulnl_msg_packet_hdr),
+	[NFULA_MARK-1]		= sizeof(u_int32_t),
+	[NFULA_TIMESTAMP-1]	= sizeof(struct nfulnl_msg_packet_timestamp),
+	[NFULA_IFINDEX_INDEV-1]	= sizeof(u_int32_t),
+	[NFULA_IFINDEX_OUTDEV-1]= sizeof(u_int32_t),
+	[NFULA_HWADDR-1]	= sizeof(struct nfulnl_msg_packet_hw),
+	[NFULA_PAYLOAD-1]	= 0,
+	[NFULA_PREFIX-1]	= 0,
+	[NFULA_UID-1]		= sizeof(u_int32_t),
+};
+
+static const int nfula_cfg_min[NFULA_CFG_MAX] = {
+	[NFULA_CFG_CMD-1]	= sizeof(struct nfulnl_msg_config_cmd),
+	[NFULA_CFG_MODE-1]	= sizeof(struct nfulnl_msg_config_mode),
+	[NFULA_CFG_TIMEOUT-1]	= sizeof(u_int32_t),
+	[NFULA_CFG_QTHRESH-1]	= sizeof(u_int32_t),
+	[NFULA_CFG_NLBUFSIZ-1]	= sizeof(u_int32_t),
+};
+
+static int
+nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
+		   struct nlmsghdr *nlh, struct nfattr *nfula[], int *errp)
+{
+	struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
+	u_int16_t group_num = ntohs(nfmsg->res_id);
+	struct nfulnl_instance *inst;
+	int ret = 0;
+
+	UDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type));
+
+	if (nfattr_bad_size(nfula, NFULA_CFG_MAX, nfula_cfg_min)) {
+		UDEBUG("bad attribute size\n");
+		return -EINVAL;
+	}
+
+	inst = instance_lookup_get(group_num);
+	if (nfula[NFULA_CFG_CMD-1]) {
+		u_int8_t pf = nfmsg->nfgen_family;
+		struct nfulnl_msg_config_cmd *cmd;
+		cmd = NFA_DATA(nfula[NFULA_CFG_CMD-1]);
+		UDEBUG("found CFG_CMD for\n");
+
+		switch (cmd->command) {
+		case NFULNL_CFG_CMD_BIND:
+			if (inst) {
+				ret = -EBUSY;
+				goto out_put;
+			}
+
+			inst = instance_create(group_num,
+					       NETLINK_CB(skb).pid);
+			if (!inst) {
+				ret = -EINVAL;
+				goto out_put;
+			}
+			break;
+		case NFULNL_CFG_CMD_UNBIND:
+			if (!inst) {
+				ret = -ENODEV;
+				goto out_put;
+			}
+
+			if (inst->peer_pid != NETLINK_CB(skb).pid) {
+				ret = -EPERM;
+				goto out_put;
+			}
+
+			instance_destroy(inst);
+			break;
+		case NFULNL_CFG_CMD_PF_BIND:
+			UDEBUG("registering log handler for pf=%u\n", pf);
+			ret = nf_log_register(pf, &nfulnl_logger);
+			break;
+		case NFULNL_CFG_CMD_PF_UNBIND:
+			UDEBUG("unregistering log handler for pf=%u\n", pf);
+			/* This is a bug and a feature.  We cannot unregister
+			 * other handlers, like nfnetlink_inst can */
+			nf_log_unregister_pf(pf);
+			break;
+		default:
+			ret = -EINVAL;
+			break;
+		}
+	} else {
+		if (!inst) {
+			UDEBUG("no config command, and no instance for "
+				"group=%u pid=%u =>ENOENT\n",
+				group_num, NETLINK_CB(skb).pid);
+			ret = -ENOENT;
+			goto out_put;
+		}
+
+		if (inst->peer_pid != NETLINK_CB(skb).pid) {
+			UDEBUG("no config command, and wrong pid\n");
+			ret = -EPERM;
+			goto out_put;
+		}
+	}
+
+	if (nfula[NFULA_CFG_MODE-1]) {
+		struct nfulnl_msg_config_mode *params;
+		params = NFA_DATA(nfula[NFULA_CFG_MODE-1]);
+
+		nfulnl_set_mode(inst, params->copy_mode,
+				ntohs(params->copy_range));
+	}
+
+	if (nfula[NFULA_CFG_TIMEOUT-1]) {
+		u_int32_t timeout = 
+			*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_TIMEOUT-1]);
+
+		nfulnl_set_timeout(inst, ntohl(timeout));
+	}
+
+	if (nfula[NFULA_CFG_NLBUFSIZ-1]) {
+		u_int32_t nlbufsiz = 
+			*(u_int32_t *)NFA_DATA(nfula[NFULA_CFG_NLBUFSIZ-1]);
+
+		nfulnl_set_nlbufsiz(inst, ntohl(nlbufsiz));
+	}
+
+	if (nfula[NFULA_CFG_QTHRESH-1]) {
+		u_int32_t qthresh = 
+			*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_QTHRESH-1]);
+
+		nfulnl_set_qthresh(inst, ntohl(qthresh));
+	}
+
+out_put:
+	instance_put(inst);
+	return ret;
+}
+
+static struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX] = {
+	[NFULNL_MSG_PACKET]	= { .call = nfulnl_recv_unsupp,
+				    .cap_required = CAP_NET_ADMIN },
+	[NFULNL_MSG_CONFIG]	= { .call = nfulnl_recv_config,
+				    .cap_required = CAP_NET_ADMIN },
+};
+
+static struct nfnetlink_subsystem nfulnl_subsys = {
+	.name		= "log",
+	.subsys_id	= NFNL_SUBSYS_ULOG,
+	.cb_count	= NFULNL_MSG_MAX,
+	.attr_count	= NFULA_MAX,
+	.cb		= nfulnl_cb,
+};
+
+#ifdef CONFIG_PROC_FS
+struct iter_state {
+	unsigned int bucket;
+};
+
+static struct hlist_node *get_first(struct seq_file *seq)
+{
+	struct iter_state *st = seq->private;
+
+	if (!st)
+		return NULL;
+
+	for (st->bucket = 0; st->bucket < INSTANCE_BUCKETS; st->bucket++) {
+		if (!hlist_empty(&instance_table[st->bucket]))
+			return instance_table[st->bucket].first;
+	}
+	return NULL;
+}
+
+static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h)
+{
+	struct iter_state *st = seq->private;
+
+	h = h->next;
+	while (!h) {
+		if (++st->bucket >= INSTANCE_BUCKETS)
+			return NULL;
+
+		h = instance_table[st->bucket].first;
+	}
+	return h;
+}
+
+static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)
+{
+	struct hlist_node *head;
+	head = get_first(seq);
+
+	if (head)
+		while (pos && (head = get_next(seq, head)))
+			pos--;
+	return pos ? NULL : head;
+}
+
+static void *seq_start(struct seq_file *seq, loff_t *pos)
+{
+	read_lock_bh(&instances_lock);
+	return get_idx(seq, *pos);
+}
+
+static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
+{
+	(*pos)++;
+	return get_next(s, v);
+}
+
+static void seq_stop(struct seq_file *s, void *v)
+{
+	read_unlock_bh(&instances_lock);
+}
+
+static int seq_show(struct seq_file *s, void *v)
+{
+	const struct nfulnl_instance *inst = v;
+
+	return seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n", 
+			  inst->group_num,
+			  inst->peer_pid, inst->qlen, 
+			  inst->copy_mode, inst->copy_range,
+			  inst->flushtimeout, atomic_read(&inst->use));
+}
+
+static struct seq_operations nful_seq_ops = {
+	.start	= seq_start,
+	.next	= seq_next,
+	.stop	= seq_stop,
+	.show	= seq_show,
+};
+
+static int nful_open(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq;
+	struct iter_state *is;
+	int ret;
+
+	is = kmalloc(sizeof(*is), GFP_KERNEL);
+	if (!is)
+		return -ENOMEM;
+	memset(is, 0, sizeof(*is));
+	ret = seq_open(file, &nful_seq_ops);
+	if (ret < 0)
+		goto out_free;
+	seq = file->private_data;
+	seq->private = is;
+	return ret;
+out_free:
+	kfree(is);
+	return ret;
+}
+
+static struct file_operations nful_file_ops = {
+	.owner	 = THIS_MODULE,
+	.open	 = nful_open,
+	.read	 = seq_read,
+	.llseek	 = seq_lseek,
+	.release = seq_release_private,
+};
+
+#endif /* PROC_FS */
+
+static int
+init_or_cleanup(int init)
+{
+	int i, status = -ENOMEM;
+#ifdef CONFIG_PROC_FS
+	struct proc_dir_entry *proc_nful;
+#endif
+	
+	if (!init)
+		goto cleanup;
+
+	for (i = 0; i < INSTANCE_BUCKETS; i++)
+		INIT_HLIST_HEAD(&instance_table[i]);
+	
+	/* it's not really all that important to have a random value, so
+	 * we can do this from the init function, even if there hasn't
+	 * been that much entropy yet */
+	get_random_bytes(&hash_init, sizeof(hash_init));
+
+	netlink_register_notifier(&nfulnl_rtnl_notifier);
+	status = nfnetlink_subsys_register(&nfulnl_subsys);
+	if (status < 0) {
+		printk(KERN_ERR "log: failed to create netlink socket\n");
+		goto cleanup_netlink_notifier;
+	}
+
+#ifdef CONFIG_PROC_FS
+	proc_nful = create_proc_entry("nfnetlink_log", 0440,
+				      proc_net_netfilter);
+	if (!proc_nful)
+		goto cleanup_subsys;
+	proc_nful->proc_fops = &nful_file_ops;
+#endif
+
+	return status;
+
+cleanup:
+	nf_log_unregister_logger(&nfulnl_logger);
+#ifdef CONFIG_PROC_FS
+cleanup_subsys:
+#endif
+	nfnetlink_subsys_unregister(&nfulnl_subsys);
+cleanup_netlink_notifier:
+	netlink_unregister_notifier(&nfulnl_rtnl_notifier);
+	return status;
+}
+
+static int __init init(void)
+{
+	
+	return init_or_cleanup(1);
+}
+
+static void __exit fini(void)
+{
+	init_or_cleanup(0);
+}
+
+MODULE_DESCRIPTION("netfilter userspace logging");
+MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
+MODULE_LICENSE("GPL");
+
+module_init(init);
+module_exit(fini);

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] add refcounting and /proc to nfnetlink_queue
From: Harald Welte @ 2005-07-30 10:32 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, Netfilter Development Mailinglist


[-- Attachment #1.1: Type: text/plain, Size: 546 bytes --]

Hi Dave!

This patch is against nfnetlink_queue (which is already in your
net-2.6.14 tree).  Since it adds a file to /proc/net/netfilter, it also
depends on <20050728200434.GA3763@rama.de.gnumonks.org>.

Please apply, thanks.

-- 
- 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 #1.2: 18-nfnetlink_queue-refcount.patch --]
[-- Type: text/plain, Size: 12351 bytes --]

[NETFILTER] Add refcounting and /proc/net/netfilter interface to
	    nfnetlink_queue

Signed-off-by: Harald Welte <laforge@netfilter.org>

---
commit f00815c7d2b718eccbc3e7ec77592faff45e9ccc
tree 3af9c34bcc5bfb11f1a71f20694f4cae78f40cb4
parent 66ad9b079da5c6a181506fba350aa33d26417431
author laforge <laforge@netfilter.org> Sa, 30 Jul 2005 12:12:26 +0200
committer laforge <laforge@netfilter.org> Sa, 30 Jul 2005 12:12:26 +0200

 include/linux/netfilter/nfnetlink_queue.h |    1 
 net/netfilter/nfnetlink_queue.c           |  248 ++++++++++++++++++++++++++---
 2 files changed, 221 insertions(+), 28 deletions(-)

diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -81,5 +81,6 @@ enum nfqnl_attr_config {
 	NFQA_CFG_PARAMS,		/* nfqnl_msg_config_params */
 	__NFQA_CFG_MAX
 };
+#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
 
 #endif /* _NFNETLINK_QUEUE_H */
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -20,6 +20,7 @@
 #include <linux/notifier.h>
 #include <linux/netdevice.h>
 #include <linux/netfilter.h>
+#include <linux/proc_fs.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_ipv6.h>
 #include <linux/netfilter/nfnetlink.h>
@@ -48,6 +49,7 @@ struct nfqnl_queue_entry {
 
 struct nfqnl_instance {
 	struct hlist_node hlist;		/* global list of queues */
+	atomic_t use;
 
 	int peer_pid;
 	unsigned int queue_maxlen;
@@ -105,17 +107,28 @@ __instance_lookup(u_int16_t queue_num)
 }
 
 static struct nfqnl_instance *
-instance_lookup(u_int16_t queue_num)
+instance_lookup_get(u_int16_t queue_num)
 {
 	struct nfqnl_instance *inst;
 
 	read_lock_bh(&instances_lock);
 	inst = __instance_lookup(queue_num);
+	if (inst)
+		atomic_inc(&inst->use);
 	read_unlock_bh(&instances_lock);
 
 	return inst;
 }
 
+static void
+instance_put(struct nfqnl_instance *inst)
+{
+	if (inst && atomic_dec_and_test(&inst->use)) {
+		QDEBUG("kfree(inst=%p)\n", inst);
+		kfree(inst);
+	}
+}
+
 static struct nfqnl_instance *
 instance_create(u_int16_t queue_num, int pid)
 {
@@ -141,6 +154,8 @@ instance_create(u_int16_t queue_num, int
 	inst->copy_range = 0xfffff;
 	inst->copy_mode = NFQNL_COPY_NONE;
 	atomic_set(&inst->id_sequence, 0);
+	/* needs to be two, since we _put() after creation */
+	atomic_set(&inst->use, 2);
 	inst->lock = SPIN_LOCK_UNLOCKED;
 	INIT_LIST_HEAD(&inst->queue_list);
 
@@ -182,8 +197,8 @@ _instance_destroy2(struct nfqnl_instance
 	/* then flush all pending skbs from the queue */
 	nfqnl_flush(inst, NF_DROP);
 
-	/* and finally free the data structure */
-	kfree(inst);
+	/* and finally put the refcount */
+	instance_put(inst);
 
 	module_put(THIS_MODULE);
 }
@@ -471,7 +486,7 @@ nfqnl_enqueue_packet(struct sk_buff *skb
 
 	QDEBUG("entered\n");
 
-	queue = instance_lookup(queuenum);
+	queue = instance_lookup_get(queuenum);
 	if (!queue) {
 		QDEBUG("no queue instance matching\n");
 		return -EINVAL;
@@ -479,7 +494,8 @@ nfqnl_enqueue_packet(struct sk_buff *skb
 
 	if (queue->copy_mode == NFQNL_COPY_NONE) {
 		QDEBUG("mode COPY_NONE, aborting\n");
-		return -EAGAIN;
+		status = -EAGAIN;
+		goto err_out_put;
 	}
 
 	entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
@@ -487,7 +503,8 @@ nfqnl_enqueue_packet(struct sk_buff *skb
 		if (net_ratelimit())
 			printk(KERN_ERR 
 				"nf_queue: OOM in nfqnl_enqueue_packet()\n");
-		return -ENOMEM;
+		status = -ENOMEM;
+		goto err_out_put;
 	}
 
 	entry->info = info;
@@ -523,6 +540,7 @@ nfqnl_enqueue_packet(struct sk_buff *skb
 	__enqueue_entry(queue, entry);
 
 	spin_unlock_bh(&queue->lock);
+	instance_put(queue);
 	return status;
 
 err_out_free_nskb:
@@ -533,6 +551,8 @@ err_out_unlock:
 
 err_out_free:
 	kfree(entry);
+err_out_put:
+	instance_put(queue);
 	return status;
 }
 
@@ -685,6 +705,12 @@ static struct notifier_block nfqnl_rtnl_
 	.notifier_call	= nfqnl_rcv_nl_event,
 };
 
+static const int nfqa_verdict_min[NFQA_MAX] = {
+	[NFQA_VERDICT_HDR-1]	= sizeof(struct nfqnl_msg_verdict_hdr),
+	[NFQA_MARK-1]		= sizeof(u_int32_t),
+	[NFQA_PAYLOAD-1]	= 0,
+};
+
 static int
 nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
 		   struct nlmsghdr *nlh, struct nfattr *nfqa[], int *errp)
@@ -696,26 +722,40 @@ nfqnl_recv_verdict(struct sock *ctnl, st
 	struct nfqnl_instance *queue;
 	unsigned int verdict;
 	struct nfqnl_queue_entry *entry;
+	int err;
 
-	queue = instance_lookup(queue_num);
+	if (nfattr_bad_size(nfqa, NFQA_MAX, nfqa_verdict_min)) {
+		QDEBUG("bad attribute size\n");
+		return -EINVAL;
+	}
+
+	queue = instance_lookup_get(queue_num);
 	if (!queue)
 		return -ENODEV;
 
-	if (queue->peer_pid != NETLINK_CB(skb).pid)
-		return -EPERM;
+	if (queue->peer_pid != NETLINK_CB(skb).pid) {
+		err = -EPERM;
+		goto err_out_put;
+	}
 
-	if (!nfqa[NFQA_VERDICT_HDR-1])
-		return -EINVAL;
+	if (!nfqa[NFQA_VERDICT_HDR-1]) {
+		err = -EINVAL;
+		goto err_out_put;
+	}
 
 	vhdr = NFA_DATA(nfqa[NFQA_VERDICT_HDR-1]);
 	verdict = ntohl(vhdr->verdict);
 
-	if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT)
-		return -EINVAL;
+	if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT) {
+		err = -EINVAL;
+		goto err_out_put;
+	}
 
 	entry = find_dequeue_entry(queue, id_cmp, ntohl(vhdr->id));
-	if (entry == NULL)
-		return -ENOENT;
+	if (entry == NULL) {
+		err = -ENOENT;
+		goto err_out_put;
+	}
 
 	if (nfqa[NFQA_PAYLOAD-1]) {
 		if (nfqnl_mangle(NFA_DATA(nfqa[NFQA_PAYLOAD-1]),
@@ -727,7 +767,12 @@ nfqnl_recv_verdict(struct sock *ctnl, st
 		skb->nfmark = ntohl(*(u_int32_t *)NFA_DATA(nfqa[NFQA_MARK-1]));
 		
 	issue_verdict(entry, verdict);
+	instance_put(queue);
 	return 0;
+
+err_out_put:
+	instance_put(queue);
+	return err;
 }
 
 static int
@@ -737,6 +782,11 @@ nfqnl_recv_unsupp(struct sock *ctnl, str
 	return -ENOTSUPP;
 }
 
+static const int nfqa_cfg_min[NFQA_CFG_MAX] = {
+	[NFQA_CFG_CMD-1]	= sizeof(struct nfqnl_msg_config_cmd),
+	[NFQA_CFG_PARAMS-1]	= sizeof(struct nfqnl_msg_config_params),
+};
+
 static int
 nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
 		  struct nlmsghdr *nlh, struct nfattr *nfqa[], int *errp)
@@ -744,10 +794,16 @@ nfqnl_recv_config(struct sock *ctnl, str
 	struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
 	u_int16_t queue_num = ntohs(nfmsg->res_id);
 	struct nfqnl_instance *queue;
+	int ret = 0;
 
 	QDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type));
 
-	queue = instance_lookup(queue_num);
+	if (nfattr_bad_size(nfqa, NFQA_CFG_MAX, nfqa_cfg_min)) {
+		QDEBUG("bad attribute size\n");
+		return -EINVAL;
+	}
+
+	queue = instance_lookup_get(queue_num);
 	if (nfqa[NFQA_CFG_CMD-1]) {
 		struct nfqnl_msg_config_cmd *cmd;
 		cmd = NFA_DATA(nfqa[NFQA_CFG_CMD-1]);
@@ -766,17 +822,19 @@ nfqnl_recv_config(struct sock *ctnl, str
 			if (!queue)
 				return -ENODEV;
 
-			if (queue->peer_pid != NETLINK_CB(skb).pid)
-				return -EPERM;
+			if (queue->peer_pid != NETLINK_CB(skb).pid) {
+				ret = -EPERM;
+				goto out_put;
+			}
 
 			instance_destroy(queue);
 			break;
 		case NFQNL_CFG_CMD_PF_BIND:
 			QDEBUG("registering queue handler for pf=%u\n",
 				ntohs(cmd->pf));
-			return nf_register_queue_handler(ntohs(cmd->pf),
-							 nfqnl_enqueue_packet,
-							 NULL);
+			ret = nf_register_queue_handler(ntohs(cmd->pf),
+							nfqnl_enqueue_packet,
+							NULL);
 
 			break;
 		case NFQNL_CFG_CMD_PF_UNBIND:
@@ -784,20 +842,23 @@ nfqnl_recv_config(struct sock *ctnl, str
 				ntohs(cmd->pf));
 			/* This is a bug and a feature.  We can unregister
 			 * other handlers(!) */
-			return nf_unregister_queue_handler(ntohs(cmd->pf));
+			ret = nf_unregister_queue_handler(ntohs(cmd->pf));
 			break;
 		default:
-			return -EINVAL;
+			ret = -EINVAL;
+			break;
 		}
 	} else {
 		if (!queue) {
 			QDEBUG("no config command, and no instance ENOENT\n");
-			return -ENOENT;
+			ret = -ENOENT;
+			goto out_put;
 		}
 
 		if (queue->peer_pid != NETLINK_CB(skb).pid) {
 			QDEBUG("no config command, and wrong pid\n");
-			return -EPERM;
+			ret = -EPERM;
+			goto out_put;
 		}
 	}
 
@@ -809,7 +870,9 @@ nfqnl_recv_config(struct sock *ctnl, str
 				ntohl(params->copy_range));
 	}
 
-	return 0;
+out_put:
+	instance_put(queue);
+	return ret;
 }
 
 static struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = {
@@ -829,14 +892,132 @@ static struct nfnetlink_subsystem nfqnl_
 	.cb		= nfqnl_cb,
 };
 
+#ifdef CONFIG_PROC_FS
+struct iter_state {
+	unsigned int bucket;
+};
+
+static struct hlist_node *get_first(struct seq_file *seq)
+{
+	struct iter_state *st = seq->private;
+
+	if (!st)
+		return NULL;
+
+	for (st->bucket = 0; st->bucket < INSTANCE_BUCKETS; st->bucket++) {
+		if (!hlist_empty(&instance_table[st->bucket]))
+			return instance_table[st->bucket].first;
+	}
+	return NULL;
+}
+
+static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h)
+{
+	struct iter_state *st = seq->private;
+
+	h = h->next;
+	while (!h) {
+		if (++st->bucket >= INSTANCE_BUCKETS)
+			return NULL;
+
+		h = instance_table[st->bucket].first;
+	}
+	return h;
+}
+
+static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)
+{
+	struct hlist_node *head;
+	head = get_first(seq);
+
+	if (head)
+		while (pos && (head = get_next(seq, head)))
+			pos--;
+	return pos ? NULL : head;
+}
+
+static void *seq_start(struct seq_file *seq, loff_t *pos)
+{
+	read_lock_bh(&instances_lock);
+	return get_idx(seq, *pos);
+}
+
+static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
+{
+	(*pos)++;
+	return get_next(s, v);
+}
+
+static void seq_stop(struct seq_file *s, void *v)
+{
+	read_unlock_bh(&instances_lock);
+}
+
+static int seq_show(struct seq_file *s, void *v)
+{
+	const struct nfqnl_instance *inst = v;
+
+	return seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n",
+			  inst->queue_num,
+			  inst->peer_pid, inst->queue_total,
+			  inst->copy_mode, inst->copy_range,
+			  inst->queue_dropped, inst->queue_user_dropped,
+			  atomic_read(&inst->id_sequence),
+			  atomic_read(&inst->use));
+}
+
+static struct seq_operations nfqnl_seq_ops = {
+	.start	= seq_start,
+	.next	= seq_next,
+	.stop	= seq_stop,
+	.show	= seq_show,
+};
+
+static int nfqnl_open(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq;
+	struct iter_state *is;
+	int ret;
+
+	is = kmalloc(sizeof(*is), GFP_KERNEL);
+	if (!is)
+		return -ENOMEM;
+	memset(is, 0, sizeof(*is));
+	ret = seq_open(file, &nfqnl_seq_ops);
+	if (ret < 0)
+		goto out_free;
+	seq = file->private_data;
+	seq->private = is;
+	return ret;
+out_free:
+	kfree(is);
+	return ret;
+}
+
+static struct file_operations nfqnl_file_ops = {
+	.owner	 = THIS_MODULE,
+	.open	 = nfqnl_open,
+	.read	 = seq_read,
+	.llseek	 = seq_lseek,
+	.release = seq_release_private,
+};
+
+#endif /* PROC_FS */
+
 static int
 init_or_cleanup(int init)
 {
-	int status = -ENOMEM;
+	int i, status = -ENOMEM;
+#ifdef CONFIG_PROC_FS
+	struct proc_dir_entry *proc_nfqueue;
+#endif
 	
 	if (!init)
 		goto cleanup;
 
+	for (i = 0; i < INSTANCE_BUCKETS; i++)
+		INIT_HLIST_HEAD(&instance_table[i]);
+
 	netlink_register_notifier(&nfqnl_rtnl_notifier);
 	status = nfnetlink_subsys_register(&nfqnl_subsys);
 	if (status < 0) {
@@ -844,14 +1025,25 @@ init_or_cleanup(int init)
 		goto cleanup_netlink_notifier;
 	}
 
+#ifdef CONFIG_PROC_FS
+	proc_nfqueue = create_proc_entry("nfnetlink_queue", 0440,
+					 proc_net_netfilter);
+	if (!proc_nfqueue)
+		goto cleanup_subsys;
+	proc_nfqueue->proc_fops = &nfqnl_file_ops;
+#endif
+
 	register_netdevice_notifier(&nfqnl_dev_notifier);
+
 	return status;
 
 cleanup:
 	nf_unregister_queue_handlers(nfqnl_enqueue_packet);
 	unregister_netdevice_notifier(&nfqnl_dev_notifier);
+#ifdef CONFIG_PROC_FS
+cleanup_subsys:
+#endif	
 	nfnetlink_subsys_unregister(&nfqnl_subsys);
-	
 cleanup_netlink_notifier:
 	netlink_unregister_notifier(&nfqnl_rtnl_notifier);
 	return status;

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Diego Beltrami @ 2005-07-30 11:01 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Pekka Nikander, netdev, infrahip, hipl-users, hipsec
In-Reply-To: <20050729234859.GA27325@gondor.apana.org.au>

> On Fri, Jul 29, 2005 at 05:45:24PM +0200, Pekka Nikander wrote:
> > >Surely BEET will work also for AH with minor changes, even though we
> > >only tried the ESP encapsulation.
> > 
> > I wouldn't be so sure.  IIRC, tunnel mode is not specified for AH but  
> > for ESP only.  Consequently, defining BEET mode for AH might be  
> 
> Well plain tunnel mode certainly is specified for AH as well as IPComp.
> But you're right the semantics of BEET mode for AH needs to be thought
> out.
> 

The Linux patch which has been presented (see URL: 
http://infrahip.hiit.fi/beet/beet-patch-v1.0-2.6.12.2 ), has been
developed based upon the design given by the draft

http://www.ietf.org/internet-drafts/draft-nikander-esp-beet-mode-03.txt

As a result BEET patch considers the ESP encapsulation as it has been
designed.

OTOH we believe the implementation is usable more or less as it is now
for AH and perhaps IPComp in the future. But, as already mentioned both
by Pekka and Herbert, this would need more thinking and designing.

The implementation is flexible enough to finetune once the semantics for
similar optimizations have been considered for AH and IPComp.

--Diego

^ permalink raw reply

* Re: [hipl-users] Re: [PATCH 2.6.12.2] XFRM: BEET IPsec mode for Linux
From: Herbert Xu @ 2005-07-30 11:15 UTC (permalink / raw)
  To: diego.beltrami; +Cc: herbert, infrahip, netdev
In-Reply-To: <1122651216.25842.67.camel@odysse>

Diego Beltrami <diego.beltrami@hiit.fi> wrote:
> 
> The modifications in the ESP functions are due to the hybrid cases when
> Inner and Outer address families are different; in those cases the
> values returned by espX functions are not coherent.

I see.  However, this is really a consequence of us not implementing
interfamily transforms for plain old tunnel mode.  Had we implemented
that, it would be a piece of cake to extend this to BEET without
touching ESP.

>> Also, if you're going to do cross-family transforms, it should be
>> done for both BEET and plain tunnel-mode.
> 
> Potentially it could be possible also for plain tunnel-mode: this will
> require further analysis.

It definitely does need further analysis even for BEET mode.  The rcv
path for interfamily transforms is straightforward since we pass through
netif_rx.  However, on the outbound path things aren't that simple.

I suggest that you remove the interfamily support for the initial merge
of the BEET implementation.  We can then readd it for both plain tunnel
and BEET mode.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH] MASQUERADE: inherit masq_index to slave connections
From: Harald Welte @ 2005-07-30 13:55 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, Netfilter Development Mailinglist


[-- Attachment #1.1: Type: text/plain, Size: 606 bytes --]

Hi Dave!

This fixes a bug with MASQUERADE and nat helpers.  The fix applies to
both net-2.6.14 and Linus' current git tree.

I'll send a 2.4.31 version of the patch directly to Marcelo (will Cc
you).

Please apply, thanks.

-- 
- 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 #1.2: 19-masq_index-inheritance.patch --]
[-- Type: text/plain, Size: 1391 bytes --]

[NETFILTER] Inherit masq_index to slave connections

masq_index is used for cleanup in case the interface address changes
(such as a dialup ppp link with dynamic addreses).  Without this patch,
slave connections are not evicted in such a case, since they don't inherit
masq_index.

Signed-off-by: Harald Welte <laforge@netfilter.org>

---
commit bd4123d85f932f9bd60da9d2ed3523dc7b792075
tree a0218fc4d42630d33d99b4167f6dccf209cfd091
parent f00815c7d2b718eccbc3e7ec77592faff45e9ccc
author laforge <laforge@netfilter.org> Sa, 30 Jul 2005 15:35:35 +0200
committer laforge <laforge@netfilter.org> Sa, 30 Jul 2005 15:35:35 +0200

 net/ipv4/netfilter/ip_conntrack_core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -726,6 +726,11 @@ init_conntrack(struct ip_conntrack_tuple
 #if CONFIG_IP_NF_CONNTRACK_MARK
 		conntrack->mark = exp->master->mark;
 #endif
+#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
+    defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
+		/* this is ugly, but there is no other place where to put it */
+		conntrack->nat.masq_index = exp->master->nat.masq_index;
+#endif
 		nf_conntrack_get(&conntrack->master->ct_general);
 		CONNTRACK_STAT_INC(expect_new);
 	} else {

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] MASQUERADE: inherit masq_index to slave connections
From: Harald Welte @ 2005-07-30 14:00 UTC (permalink / raw)
  To: Marcelo Tossati; +Cc: Linux Netdev List, Netfilter Development Mailinglist


[-- Attachment #1.1: Type: text/plain, Size: 514 bytes --]

Hi Marcelo!

Pleae apply the following trivial fix to your 2.4.x tree.  I've already
submitted a 2.6.x fix for this to davem.

Thanks!

-- 
- 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 #1.2: 19-masq_index-inheritance.patch --]
[-- Type: text/plain, Size: 1183 bytes --]

[NETFILTER] Inherit masq_index to slave connections

masq_index is used for cleanup in case the interface address changes
(such as a dialup ppp link with dynamic addreses).  Without this patch,
slave connections are not evicted in such a case, since they don't inherit
masq_index.

Signed-off-by: Harald Welte <laforge@netfilter.org>

Index: linux-2.4.31/net/ipv4/netfilter/ip_conntrack_core.c
===================================================================
--- linux-2.4.31.orig/net/ipv4/netfilter/ip_conntrack_core.c	2005-04-04 03:42:20.000000000 +0200
+++ linux-2.4.31/net/ipv4/netfilter/ip_conntrack_core.c	2005-07-30 15:59:41.000000000 +0200
@@ -741,6 +741,11 @@
 		/* Welcome, Mr. Bond.  We've been expecting you... */
 		__set_bit(IPS_EXPECTED_BIT, &conntrack->status);
 		conntrack->master = expected;
+#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
+    defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
+		/* this is ugly, but there is no other place where to put it */
+		conntrack->nat.masq_index = expected->expectant->nat.masq_index;
+#endif
 		expected->sibling = conntrack;
 		LIST_DELETE(&ip_conntrack_expect_list, expected);
 		expected->expectant->expecting--;

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] add new nfnetlink_log subsystem
From: Sven Schuster @ 2005-07-30 16:41 UTC (permalink / raw)
  To: Harald Welte, David Miller, Linux Netdev List,
	Netfilter Development Mailinglist
In-Reply-To: <20050730103005.GB6620@rama.de.gnumonks.org>

[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]


Hi Harald,

On Sat, Jul 30, 2005 at 12:30:05PM +0200, Harald Welte told us:
> diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
> new file mode 100644
> --- /dev/null
> +++ b/net/netfilter/nfnetlink_log.c
> @@ -0,0 +1,992 @@
...
> +static struct sk_buff *nfulnl_alloc_skb(unsigned int inst_size, 
> +					unsigned int pkt_size)
> +{
> +	struct sk_buff *skb;
> +
> +	UDEBUG("entered (%u, %u)\n", inst_size, pkt_size);
> +
> +	/* alloc skb whihc should be big enough for a whole multipart

typo, which

> +	 * message.  WARNING: has to be <= 128k due to slab restrictions */
> +

...

> +
> +static int
> +init_or_cleanup(int init)
> +{

...

> +#ifdef CONFIG_PROC_FS
> +	proc_nful = create_proc_entry("nfnetlink_log", 0440,
> +				      proc_net_netfilter);
> +	if (!proc_nful)
> +		goto cleanup_subsys;
> +	proc_nful->proc_fops = &nful_file_ops;
> +#endif
> +
> +	return status;
> +
> +cleanup:
> +	nf_log_unregister_logger(&nfulnl_logger);
> +#ifdef CONFIG_PROC_FS
> +cleanup_subsys:

no remove_proc_entry??

> +#endif
> +	nfnetlink_subsys_unregister(&nfulnl_subsys);
> +cleanup_netlink_notifier:
> +	netlink_unregister_notifier(&nfulnl_rtnl_notifier);
> +	return status;
> +}
> +

Kind regards,

Sven

-- 
Linux zion 2.6.13-rc3-mm1 #17 PREEMPT Thu Jul 28 02:56:37 CEST 2005 i686 athlon i386 GNU/Linux
 18:34:22 up 19:35,  2 users,  load average: 0.28, 0.11, 0.03

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] add new nfnetlink_log subsystem
From: Harald Welte @ 2005-07-30 17:33 UTC (permalink / raw)
  To: Sven Schuster; +Cc: Linux Netdev List, Netfilter Development Mailinglist
In-Reply-To: <20050730164121.GA14794@zion.homelinux.com>


[-- Attachment #1.1: Type: text/plain, Size: 543 bytes --]

Thanks for your comments, Sven.

Dave: Please apply the attached patch on top of all other patches I sent
you. It also fixes the same bug in nfnetlink_queue. Thanks!

-- 
- 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 #1.2: 20-proc_net_remove.patch --]
[-- Type: text/plain, Size: 1894 bytes --]

[NETFILTER] add proc_net_remove() to nfnetlink_queue and nfnetlink_log

Also fixes a typo inside a comment.
Thanks to Sven Schuster <schuster.sven@gmx.de>

Signed-off-by: Harald Welte <laforge@netfilter.org>

---
commit a04a82e4fe4be531383909217bcb2d4ad096ecda
tree 1424e9d687c2b5217d82bcf04abb97a2f8aced69
parent bd4123d85f932f9bd60da9d2ed3523dc7b792075
author laforge <laforge@netfilter.org> Sa, 30 Jul 2005 19:30:32 +0200
committer laforge <laforge@netfilter.org> Sa, 30 Jul 2005 19:30:32 +0200

 net/netfilter/nfnetlink_log.c   |    3 ++-
 net/netfilter/nfnetlink_queue.c |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -314,7 +314,7 @@ static struct sk_buff *nfulnl_alloc_skb(
 
 	UDEBUG("entered (%u, %u)\n", inst_size, pkt_size);
 
-	/* alloc skb whihc should be big enough for a whole multipart
+	/* alloc skb which should be big enough for a whole multipart
 	 * message.  WARNING: has to be <= 128k due to slab restrictions */
 
 	skb = alloc_skb(inst_size, GFP_ATOMIC);
@@ -965,6 +965,7 @@ init_or_cleanup(int init)
 cleanup:
 	nf_log_unregister_logger(&nfulnl_logger);
 #ifdef CONFIG_PROC_FS
+	remove_proc_entry("nfnetlink_log", proc_net_netfilter);
 cleanup_subsys:
 #endif
 	nfnetlink_subsys_unregister(&nfulnl_subsys);
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1041,6 +1041,7 @@ cleanup:
 	nf_unregister_queue_handlers(nfqnl_enqueue_packet);
 	unregister_netdevice_notifier(&nfqnl_dev_notifier);
 #ifdef CONFIG_PROC_FS
+	remove_proc_entry("nfnetlink_queue", proc_net_netfilter);
 cleanup_subsys:
 #endif	
 	nfnetlink_subsys_unregister(&nfqnl_subsys);

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [git patches] new wireless stuffs
From: Jeff Garzik @ 2005-07-30 23:24 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: Linux Kernel, Netdev List

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]


If this is post-2.6.13 material, that's fine.

I've been getting tired of the slow movement of wireless.  A little bit 
of that is my fault, certainly.  I've also been wanting to get these net 
drivers out to Linux users.

This adds HostAP, ipw2100, ipw2200, and the generic ieee80211 code.  The 
only -changes- in this set are cosmetic.

Further work is pending from SuSE and Intel [*poke* *poke* to them], but 
these should be working, and have been in -mm for quite a while.

One big thing I'm still hoping for is that someone will merge HostAP 
(where ieee80211 code came from) with the ieee80211 generic code.  The 
HostAP maintainer has been unwilling to do it, even though he has been 
good about keeping HostAP updated, so hopefully a volunteer will step up.

Please pull from branch 'ieee80211-wifi' of
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

to obtain the changes described by the attached diffstat/changelog.  The 
file additions were too large to attach, so I only attached the changes 
to existing files.  Existing drivers merely had some struct renames (for 
new ieee80211 header), and some 'add "static" attribute' changes.

	Jeff





[-- Attachment #2: netdev-2.6.txt --]
[-- Type: text/plain, Size: 28903 bytes --]

 drivers/net/wireless/ieee802_11.h               |   78 
 Documentation/networking/README.ipw2100         |  246 
 Documentation/networking/README.ipw2200         |  290 
 MAINTAINERS                                     |    7 
 drivers/net/wireless/Kconfig                    |  106 
 drivers/net/wireless/Makefile                   |    6 
 drivers/net/wireless/airo.c                     |   65 
 drivers/net/wireless/atmel.c                    |   62 
 drivers/net/wireless/hostap/Kconfig             |  104 
 drivers/net/wireless/hostap/Makefile            |    8 
 drivers/net/wireless/hostap/hostap.c            | 1205 +++
 drivers/net/wireless/hostap/hostap.h            |   57 
 drivers/net/wireless/hostap/hostap_80211.h      |  107 
 drivers/net/wireless/hostap/hostap_80211_rx.c   | 1084 +++
 drivers/net/wireless/hostap/hostap_80211_tx.c   |  522 +
 drivers/net/wireless/hostap/hostap_ap.c         | 3286 +++++++++
 drivers/net/wireless/hostap/hostap_ap.h         |  272 
 drivers/net/wireless/hostap/hostap_common.h     |  558 +
 drivers/net/wireless/hostap/hostap_config.h     |   86 
 drivers/net/wireless/hostap/hostap_crypt.c      |  167 
 drivers/net/wireless/hostap/hostap_crypt.h      |   50 
 drivers/net/wireless/hostap/hostap_crypt_ccmp.c |  487 +
 drivers/net/wireless/hostap/hostap_crypt_tkip.c |  697 +
 drivers/net/wireless/hostap/hostap_crypt_wep.c  |  283 
 drivers/net/wireless/hostap/hostap_cs.c         |  985 ++
 drivers/net/wireless/hostap/hostap_download.c   |  766 ++
 drivers/net/wireless/hostap/hostap_hw.c         | 3634 ++++++++++
 drivers/net/wireless/hostap/hostap_info.c       |  499 +
 drivers/net/wireless/hostap/hostap_ioctl.c      | 4123 +++++++++++
 drivers/net/wireless/hostap/hostap_pci.c        |  455 +
 drivers/net/wireless/hostap/hostap_plx.c        |  622 +
 drivers/net/wireless/hostap/hostap_proc.c       |  448 +
 drivers/net/wireless/hostap/hostap_wlan.h       | 1074 ++
 drivers/net/wireless/ipw2100.c                  | 8641 ++++++++++++++++++++++++
 drivers/net/wireless/ipw2100.h                  | 1195 +++
 drivers/net/wireless/ipw2200.c                  | 7361 ++++++++++++++++++++
 drivers/net/wireless/ipw2200.h                  | 1770 ++++
 drivers/net/wireless/orinoco.c                  |   11 
 drivers/net/wireless/strip.c                    |    2 
 drivers/net/wireless/wavelan_cs.c               |   26 
 drivers/net/wireless/wavelan_cs.h               |    6 
 drivers/net/wireless/wavelan_cs.p.h             |   17 
 drivers/net/wireless/wl3501.h                   |    4 
 drivers/net/wireless/wl3501_cs.c                |   11 
 drivers/usb/net/Makefile                        |    2 
 drivers/usb/net/zd1201.c                        |   16 
 include/linux/etherdevice.h                     |    6 
 include/net/ieee80211.h                         |    4 
 include/net/ieee80211_crypt.h                   |   86 
 net/Kconfig                                     |    1 
 net/Makefile                                    |    1 
 net/ieee80211/Kconfig                           |   69 
 net/ieee80211/Makefile                          |   11 
 net/ieee80211/ieee80211_crypt.c                 |  259 
 net/ieee80211/ieee80211_crypt_ccmp.c            |  470 +
 net/ieee80211/ieee80211_crypt_tkip.c            |  708 +
 net/ieee80211/ieee80211_crypt_wep.c             |  272 
 net/ieee80211/ieee80211_module.c                |  273 
 net/ieee80211/ieee80211_rx.c                    | 1205 +++
 net/ieee80211/ieee80211_tx.c                    |  447 +
 net/ieee80211/ieee80211_wx.c                    |  471 +
 61 files changed, 45586 insertions(+), 198 deletions(-)



commit f3b10e1636dec053f4874d593e3de5d46da48a5f
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:50:06 2005 -0700

    [PATCH] hostap update
    
    Fixed beacon frame when moving from monitor mode to master mode
    (workaround for firmware bug that left IBSS IE in the Beacon
    frames). This is using the same workaround that was previously used
    when moving from adhoc mode to master mode.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit b15eff2632be3fcea68e01ba7f12e26a731e3157
Author: Pavel Roskin <proski@gnu.org>
Date:   Sat Jul 30 12:50:05 2005 -0700

    [PATCH] hostap update
    
    Warning fix for 64-bit platforms
    
    Hello!
    
    The patch fixes following warning seen on 64-bit platforms (in my case -
    x86_64, gcc-4.0):
    
    In file included from /usr/local/src/hostap/driver/modules/hostap_cs.c:203:
    /usr/local/src/hostap/driver/modules/hostap_hw.c: In function ?prism2_transmit_cb?:
    /usr/local/src/hostap/driver/modules/hostap_hw.c:1674: warning: cast from pointer to integer of different size
    /usr/local/src/hostap/driver/modules/hostap_hw.c: In function ?prism2_transmit?:
    /usr/local/src/hostap/driver/modules/hostap_hw.c:1758: warning: cast to pointer from integer of different size
    
    prism2_transmit_cb uses a (void *) argument to get an integer.   A
    simple fix would be to use double cast from pointer to long and then to
    int (and vice versa when int is passed as a pointer).  But I prefer a
    slightly longer patch.
    
    I believe that whenever an argument can hold both a pointer and an
    integer, it should be declared long.  long can hold both pointers and
    integers (except win64, but we are not coding for Windows), it can be
    cast to both of them and it's never assumed to be a valid pointer, which
    could be useful for some automatic code checkers.
    
    Signed-off-by: Pavel Roskin <proski@gnu.org>
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 3e1d393240880e3d7ae580c46f1ba265643fcd15
Author: Brandon Enochs <enochs@itd.nrl.navy.mil>
Date:   Sat Jul 30 12:50:04 2005 -0700

    [PATCH] hostap update
    
    line 129 of hostap_80211_rx.c should read:
    
           LWNG_SETVAL(mactime, 2, 0, 4, rx_stats->mac_time);
    
    not:
           LWNG_SETVAL(mactime, 2, 0, 0, rx_stats->mac_time);
    
    The length field is incorrect.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 0c629a69fd8ec7b67566cfc052a9b1c4b927805a
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:50:03 2005 -0700

    [PATCH] hostap update
    
    Firmware seems to be getting into odd state in host_roaming mode 2
    when hostscan is used without join command, so try to fix this by
    re-joining the current AP. This does not actually trigger a new
    association if the current AP is still in the scan results.
    
    This makes background scans (iwlist wlan0 scan) not to break data
    connection when in host_roaming 2 mode, e.g., when using wpa_supplicant.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 2e4fd068e7e25e654a454ed4a425f239c0f6407a
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:50:02 2005 -0700

    [PATCH] hostap update
    
    Cleaned up scan result processing by converting struct
    hfa384x_scan_result into struct hfa384x_hostscan_result. This removes
    special cases from result processing since the results are only used
    in one, hostscan, format.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 72ca9c61cddb82a8596cee8141656d50aba42be5
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:50:01 2005 -0700

    [PATCH] hostap update
    
    Added support for setting channel mask for scan requests
    ('iwpriv wlan0 scan_channels 0x00ff' masks scans to use channels 1-8).
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit f06ac319c05c6822f878f201ae80e54fbbe8be8c
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:50:00 2005 -0700

    [PATCH] hostap update
    
    Add MODULE_VERSION information for the Host AP kernel modules and
    update the version string to indicate which version of the external
    Host AP driver is included in the kernel tree.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 093853c395df33104ee12c3df4398820d665d107
Author: Henrik Brix Andersen <brix@gentoo.org>
Date:   Sat Jul 30 12:49:59 2005 -0700

    [PATCH] hostap update
    
    pcmcia id_table for hostap_cs.c
    
    Hi Jouni,
    
    Here's a patch for adding a pcmcia id_table to hostap_cs.c as introduced
    by the PCMCIA subsystem changes in linux-2.6.13-rc1. The id_table allows
    hotplug (along with pcmciautils [1]) to load the driver without the need
    for the pcmcia-cs cardmgr daemon.
    
    The id_table was generated from the CVS version of hostap_cs.conf using
    a script borrowed from Dominik Brodowski. I have removed any duplicate
    entries, but I have only been able to test the functionality of the
    patch with a Linksys WPC11v3.
    
    Sincerely,
    Brix
    
    [1]: http://www.kernel.org/pub/linux/utils/kernel/pcmcia/
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 0cd545d6ba0e0138782eb0ec287d0eb3db529b69
Author: Dave Hansen <haveblue@us.ibm.com>
Date:   Sat Jul 30 12:49:58 2005 -0700

    [PATCH] hostap update
    
    Create sysfs "device" files for hostap
    
    I was writing some scripts to automatically build kismet source lines,
    and I noticed that hostap devices don't have device files, unlike my
    prism54 and ipw2200 cards:
    
    $ ls -l /sys/class/net/eth0/device
    /sys/class/net/eth0/device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:01.0
    $ ls -l /sys/class/net/wifi0
    ls: /sys/class/net/wifi0/device: No such file or directory
    $ ls -l /sys/class/net/wlan0
    ls: /sys/class/net/wlan0/device: No such file or directory
    
    The following (quite small) patch makes sure that both the wlan and wifi
    net devices have that pointer to the bus device.
    
    This way, I can do things like
    
            for i in /sys/class/net/*; do
                    if ! [ -e $i/device/drive ]; then
                            continue;
                    fi;
                    driver=$(basename $(readlink $i/device/driver))
                    case $driver in
                            hostap*)
                                    echo -- hostap,$i,$i-$driver
                                    break;
                            ipw2?00)
                                    echo -- $driver,$i,$i-$driver
                                    break;
                            prism54)
                                    echo prism54g,$i
                    esac
            done
    
    Which should generate a working set of source lines for kismet no matter
    what order I plug the cards in.
    
    It might also be handy to have a link between the two net devices, but
    that's a patch for another day.
    
    That patch is against 2.6.13-rc1-mm1.
    
    -- Dave
    
    Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 0ef79ee22cf5c1b177184c18b6525889bcc6681f
Author: Jar <jar@pcuf.fi>
Date:   Sat Jul 30 12:49:57 2005 -0700

    [PATCH] hostap update
    
    hostap_cs: Remove irq_list, irq_mask and pcmcia/version.h
    
    Remove irq_list, irq_mask and pcmcia/version.h as suggested in
    http://kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 1fad810473423bbf0626fab2fbeb27a4663fa2d5
Author: Adrian Bunk <bunk@stusta.de>
Date:   Sat Jul 30 12:49:56 2005 -0700

    [PATCH] hostap update
    
    EXPORT_SYMTAB does nothing. There's no need to define something if it
    doesn't have any effect.
    
    Signed-off-by: Adrian Bunk <bunk@stusta.de>
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit 47e362cf6942de8b3a227929bf8bab578d92ad49
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Sat Jul 30 12:49:55 2005 -0700

    [PATCH] hostap update
    
    Update hostap_cs to use new PCMCIA event callback registration.
    
    Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>
    Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

commit de745fb27983770ebfdeaa70f8a36f791fb33786
Merge: 08cd84c81f27d5bd22ba958b7cae6d566c509280 a670fcb43f01a67ef56176afc76e5d43d128b25c
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Sat Jul 30 18:14:50 2005 -0400

    /spare/repo/netdev-2.6 branch 'ieee80211'

commit a670fcb43f01a67ef56176afc76e5d43d128b25c
Merge: 327309e899662b482c58cf25f574513d38b5788c b0825488a642cadcf39709961dde61440cb0731c
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Sat Jul 30 18:14:15 2005 -0400

    /spare/repo/netdev-2.6 branch 'master'

commit 08cd84c81f27d5bd22ba958b7cae6d566c509280
Merge: e9dd2561793c05d70c9df1bc16a2dde6f23388df 327309e899662b482c58cf25f574513d38b5788c
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Wed Jul 13 19:11:44 2005 -0400

    Merge /spare/repo/netdev-2.6 branch 'ieee80211'

commit 327309e899662b482c58cf25f574513d38b5788c
Merge: 0c168775709faa74c1b87f1e61046e0c51ade7f3 c32511e2718618f0b53479eb36e07439aa363a74
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Wed Jul 13 16:23:51 2005 -0400

    Merge upstream 2.6.13-rc3 into ieee80211 branch of netdev-2.6.

commit e9dd2561793c05d70c9df1bc16a2dde6f23388df
Merge: d011e151bc5d1a581bf35b492a4fde44d30382b9 0c168775709faa74c1b87f1e61046e0c51ade7f3
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Thu Jun 30 00:49:38 2005 -0400

    Merge /spare/repo/netdev-2.6 branch 'ieee80211'

commit 0c168775709faa74c1b87f1e61046e0c51ade7f3
Merge: 9bd481f85940726bf66aae5cd03c5b912ad0ae4c 9b4311eedb17fa88f02e4876cd6aa9a08e383cd6
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Thu Jun 30 00:49:18 2005 -0400

    Merge upstream 2.6.13-rc1-git1 into 'ieee80211' branch of netdev-2.6.

commit 9bd481f85940726bf66aae5cd03c5b912ad0ae4c
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Tue Jun 28 01:46:35 2005 -0400

    wireless: fix ipw warning; add is_broadcast_ether_addr() to linux/etherdevice.h

commit d011e151bc5d1a581bf35b492a4fde44d30382b9
Merge: 30b4d6565e4d57c6d03600c7822411c7cac19638 2179a59db18ddf8eb3fd0133a3bee57f1c2b5b06
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Tue Jun 28 00:46:58 2005 -0400

    Merge /spare/repo/netdev-2.6 branch 'ieee80211'

commit 2179a59db18ddf8eb3fd0133a3bee57f1c2b5b06
Merge: ad3fee560bc508008b3b2cf6358105c4c7081921 99f95e5286df2f69edab8a04c7080d986ee4233b
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Tue Jun 28 00:46:46 2005 -0400

    Merge /spare/repo/linux-2.6/

commit 30b4d6565e4d57c6d03600c7822411c7cac19638
Merge: aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f ad3fee560bc508008b3b2cf6358105c4c7081921
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Mon Jun 27 23:45:25 2005 -0400

    Merge /spare/repo/netdev-2.6 branch 'ieee80211'

commit ad3fee560bc508008b3b2cf6358105c4c7081921
Author: Andrew Morton <akpm@osdl.org>
Date:   Mon Jun 20 14:30:36 2005 -0700

    [PATCH] wireless-device-attr-fixes-2
    
    More fixes for greg depredations.
    
    Also nuke lots of pointless typecasts.
    
    All this new wireless code adds near-infinite amounts of trailing whitespace.
    
    Cc: Jeff Garzik <jgarzik@pobox.com>
    Cc: Greg KH <greg@kroah.com>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit edfc43f2ec542c17c479d8ec7e4b0cee7b20f578
Author: Andrew Morton <akpm@osdl.org>
Date:   Mon Jun 20 14:30:35 2005 -0700

    [PATCH] wireless-device-attr-fixes
    
    Repair Jeff's stuff after gregkh depredations.
    
    Cc: Jeff Garzik <jgarzik@pobox.com>
    Cc: Greg KH <greg@kroah.com>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 011fe95a3b25ff124486fc27dc0395904ecf5852
Author: Andrew Morton <akpm@osdl.org>
Date:   Mon Jun 20 14:30:36 2005 -0700

    [PATCH] ipw2100 old gcc fix
    
    drivers/net/wireless/ipw2100.c: In function `ipw2100_set_key_index':
    drivers/net/wireless/ipw2100.c:5326: array index in non-array initializer
    drivers/net/wireless/ipw2100.c:5326: (near initialization for `cmd')
    drivers/net/wireless/ipw2100.c:5326: warning: missing braces around initializer
    drivers/net/wireless/ipw2100.c:5326: warning: (near initialization for `cmd.host_command_parameters')
    
    Cc: Jeff Garzik <jgarzik@pobox.com>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 8724a118031a4eb62174b3e12745e4d35d4b03fe
Author: Pavel Machek <pavel@ucw.cz>
Date:   Mon Jun 20 14:28:43 2005 -0700

    [PATCH] ipw2100: small cleanups
    
    Fix few typos/thinkos in ipw, remove ugly macro (it is commented around,
    anyway), and fix types passed to pci_set_power_state.
    
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 5dc54a65b6981d327a84c7651bbfeef0c0aff977
Author: Pavel Machek <pavel@ucw.cz>
Date:   Mon Jun 20 14:28:43 2005 -0700

    [PATCH] ipw2100: kill dead macros
    
    There are several never used macros in ipw2100.  This removes them.
    
    Signed-off-by: Pavel Machek <pavel@suse.cz>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 4663663f1d91aa0b84526841e47f401598bfa2f4
Author: Pavel Machek <pavel@ucw.cz>
Date:   Mon Jun 20 14:28:42 2005 -0700

    [PATCH] ipw2100: assume recent kernel
    
    ipw2100 still has support for old kernels.  Thats considered bad for patch in
    mainline...  this fixes few instances.
    
    Signed-off-by: Pavel Machek <pavel@suse.cz>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 0e08b44eedacb7824c88678d9a9ea7db25b5401c
Author: Tobias Klauser <tklauser@nuerscht.ch>
Date:   Mon Jun 20 14:28:41 2005 -0700

    [PATCH] drivers/net/wireless/ipw2200: Use the DMA_32BIT_MASK constant
    
    Use the DMA_32BIT_MASK constant from dma-mapping.h when calling
    pci_set_dma_mask() or pci_set_consistent_dma_mask() instead of custom macros.
    
    This patch includes dma-mapping.h explicitly because it caused errors on some
    architectures otherwise.  See
    http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details
    
    Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
    Cc: Jeff Garzik <jgarzik@pobox.com>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 05743d165be9f0293b4ff67f4e1cf3724eb13e1f
Author: Tobias Klauser <tklauser@nuerscht.ch>
Date:   Mon Jun 20 14:28:40 2005 -0700

    [PATCH] drivers/net/wireless/ipw2100: Use the DMA_32BIT_MASK constant
    
    Use the DMA_32BIT_MASK constant from dma-mapping.h when calling
    pci_set_dma_mask() or pci_set_consistent_dma_mask() instead of custom macros.
    
    This patch includes dma-mapping.h explicitly because it caused errors on some
    architectures otherwise.  See
    http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details
    
    Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
    Cc: Jeff Garzik <jgarzik@pobox.com>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit 070d01651296d3c87bca94f3b1313447e9e06c2f
Author: Pavel Machek <pavel@ucw.cz>
Date:   Mon Jun 20 13:33:07 2005 +0200

    [PATCH] ipw2100: remove commented-out code
    
    This removes up various code/defines that was just commented out
    instead of being deleted.

commit aaa4d308a8cbc4ccfd870ee556def2e481557274
Author: Jiri Benc <jbenc@suse.cz>
Date:   Tue Jun 7 14:58:41 2005 +0200

    [PATCH] ieee80211: fix ipw 64bit compilation warnings
    
    On Mon, 06 Jun 2005 14:29:52 +0800, Zhu Yi wrote:
    > ("%zd", sizeof()) should be better.
    
    Thanks. This is a corrected version of the patch.
    
    This patch fixes warnings when compiling ipw2100 and ipw2200 on x86_64.
    
    Signed-off-by: Jiri Benc <jbenc@suse.cz>
    Signed-off-by: Jirka Bohac <jbohac@suse.cz>

commit e19b813e0c9c5995423dc95b01379c89f188ae70
Author: Adrian Bunk <bunk@stusta.de>
Date:   Fri Jun 3 18:29:20 2005 +0200

    [PATCH] ieee80211: fix recursive ipw2200 dependencies
    
    This results in recursive dependencies:
    - IPW2200 depends on NET_RADIO
    - IPW2200 selects IEEE80211
    - IEEE80211 selects NET_RADIO
    
    This patch fixes the IPW2200 dependencies in a way that they are similar
    to the IPW2100 dependencies.
    
    Signed-off-by: Adrian Bunk <bunk@stusta.de>
    Signed-off-by: Jiri Benc <jbenc@suse.cz>

commit 7c9d4c70b20e165eb11d8aed2b6374377d17f43a
Author: Adrian Bunk <bunk@stusta.de>
Date:   Fri Jun 3 18:28:19 2005 +0200

    [PATCH] ieee80211: remove pci.h #include's
    
    I was wondering why editing pci.h triggered the rebuild of three files
    under net/, and as far as I can see, there's no reason for these three
    files to #include pci.h .
    
    Signed-off-by: Adrian Bunk <bunk@stusta.de>
    Signed-off-by: Jiri Benc <jbenc@suse.cz>

commit aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f
Merge: f45727d52d1581e9ff4df9d1a12a60789ad2d1eb 245ac8738b0b840552d56b842e70e750d65911cc
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Mon Jun 27 22:50:10 2005 -0400

    Merge /spare/repo/netdev-2.6 branch 'ieee80211'

commit 245ac8738b0b840552d56b842e70e750d65911cc
Merge: 716b43303df605510399d6da0d0dd4e2ea376e7c a5fe736eaf9bae1b45317313de04b564441b94f2
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Mon Jun 27 22:49:47 2005 -0400

    Merge upstream net/ieee80211.h changes into 'ieee80211' branch.

commit 716b43303df605510399d6da0d0dd4e2ea376e7c
Merge: 5696c1944a33b4434a9a1ebb6383b906afd43a10 c7b645f934e52a54af58142d91fb51f881f8ce26
Author: Jeff Garzik <jgarzik@pretzel.yyz.us>
Date:   Mon Jun 27 22:03:52 2005 -0400

    Merge upstream ieee80211.h with us (us == branch 'ieee80211' of netdev-2.6)

commit f45727d52d1581e9ff4df9d1a12a60789ad2d1eb
Merge: 4c925f452cfd16c690209e96821ee094e09a2404 5696c1944a33b4434a9a1ebb6383b906afd43a10
Author: Jeff Garzik <jgarzik@pretzel.yyz.us>
Date:   Sun Jun 26 23:42:30 2005 -0400

    Merge /spare/repo/netdev-2.6/ branch 'ieee80211'

commit 5696c1944a33b4434a9a1ebb6383b906afd43a10
Merge: 66b04a80eea60cabf9d89fd34deb3234a740052f 020f46a39eb7b99a575b9f4d105fce2b142acdf1
Author: Jeff Garzik <jgarzik@pretzel.yyz.us>
Date:   Sun Jun 26 23:38:58 2005 -0400

    Merge /spare/repo/linux-2.6/

commit 4c925f452cfd16c690209e96821ee094e09a2404
Merge: 51a730d758ae4052e10ca7e06336f10af598c4fc 66b04a80eea60cabf9d89fd34deb3234a740052f
Author:  <jgarzik@pretzel.yyz.us>
Date:   Fri May 27 22:57:33 2005 -0400

    Automatic merge of /spare/repo/netdev-2.6 branch we18-ieee80211

commit 66b04a80eea60cabf9d89fd34deb3234a740052f
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Fri May 27 22:53:55 2005 -0400

    [wireless] ipw2100: fix build after applying SuSE cleanups
    
    s/ieee80211_header_data/ieee80211_hdr_3addr/

commit 286d974797705ae7ceedc846666ef98bdeee3646
Author: Jiri Benc <jbenc@suse.cz>
Date:   Tue May 24 15:10:18 2005 +0200

    [PATCH] ieee80211: cleanup
    
    Cleanup of unused and duplicated constants and structures in the ieee80211
    header.
    
    Signed-off-by: Jiri Benc <jbenc@suse.cz>
    Signed-off-by: Jirka Bohac <jbohac@suse.cz>

commit 76fe1b0e4c093f985c66a062c9c10370b4985796
Author: Adrian Bunk <bunk@stusta.de>
Date:   Sat May 7 00:54:49 2005 +0200

    [PATCH] fix IEEE80211_CRYPT_* selects
    
    Some of the options didn't obey the most important rule of select
    
      If you select something, you have to ensure that the dependencies
      of what you do select are fulfilled.
    
    resulting in the following compile error:
    
    <--  snip  -->
    
    ...
      LD      .tmp_vmlinux1
    crypto/built-in.o(.init.text+0x31b): In function `aes_init':
    : undefined reference to `crypto_register_alg'
    crypto/built-in.o(.init.text+0x326): In function `michael_mic_init':
    : undefined reference to `crypto_register_alg'
    crypto/built-in.o(.exit.text+0x6): In function `aes_fini':
    : undefined reference to `crypto_unregister_alg'
    crypto/built-in.o(.exit.text+0x16): In function `michael_mic_exit':
    : undefined reference to `crypto_unregister_alg'
    net/built-in.o(.text+0x5ba52): In function `ieee80211_ccmp_init':
    : undefined reference to `crypto_alloc_tfm'
    net/built-in.o(.text+0x5ba94): In function `ieee80211_ccmp_init':
    : undefined reference to `crypto_free_tfm'
    net/built-in.o(.text+0x5bab7): In function `ieee80211_ccmp_deinit':
    : undefined reference to `crypto_free_tfm'
    net/built-in.o(.text+0x5c5c2): In function `ieee80211_tkip_init':
    : undefined reference to `crypto_alloc_tfm'
    net/built-in.o(.text+0x5c5d5): In function `ieee80211_tkip_init':
    : undefined reference to `crypto_alloc_tfm'
    net/built-in.o(.text+0x5c623): In function `ieee80211_tkip_init':
    : undefined reference to `crypto_free_tfm'
    net/built-in.o(.text+0x5c62a): In function `ieee80211_tkip_init':
    : undefined reference to `crypto_free_tfm'
    net/built-in.o(.text+0x5c65e): In function `ieee80211_tkip_deinit':
    : undefined reference to `crypto_free_tfm'
    net/built-in.o(.text+0x5c665): In function `ieee80211_tkip_deinit':
    : undefined reference to `crypto_free_tfm'
    make: *** [.tmp_vmlinux1] Error 1
    
    <--  snip  -->
    
    This patch adds the missing selects of CRYPTO (similar to how
    IEEE80211_CRYPT_WEP already does it).
    
    Yes, you could argue whether CRYPTO should be select'ed by the CRYPTO_*
    options, but with the current CRYPTO* dependencies this patch is
    required.

commit e157249d948bf0c5da10ce8610e2b4b36d0a3c4c
Author: Adrian Bunk <bunk@stusta.de>
Date:   Fri May 6 23:32:39 2005 +0200

    [PATCH] net/ieee80211/: make two functions static
    
    This patch makes two needlessly global functions static.
    
    Signed-off-by: Adrian Bunk <bunk@stusta.de>

commit 3dcefbc9d6bd8b5ff0fc4bdbe3df938be5460f79
Author: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Date:   Tue Apr 26 18:43:05 2005 +0100

    [PATCH] zd1201 fixes
    
    	In netdev-2.6 we need to update zd1201.c since we don't have
    driver/net/wireless/ieee802_11.h anymore.
    
    Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>

commit 695b5bc3ecfc7da0a29360a6c2ee0849ffdb300a
Author: Al Viro <viro@www.linux.org.uk>
Date:   Sun Apr 3 09:15:52 2005 +0100

    [PATCH] ieee80211_module.c::store_debug_level() cleanup
    
    	* trivial __user annotations
    	* store_debug_level() sanitized a bit
    Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>

commit 51a730d758ae4052e10ca7e06336f10af598c4fc
Merge: 6cd15a9daf826115356f9403494c76e5aafa7793 ff0e0ea2f5d36fa90fc2c57fd019102b0a0cfabf
Author:  <jgarzik@pretzel.yyz.us>
Date:   Fri May 27 22:08:07 2005 -0400

    Automatic merge of /spare/repo/netdev-2.6 branch we18-ieee80211

commit ff0e0ea2f5d36fa90fc2c57fd019102b0a0cfabf
Merge: 43f66a6ce8da299344cf1bc2ac2311889cc88555 1f15d694522af9cd7492695f11dd2dc77b6cf098
Author:  <jgarzik@pretzel.yyz.us>
Date:   Fri May 27 22:07:40 2005 -0400

    Automatic merge of /spare/repo/netdev-2.6 branch we18

commit 6cd15a9daf826115356f9403494c76e5aafa7793
Merge: ff1d2767d5a43c85f944e86a45284b721f66196c 43f66a6ce8da299344cf1bc2ac2311889cc88555
Author:  <jgarzik@pretzel.yyz.us>
Date:   Fri May 27 22:02:58 2005 -0400

    Automatic merge of /spare/repo/netdev-2.6 branch we18-ieee80211

commit 43f66a6ce8da299344cf1bc2ac2311889cc88555
Author: James Ketrenos <jketreno@linux.intel.com>
Date:   Fri Mar 25 12:31:53 2005 -0600

    Add ipw2200 wireless driver.

commit 2c86c275015c880e810830304a3a4ab94803b38b
Author: James Ketrenos <jketreno@linux.intel.com>
Date:   Wed Mar 23 17:32:29 2005 -0600

    Add ipw2100 wireless driver.

commit 0a989b24fd59e8867274246587b46f5595fa0baa
Author: Adrian Bunk <bunk@stusta.de>
Date:   Mon Apr 11 16:52:15 2005 -0700

    [PATCH] net/ieee80211/ieee80211_tx.c: swapped memset arguments
    
    Fix swapped memset() arguments in net/ieee80211/ieee80211_tx.c found by
    Maciej Soltysiak.
    
    Patch by Jesper Juhl.
    
    Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
    Signed-off-by: Adrian Bunk <bunk@stusta.de>
    Signed-off-by: Andrew Morton <akpm@osdl.org>

commit ff1d2767d5a43c85f944e86a45284b721f66196c
Author: Jouni Malinen <jkmaline@cc.hut.fi>
Date:   Thu May 12 22:54:16 2005 -0400

    Add HostAP wireless driver.
    
    Includes minor cleanups from Adrian Bunk <bunk@stusta.de>.

commit b453872c35cfcbdbf5a794737817f7d4e7b1b579
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Thu May 12 22:48:20 2005 -0400

    [NET] ieee80211 subsystem
    
    Contributors:
    Host AP contributors
    James Ketrenos <jketreno@linux.intel.com>
    Francois Romieu <romieu@fr.zoreil.com>
    Adrian Bunk <bunk@stusta.de>
    Matthew Galgoci <mgalgoci@parcelfarce.linux.th
    eplanet.co.uk>



[-- Attachment #3: patch --]
[-- Type: text/plain, Size: 38209 bytes --]

diff --git a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -991,6 +991,13 @@ M:	mike.miller@hp.com
 L:	iss_storagedev@hp.com
 S:	Supported
  
+HOST AP DRIVER
+P:	Jouni Malinen
+M:	jkmaline@cc.hut.fi
+L:	hostap@shmoo.com
+W:	http://hostap.epitest.fi/
+S:	Maintained
+
 HP100:	Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series
 P:	Jaroslav Kysela
 M:	perex@suse.cz
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -137,6 +137,110 @@ config PCMCIA_RAYCS
 comment "Wireless 802.11b ISA/PCI cards support"
 	depends on NET_RADIO && (ISA || PCI || PPC_PMAC || PCMCIA)
 
+config IPW2100
+	tristate "Intel PRO/Wireless 2100 Network Connection"
+	depends on NET_RADIO && PCI && IEEE80211
+	select FW_LOADER
+	---help---
+          A driver for the Intel PRO/Wireless 2100 Network 
+	  Connection 802.11b wireless network adapter.
+
+          See <file:Documentation/networking/README.ipw2100> for information on
+          the capabilities currently enabled in this driver and for tips
+          for debugging issues and problems.
+
+	  In order to use this driver, you will need a firmware image for it.
+          You can obtain the firmware from
+	  <http://ipw2100.sf.net/>.  Once you have the firmware image, you 
+	  will need to place it in /etc/firmware.
+
+          You will also very likely need the Wireless Tools in order to
+          configure your card:
+
+          <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
+ 
+          If you want to compile the driver as a module ( = code which can be
+          inserted in and remvoed from the running kernel whenever you want),
+          say M here and read <file:Documentation/modules.txt>.  The module
+          will be called ipw2100.ko.
+	
+config IPW2100_PROMISC
+        bool "Enable promiscuous mode"
+        depends on IPW2100
+        ---help---
+	  Enables promiscuous/monitor mode support for the ipw2100 driver.
+	  With this feature compiled into the driver, you can switch to 
+	  promiscuous mode via the Wireless Tool's Monitor mode.  While in this
+	  mode, no packets can be sent.
+
+config IPW_DEBUG
+	bool "Enable full debugging output in IPW2100 module."
+	depends on IPW2100
+	---help---
+	  This option will enable debug tracing output for the IPW2100.  
+
+	  This will result in the kernel module being ~60k larger.  You can 
+	  control which debug output is sent to the kernel log by setting the 
+	  value in 
+
+	  /sys/bus/pci/drivers/ipw2100/debug_level
+
+	  This entry will only exist if this option is enabled.
+
+	  If you are not trying to debug or develop the IPW2100 driver, you 
+	  most likely want to say N here.
+
+config IPW2200
+	tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
+	depends on IEEE80211 && PCI
+	select FW_LOADER
+	---help---
+          A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network
+	  Connection adapters. 
+
+          See <file:Documentation/networking/README.ipw2200> for 
+	  information on the capabilities currently enabled in this 
+	  driver and for tips for debugging issues and problems.
+
+	  In order to use this driver, you will need a firmware image for it.
+          You can obtain the firmware from
+	  <http://ipw2200.sf.net/>.  See the above referenced README.ipw2200 
+	  for information on where to install the firmare images.
+
+          You will also very likely need the Wireless Tools in order to
+          configure your card:
+
+          <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
+ 
+          If you want to compile the driver as a module ( = code which can be
+          inserted in and remvoed from the running kernel whenever you want),
+          say M here and read <file:Documentation/modules.txt>.  The module
+          will be called ipw2200.ko.
+
+config IPW_DEBUG
+	bool "Enable full debugging output in IPW2200 module."
+	depends on IPW2200
+	---help---
+	  This option will enable debug tracing output for the IPW2200.  
+
+	  This will result in the kernel module being ~100k larger.  You can 
+	  control which debug output is sent to the kernel log by setting the 
+	  value in 
+
+	  /sys/bus/pci/drivers/ipw2200/debug_level
+
+	  This entry will only exist if this option is enabled.
+
+	  To set a value, simply echo an 8-byte hex value to the same file:
+
+	  % echo 0x00000FFO > /sys/bus/pci/drivers/ipw2200/debug_level
+
+	  You can find the list of debug mask values in 
+	  drivers/net/wireless/ipw2200.h
+
+	  If you are not trying to debug or develop the IPW2200 driver, you 
+	  most likely want to say N here.
+
 config AIRO
 	tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
 	depends on NET_RADIO && ISA && (PCI || BROKEN)
@@ -355,6 +459,8 @@ config PRISM54
 	  say M here and read <file:Documentation/modules.txt>.  The module
 	  will be called prism54.ko.
 
+source "drivers/net/wireless/hostap/Kconfig"
+
 # yes, this works even when no drivers are selected
 config NET_WIRELESS
 	bool
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -2,6 +2,10 @@
 # Makefile for the Linux Wireless network device drivers.
 #
 
+obj-$(CONFIG_IPW2100) += ipw2100.o
+
+obj-$(CONFIG_IPW2200) += ipw2200.o
+
 obj-$(CONFIG_STRIP) += strip.o
 obj-$(CONFIG_ARLAN) += arlan.o 
 
@@ -28,6 +32,8 @@ obj-$(CONFIG_PCMCIA_ATMEL)      += atmel
 
 obj-$(CONFIG_PRISM54)		+= prism54/
 
+obj-$(CONFIG_HOSTAP)		+= hostap/
+
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
 obj-$(CONFIG_PCMCIA_WL3501)	+= wl3501_cs.o
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -1040,7 +1040,7 @@ typedef struct {
 	u16 status;
 } WifiCtlHdr;
 
-WifiCtlHdr wifictlhdr8023 = {
+static WifiCtlHdr wifictlhdr8023 = {
 	.ctlhdr = {
 		.ctl	= HOST_DONT_RLSE,
 	}
@@ -1111,13 +1111,13 @@ static int airo_thread(void *data);
 static void timer_func( struct net_device *dev );
 static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 #ifdef WIRELESS_EXT
-struct iw_statistics *airo_get_wireless_stats (struct net_device *dev);
+static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev);
 static void airo_read_wireless_stats (struct airo_info *local);
 #endif /* WIRELESS_EXT */
 #ifdef CISCO_EXT
 static int readrids(struct net_device *dev, aironet_ioctl *comp);
 static int writerids(struct net_device *dev, aironet_ioctl *comp);
-int flashcard(struct net_device *dev, aironet_ioctl *comp);
+static int flashcard(struct net_device *dev, aironet_ioctl *comp);
 #endif /* CISCO_EXT */
 #ifdef MICSUPPORT
 static void micinit(struct airo_info *ai);
@@ -1226,6 +1226,12 @@ static int setup_proc_entry( struct net_
 static int takedown_proc_entry( struct net_device *dev,
 				struct airo_info *apriv );
 
+static int cmdreset(struct airo_info *ai);
+static int setflashmode (struct airo_info *ai);
+static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
+static int flashputbuf(struct airo_info *ai);
+static int flashrestart(struct airo_info *ai,struct net_device *dev);
+
 #ifdef MICSUPPORT
 /***********************************************************************
  *                              MIC ROUTINES                           *
@@ -1234,10 +1240,11 @@ static int takedown_proc_entry( struct n
 
 static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq);
 static void MoveWindow(miccntx *context, u32 micSeq);
-void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *);
-void emmh32_init(emmh32_context *context);
-void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
-void emmh32_final(emmh32_context *context, u8 digest[4]);
+static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *);
+static void emmh32_init(emmh32_context *context);
+static void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
+static void emmh32_final(emmh32_context *context, u8 digest[4]);
+static int flashpchar(struct airo_info *ai,int byte,int dwelltime);
 
 /* micinit - Initialize mic seed */
 
@@ -1315,7 +1322,7 @@ static int micsetup(struct airo_info *ai
 	return SUCCESS;
 }
 
-char micsnap[]= {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02};
+static char micsnap[] = {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02};
 
 /*===========================================================================
  * Description: Mic a packet
@@ -1570,7 +1577,7 @@ static void MoveWindow(miccntx *context,
 static unsigned char aes_counter[16];
 
 /* expand the key to fill the MMH coefficient array */
-void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm)
+static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm)
 {
   /* take the keying material, expand if necessary, truncate at 16-bytes */
   /* run through AES counter mode to generate context->coeff[] */
@@ -1602,7 +1609,7 @@ void emmh32_setseed(emmh32_context *cont
 }
 
 /* prepare for calculation of a new mic */
-void emmh32_init(emmh32_context *context)
+static void emmh32_init(emmh32_context *context)
 {
 	/* prepare for new mic calculation */
 	context->accum = 0;
@@ -1610,7 +1617,7 @@ void emmh32_init(emmh32_context *context
 }
 
 /* add some bytes to the mic calculation */
-void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
+static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
 {
 	int	coeff_position, byte_position;
   
@@ -1652,7 +1659,7 @@ void emmh32_update(emmh32_context *conte
 static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L };
 
 /* calculate the mic */
-void emmh32_final(emmh32_context *context, u8 digest[4])
+static void emmh32_final(emmh32_context *context, u8 digest[4])
 {
 	int	coeff_position, byte_position;
 	u32	val;
@@ -2255,7 +2262,7 @@ static void airo_read_stats(struct airo_
 	ai->stats.rx_fifo_errors = vals[0];
 }
 
-struct net_device_stats *airo_get_stats(struct net_device *dev)
+static struct net_device_stats *airo_get_stats(struct net_device *dev)
 {
 	struct airo_info *local =  dev->priv;
 
@@ -2414,7 +2421,7 @@ EXPORT_SYMBOL(stop_airo_card);
 
 static int add_airo_dev( struct net_device *dev );
 
-int wll_header_parse(struct sk_buff *skb, unsigned char *haddr)
+static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr)
 {
 	memcpy(haddr, skb->mac.raw + 10, ETH_ALEN);
 	return ETH_ALEN;
@@ -2681,7 +2688,7 @@ static struct net_device *init_wifidev(s
 	return dev;
 }
 
-int reset_card( struct net_device *dev , int lock) {
+static int reset_card( struct net_device *dev , int lock) {
 	struct airo_info *ai = dev->priv;
 
 	if (lock && down_interruptible(&ai->sem))
@@ -2696,9 +2703,9 @@ int reset_card( struct net_device *dev ,
 	return 0;
 }
 
-struct net_device *_init_airo_card( unsigned short irq, int port,
-				    int is_pcmcia, struct pci_dev *pci,
-				    struct device *dmdev )
+static struct net_device *_init_airo_card( unsigned short irq, int port,
+					   int is_pcmcia, struct pci_dev *pci,
+					   struct device *dmdev )
 {
 	struct net_device *dev;
 	struct airo_info *ai;
@@ -7235,7 +7242,7 @@ static void airo_read_wireless_stats(str
 	local->wstats.miss.beacon = vals[34];
 }
 
-struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
+static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
 {
 	struct airo_info *local =  dev->priv;
 
@@ -7450,14 +7457,8 @@ static int writerids(struct net_device *
  * Flash command switch table
  */
 
-int flashcard(struct net_device *dev, aironet_ioctl *comp) {
+static int flashcard(struct net_device *dev, aironet_ioctl *comp) {
 	int z;
-	int cmdreset(struct airo_info *);
-	int setflashmode(struct airo_info *);
-	int flashgchar(struct airo_info *,int,int);
-	int flashpchar(struct airo_info *,int,int);
-	int flashputbuf(struct airo_info *);
-	int flashrestart(struct airo_info *,struct net_device *);
 
 	/* Only super-user can modify flash */
 	if (!capable(CAP_NET_ADMIN))
@@ -7515,7 +7516,7 @@ int flashcard(struct net_device *dev, ai
  * card.
  */
 
-int cmdreset(struct airo_info *ai) {
+static int cmdreset(struct airo_info *ai) {
 	disable_MAC(ai, 1);
 
 	if(!waitbusy (ai)){
@@ -7539,7 +7540,7 @@ int cmdreset(struct airo_info *ai) {
  * mode
  */
 
-int setflashmode (struct airo_info *ai) {
+static int setflashmode (struct airo_info *ai) {
 	set_bit (FLAG_FLASHING, &ai->flags);
 
 	OUT4500(ai, SWS0, FLASH_COMMAND);
@@ -7566,7 +7567,7 @@ int setflashmode (struct airo_info *ai) 
  * x 50us for  echo .
  */
 
-int flashpchar(struct airo_info *ai,int byte,int dwelltime) {
+static int flashpchar(struct airo_info *ai,int byte,int dwelltime) {
 	int echo;
 	int waittime;
 
@@ -7606,7 +7607,7 @@ int flashpchar(struct airo_info *ai,int 
  * Get a character from the card matching matchbyte
  * Step 3)
  */
-int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){
+static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){
 	int           rchar;
 	unsigned char rbyte=0;
 
@@ -7637,7 +7638,7 @@ int flashgchar(struct airo_info *ai,int 
  * send to the card
  */
 
-int flashputbuf(struct airo_info *ai){
+static int flashputbuf(struct airo_info *ai){
 	int            nwords;
 
 	/* Write stuff */
@@ -7659,7 +7660,7 @@ int flashputbuf(struct airo_info *ai){
 /*
  *
  */
-int flashrestart(struct airo_info *ai,struct net_device *dev){
+static int flashrestart(struct airo_info *ai,struct net_device *dev){
 	int    i,status;
 
 	ssleep(1);			/* Added 12/7/00 */
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -68,7 +68,7 @@
 #include <linux/device.h>
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
-#include "ieee802_11.h"
+#include <net/ieee80211.h>
 #include "atmel.h"
 
 #define DRIVER_MAJOR 0
@@ -618,12 +618,12 @@ static int atmel_lock_mac(struct atmel_p
 static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data);
 static void atmel_command_irq(struct atmel_private *priv);
 static int atmel_validate_channel(struct atmel_private *priv, int channel);
-static void atmel_management_frame(struct atmel_private *priv, struct ieee802_11_hdr *header, 
+static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, 
 				   u16 frame_len, u8 rssi);
 static void atmel_management_timer(u_long a);
 static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size);
 static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size);
-static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee802_11_hdr *header,
+static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header,
 					    u8 *body, int body_len);
 
 static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index);
@@ -827,7 +827,7 @@ static void tx_update_descriptor(struct 
 static int start_tx (struct sk_buff *skb, struct net_device *dev)
 {
 	struct atmel_private *priv = netdev_priv(dev);
-	struct ieee802_11_hdr header;
+	struct ieee80211_hdr header;
 	unsigned long flags;
 	u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN;
 	u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
@@ -863,17 +863,17 @@ static int start_tx (struct sk_buff *skb
 		return 1;
 	}
 	
-	frame_ctl = IEEE802_11_FTYPE_DATA;
+	frame_ctl = IEEE80211_FTYPE_DATA;
 	header.duration_id = 0;
 	header.seq_ctl = 0;
 	if (priv->wep_is_on)
-		frame_ctl |= IEEE802_11_FCTL_WEP;
+		frame_ctl |= IEEE80211_FCTL_WEP;
 	if (priv->operating_mode == IW_MODE_ADHOC) {
 		memcpy(&header.addr1, skb->data, 6);
 		memcpy(&header.addr2, dev->dev_addr, 6);
 		memcpy(&header.addr3, priv->BSSID, 6);
 	} else {
-		frame_ctl |= IEEE802_11_FCTL_TODS;
+		frame_ctl |= IEEE80211_FCTL_TODS;
 		memcpy(&header.addr1, priv->CurrentBSSID, 6);
 		memcpy(&header.addr2, dev->dev_addr, 6);
 		memcpy(&header.addr3, skb->data, 6);
@@ -902,7 +902,7 @@ static int start_tx (struct sk_buff *skb
 }
 
 static void atmel_transmit_management_frame(struct atmel_private *priv, 
-					    struct ieee802_11_hdr *header,
+					    struct ieee80211_hdr *header,
 					    u8 *body, int body_len)
 {
 	u16 buff;
@@ -917,7 +917,7 @@ static void atmel_transmit_management_fr
 	tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT);
 }
 	
-static void fast_rx_path(struct atmel_private *priv, struct ieee802_11_hdr *header, 
+static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, 
 			 u16 msdu_size, u16 rx_packet_loc, u32 crc)
 {
 	/* fast path: unfragmented packet copy directly into skbuf */
@@ -955,7 +955,7 @@ static void fast_rx_path(struct atmel_pr
 	}
 	
 	memcpy(skbp, header->addr1, 6); /* destination address */
-	if (le16_to_cpu(header->frame_ctl) & IEEE802_11_FCTL_FROMDS) 
+	if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS) 
 		memcpy(&skbp[6], header->addr3, 6);
 	else
 		memcpy(&skbp[6], header->addr2, 6); /* source address */
@@ -990,14 +990,14 @@ static int probe_crc(struct atmel_privat
 	return (crc ^ 0xffffffff) == netcrc;
 }
 
-static void frag_rx_path(struct atmel_private *priv, struct ieee802_11_hdr *header, 
+static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, 
 			 u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags)
 {
 	u8 mac4[6]; 
 	u8 source[6];
 	struct sk_buff *skb;
 
-	if (le16_to_cpu(header->frame_ctl) & IEEE802_11_FCTL_FROMDS) 
+	if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS) 
 		memcpy(source, header->addr3, 6);
 	else
 		memcpy(source, header->addr2, 6); 
@@ -1082,7 +1082,7 @@ static void frag_rx_path(struct atmel_pr
 static void rx_done_irq(struct atmel_private *priv)
 {
 	int i;
-	struct ieee802_11_hdr header;
+	struct ieee80211_hdr header;
 	
 	for (i = 0; 
 	     atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID &&
@@ -1117,7 +1117,7 @@ static void rx_done_irq(struct atmel_pri
 		/* probe for CRC use here if needed  once five packets have arrived with
 		   the same crc status, we assume we know what's happening and stop probing */
 		if (priv->probe_crc) {
-			if (!priv->wep_is_on || !(frame_ctl & IEEE802_11_FCTL_WEP)) {
+			if (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_WEP)) {
 				priv->do_rx_crc = probe_crc(priv, rx_packet_loc, msdu_size);
 			} else {
 				priv->do_rx_crc = probe_crc(priv, rx_packet_loc + 24, msdu_size - 24);
@@ -1132,16 +1132,16 @@ static void rx_done_irq(struct atmel_pri
 		}
 		    
 		/* don't CRC header when WEP in use */
-		if (priv->do_rx_crc && (!priv->wep_is_on || !(frame_ctl & IEEE802_11_FCTL_WEP))) {
+		if (priv->do_rx_crc && (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_WEP))) {
 			crc = crc32_le(0xffffffff, (unsigned char *)&header, 24);
 		}
 		msdu_size -= 24; /* header */
 
-		if ((frame_ctl & IEEE802_11_FCTL_FTYPE) == IEEE802_11_FTYPE_DATA) { 
+		if ((frame_ctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) { 
 			
-			int more_fragments = frame_ctl & IEEE802_11_FCTL_MOREFRAGS;
-			u8 packet_fragment_no = seq_control & IEEE802_11_SCTL_FRAG;
-			u16 packet_sequence_no = (seq_control & IEEE802_11_SCTL_SEQ) >> 4;
+			int more_fragments = frame_ctl & IEEE80211_FCTL_MOREFRAGS;
+			u8 packet_fragment_no = seq_control & IEEE80211_SCTL_FRAG;
+			u16 packet_sequence_no = (seq_control & IEEE80211_SCTL_SEQ) >> 4;
 			
 			if (!more_fragments && packet_fragment_no == 0 ) {
 				fast_rx_path(priv, &header, msdu_size, rx_packet_loc, crc);
@@ -1151,7 +1151,7 @@ static void rx_done_irq(struct atmel_pri
 			}
 		}
 		
-		if ((frame_ctl & IEEE802_11_FCTL_FTYPE) == IEEE802_11_FTYPE_MGMT) {
+		if ((frame_ctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
 			/* copy rest of packet into buffer */
 			atmel_copy_to_host(priv->dev, (unsigned char *)&priv->rx_buf, rx_packet_loc + 24, msdu_size);
 			
@@ -2663,10 +2663,10 @@ static void handle_beacon_probe(struct a
  
 static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len)
 {
-	struct ieee802_11_hdr header;
+	struct ieee80211_hdr header;
 	struct auth_body auth;
 	
-	header.frame_ctl = cpu_to_le16(IEEE802_11_FTYPE_MGMT | IEEE802_11_STYPE_AUTH); 
+	header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); 
 	header.duration_id	= cpu_to_le16(0x8000);	
 	header.seq_ctl = 0;
 	memcpy(header.addr1, priv->CurrentBSSID, 6);
@@ -2677,7 +2677,7 @@ static void send_authentication_request(
 		auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY); 
 		/* no WEP for authentication frames with TrSeqNo 1 */
 		if (priv->CurrentAuthentTransactionSeqNum != 1)
-			header.frame_ctl |=  cpu_to_le16(IEEE802_11_FCTL_WEP); 
+			header.frame_ctl |=  cpu_to_le16(IEEE80211_FCTL_WEP); 
 	} else {
 		auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM);
 	}
@@ -2701,7 +2701,7 @@ static void send_association_request(str
 {
 	u8 *ssid_el_p;
 	int bodysize;
-	struct ieee802_11_hdr header;
+	struct ieee80211_hdr header;
 	struct ass_req_format {
 		u16 capability;
 		u16 listen_interval; 
@@ -2714,8 +2714,8 @@ static void send_association_request(str
 		u8 rates[4];
 	} body;
 		
-	header.frame_ctl = cpu_to_le16(IEEE802_11_FTYPE_MGMT | 
-		(is_reassoc ? IEEE802_11_STYPE_REASSOC_REQ : IEEE802_11_STYPE_ASSOC_REQ));
+	header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | 
+		(is_reassoc ? IEEE80211_STYPE_REASSOC_REQ : IEEE80211_STYPE_ASSOC_REQ));
 	header.duration_id = cpu_to_le16(0x8000);
 	header.seq_ctl = 0;
 
@@ -2751,9 +2751,9 @@ static void send_association_request(str
 	atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize);
 }
 
-static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee802_11_hdr *header)
+static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr *header)
 {
-	if (le16_to_cpu(header->frame_ctl) & IEEE802_11_FCTL_FROMDS)
+	if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS)
 		return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0;
 	else
 		return memcmp(header->addr2, priv->CurrentBSSID, 6) == 0;
@@ -2801,7 +2801,7 @@ static int retrieve_bss(struct atmel_pri
 }
 
 
-static void store_bss_info(struct atmel_private *priv, struct ieee802_11_hdr *header,
+static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr *header,
 			   u16 capability, u16 beacon_period, u8 channel, u8 rssi, 
 			   u8 ssid_len, u8 *ssid, int is_beacon)
 {
@@ -3085,12 +3085,12 @@ static void atmel_smooth_qual(struct atm
 }
 
 /* deals with incoming managment frames. */
-static void atmel_management_frame(struct atmel_private *priv, struct ieee802_11_hdr *header, 
+static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, 
 		      u16 frame_len, u8 rssi)
 {
 	u16 subtype;
 	
-	switch (subtype = le16_to_cpu(header->frame_ctl) & IEEE802_11_FCTL_STYPE) {
+	switch (subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE) {
 	case C80211_SUBTYPE_MGMT_BEACON :
 	case C80211_SUBTYPE_MGMT_ProbeResponse:
 		
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -94,6 +94,8 @@
 #include <net/iw_handler.h>
 #include <net/ieee80211.h>
 
+#include <net/ieee80211.h>
+
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/system.h>
@@ -101,7 +103,6 @@
 #include "hermes.h"
 #include "hermes_rid.h"
 #include "orinoco.h"
-#include "ieee802_11.h"
 
 /********************************************************************/
 /* Module information                                               */
@@ -150,7 +151,7 @@ static const u8 encaps_hdr[] = {0xaa, 0x
 #define ENCAPS_OVERHEAD		(sizeof(encaps_hdr) + 2)
 
 #define ORINOCO_MIN_MTU		256
-#define ORINOCO_MAX_MTU		(IEEE802_11_DATA_LEN - ENCAPS_OVERHEAD)
+#define ORINOCO_MAX_MTU		(IEEE80211_DATA_LEN - ENCAPS_OVERHEAD)
 
 #define SYMBOL_MAX_VER_LEN	(14)
 #define USER_BAP		0
@@ -442,7 +443,7 @@ static int orinoco_change_mtu(struct net
 	if ( (new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU) )
 		return -EINVAL;
 
-	if ( (new_mtu + ENCAPS_OVERHEAD + IEEE802_11_HLEN) >
+	if ( (new_mtu + ENCAPS_OVERHEAD + IEEE80211_HLEN) >
 	     (priv->nicbuf_size - ETH_HLEN) )
 		return -EINVAL;
 
@@ -918,7 +919,7 @@ static void __orinoco_ev_rx(struct net_d
                    data. */
 		return;
 	}
-	if (length > IEEE802_11_DATA_LEN) {
+	if (length > IEEE80211_DATA_LEN) {
 		printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n",
 		       dev->name, length);
 		stats->rx_length_errors++;
@@ -2272,7 +2273,7 @@ static int orinoco_init(struct net_devic
 
 	/* No need to lock, the hw_unavailable flag is already set in
 	 * alloc_orinocodev() */
-	priv->nicbuf_size = IEEE802_11_FRAME_LEN + ETH_HLEN;
+	priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN;
 
 	/* Initialize the firmware */
 	err = orinoco_reinit_firmware(dev);
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -209,7 +209,7 @@ enum {
 	NoStructure = 0,	/* Really old firmware */
 	StructuredMessages = 1,	/* Parsable AT response msgs */
 	ChecksummedMessages = 2	/* Parsable AT response msgs with checksums */
-} FirmwareLevel;
+};
 
 struct strip {
 	int magic;
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -59,6 +59,12 @@
 /* Do *NOT* add other headers here, you are guaranteed to be wrong - Jean II */
 #include "wavelan_cs.p.h"		/* Private header */
 
+#ifdef WAVELAN_ROAMING
+static void wl_cell_expiry(unsigned long data);
+static void wl_del_wavepoint(wavepoint_history *wavepoint, struct net_local *lp);
+static void wv_nwid_filter(unsigned char mode, net_local *lp);
+#endif  /*  WAVELAN_ROAMING  */
+
 /************************* MISC SUBROUTINES **************************/
 /*
  * Subroutines which won't fit in one of the following category
@@ -500,9 +506,9 @@ fee_write(u_long	base,	/* i/o port of th
 
 #ifdef WAVELAN_ROAMING	/* Conditional compile, see wavelan_cs.h */
 
-unsigned char WAVELAN_BEACON_ADDRESS[]= {0x09,0x00,0x0e,0x20,0x03,0x00};
+static unsigned char WAVELAN_BEACON_ADDRESS[] = {0x09,0x00,0x0e,0x20,0x03,0x00};
   
-void wv_roam_init(struct net_device *dev)
+static void wv_roam_init(struct net_device *dev)
 {
   net_local  *lp= netdev_priv(dev);
 
@@ -531,7 +537,7 @@ void wv_roam_init(struct net_device *dev
   printk(KERN_DEBUG "WaveLAN: Roaming enabled on device %s\n",dev->name);
 }
  
-void wv_roam_cleanup(struct net_device *dev)
+static void wv_roam_cleanup(struct net_device *dev)
 {
   wavepoint_history *ptr,*old_ptr;
   net_local *lp= netdev_priv(dev);
@@ -550,7 +556,7 @@ void wv_roam_cleanup(struct net_device *
 }
 
 /* Enable/Disable NWID promiscuous mode on a given device */
-void wv_nwid_filter(unsigned char mode, net_local *lp)
+static void wv_nwid_filter(unsigned char mode, net_local *lp)
 {
   mm_t                  m;
   unsigned long         flags;
@@ -575,7 +581,7 @@ void wv_nwid_filter(unsigned char mode, 
 }
 
 /* Find a record in the WavePoint table matching a given NWID */
-wavepoint_history *wl_roam_check(unsigned short nwid, net_local *lp)
+static wavepoint_history *wl_roam_check(unsigned short nwid, net_local *lp)
 {
   wavepoint_history	*ptr=lp->wavepoint_table.head;
   
@@ -588,7 +594,7 @@ wavepoint_history *wl_roam_check(unsigne
 }
 
 /* Create a new wavepoint table entry */
-wavepoint_history *wl_new_wavepoint(unsigned short nwid, unsigned char seq, net_local* lp)
+static wavepoint_history *wl_new_wavepoint(unsigned short nwid, unsigned char seq, net_local* lp)
 {
   wavepoint_history *new_wavepoint;
 
@@ -624,7 +630,7 @@ wavepoint_history *wl_new_wavepoint(unsi
 }
 
 /* Remove a wavepoint entry from WavePoint table */
-void wl_del_wavepoint(wavepoint_history *wavepoint, struct net_local *lp)
+static void wl_del_wavepoint(wavepoint_history *wavepoint, struct net_local *lp)
 {
   if(wavepoint==NULL)
     return;
@@ -646,7 +652,7 @@ void wl_del_wavepoint(wavepoint_history 
 }
 
 /* Timer callback function - checks WavePoint table for stale entries */ 
-void wl_cell_expiry(unsigned long data)
+static void wl_cell_expiry(unsigned long data)
 {
   net_local *lp=(net_local *)data;
   wavepoint_history *wavepoint=lp->wavepoint_table.head,*old_point;
@@ -686,7 +692,7 @@ void wl_cell_expiry(unsigned long data)
 }
 
 /* Update SNR history of a wavepoint */
-void wl_update_history(wavepoint_history *wavepoint, unsigned char sigqual, unsigned char seq)	
+static void wl_update_history(wavepoint_history *wavepoint, unsigned char sigqual, unsigned char seq)	
 {
   int i=0,num_missed=0,ptr=0;
   int average_fast=0,average_slow=0;
@@ -723,7 +729,7 @@ void wl_update_history(wavepoint_history
 }
 
 /* Perform a handover to a new WavePoint */
-void wv_roam_handover(wavepoint_history *wavepoint, net_local *lp)
+static void wv_roam_handover(wavepoint_history *wavepoint, net_local *lp)
 {
   kio_addr_t		base = lp->dev->base_addr;
   mm_t                  m;
diff --git a/drivers/net/wireless/wavelan_cs.h b/drivers/net/wireless/wavelan_cs.h
--- a/drivers/net/wireless/wavelan_cs.h
+++ b/drivers/net/wireless/wavelan_cs.h
@@ -62,7 +62,7 @@
  * like DEC RoamAbout, or Digital Ocean, Epson, ...), you must modify this
  * part to accommodate your hardware...
  */
-const unsigned char	MAC_ADDRESSES[][3] =
+static const unsigned char	MAC_ADDRESSES[][3] =
 {
   { 0x08, 0x00, 0x0E },		/* AT&T Wavelan (standard) & DEC RoamAbout */
   { 0x08, 0x00, 0x6A },		/* AT&T Wavelan (alternate) */
@@ -79,14 +79,14 @@ const unsigned char	MAC_ADDRESSES[][3] =
  * (as read in the offset register of the dac area).
  * Used to map channel numbers used by `wfreqsel' to frequencies
  */
-const short	channel_bands[] = { 0x30, 0x58, 0x64, 0x7A, 0x80, 0xA8,
+static const short	channel_bands[] = { 0x30, 0x58, 0x64, 0x7A, 0x80, 0xA8,
 				    0xD0, 0xF0, 0xF8, 0x150 };
 
 /* Frequencies of the 1.0 modem (fixed frequencies).
  * Use to map the PSA `subband' to a frequency
  * Note : all frequencies apart from the first one need to be multiplied by 10
  */
-const int	fixed_bands[] = { 915e6, 2.425e8, 2.46e8, 2.484e8, 2.4305e8 };
+static const int	fixed_bands[] = { 915e6, 2.425e8, 2.46e8, 2.484e8, 2.4305e8 };
 
 
 /*************************** PC INTERFACE ****************************/
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -647,23 +647,6 @@ struct net_local
   void __iomem *mem;
 };
 
-/**************************** PROTOTYPES ****************************/
-
-#ifdef WAVELAN_ROAMING
-/* ---------------------- ROAMING SUBROUTINES -----------------------*/
-
-wavepoint_history *wl_roam_check(unsigned short nwid, net_local *lp);
-wavepoint_history *wl_new_wavepoint(unsigned short nwid, unsigned char seq, net_local *lp);
-void wl_del_wavepoint(wavepoint_history *wavepoint, net_local *lp);
-void wl_cell_expiry(unsigned long data);
-wavepoint_history *wl_best_sigqual(int fast_search, net_local *lp);
-void wl_update_history(wavepoint_history *wavepoint, unsigned char sigqual, unsigned char seq);
-void wv_roam_handover(wavepoint_history *wavepoint, net_local *lp);
-void wv_nwid_filter(unsigned char mode, net_local *lp);
-void wv_roam_init(struct net_device *dev);
-void wv_roam_cleanup(struct net_device *dev);
-#endif	/* WAVELAN_ROAMING */
-
 /* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */
 static inline u_char		/* data */
 	hasr_read(u_long);	/* Read the host interface : base address */
diff --git a/drivers/net/wireless/wl3501.h b/drivers/net/wireless/wl3501.h
--- a/drivers/net/wireless/wl3501.h
+++ b/drivers/net/wireless/wl3501.h
@@ -2,7 +2,7 @@
 #define __WL3501_H__
 
 #include <linux/spinlock.h>
-#include "ieee802_11.h"
+#include <net/ieee80211.h>
 
 /* define for WLA 2.0 */
 #define WL3501_BLKSZ 256
@@ -548,7 +548,7 @@ struct wl3501_80211_tx_plcp_hdr {
 
 struct wl3501_80211_tx_hdr {
 	struct wl3501_80211_tx_plcp_hdr	pclp_hdr;
-	struct ieee802_11_hdr		mac_hdr;
+	struct ieee80211_hdr		mac_hdr;
 } __attribute__ ((packed));
 
 /*
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -296,7 +296,8 @@ static int wl3501_get_flash_mac_addr(str
  *
  * Move 'size' bytes from PC to card. (Shouldn't be interrupted)
  */
-void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, int size)
+static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src,
+			      int size)
 {
 	/* switch to SRAM Page 0 */
 	wl3501_switch_page(this, (dest & 0x8000) ? WL3501_BSS_SPAGE1 :
@@ -317,8 +318,8 @@ void wl3501_set_to_wla(struct wl3501_car
  *
  * Move 'size' bytes from card to PC. (Shouldn't be interrupted)
  */
-void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest,
-			 int size)
+static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest,
+				int size)
 {
 	/* switch to SRAM Page 0 */
 	wl3501_switch_page(this, (src & 0x8000) ? WL3501_BSS_SPAGE1 :
@@ -1438,14 +1439,14 @@ fail:
 	goto out;
 }
 
-struct net_device_stats *wl3501_get_stats(struct net_device *dev)
+static struct net_device_stats *wl3501_get_stats(struct net_device *dev)
 {
 	struct wl3501_card *this = dev->priv;
 
 	return &this->stats;
 }
 
-struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev)
+static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev)
 {
 	struct wl3501_card *this = dev->priv;
 	struct iw_statistics *wstats = &this->wstats;
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
--- a/drivers/usb/net/Makefile
+++ b/drivers/usb/net/Makefile
@@ -8,5 +8,3 @@ obj-$(CONFIG_USB_PEGASUS)	+= pegasus.o
 obj-$(CONFIG_USB_RTL8150)	+= rtl8150.o
 obj-$(CONFIG_USB_USBNET)	+= usbnet.o
 obj-$(CONFIG_USB_ZD1201)	+= zd1201.o
-
-CFLAGS_zd1201.o = -Idrivers/net/wireless/
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -21,7 +21,7 @@
 #include <linux/string.h>
 #include <linux/if_arp.h>
 #include <linux/firmware.h>
-#include <ieee802_11.h>
+#include <net/ieee80211.h>
 #include "zd1201.h"
 
 static struct usb_device_id zd1201_table[] = {
@@ -338,25 +338,25 @@ static void zd1201_usbrx(struct urb *urb
 			goto resubmit;
 		}
 			
-		if ((seq & IEEE802_11_SCTL_FRAG) ||
-		    (fc & IEEE802_11_FCTL_MOREFRAGS)) {
+		if ((seq & IEEE80211_SCTL_FRAG) ||
+		    (fc & IEEE80211_FCTL_MOREFRAGS)) {
 			struct zd1201_frag *frag = NULL;
 			char *ptr;
 
 			if (datalen<14)
 				goto resubmit;
-			if ((seq & IEEE802_11_SCTL_FRAG) == 0) {
+			if ((seq & IEEE80211_SCTL_FRAG) == 0) {
 				frag = kmalloc(sizeof(struct zd1201_frag*),
 				    GFP_ATOMIC);
 				if (!frag)
 					goto resubmit;
-				skb = dev_alloc_skb(IEEE802_11_DATA_LEN +14+2);
+				skb = dev_alloc_skb(IEEE80211_DATA_LEN +14+2);
 				if (!skb) {
 					kfree(frag);
 					goto resubmit;
 				}
 				frag->skb = skb;
-				frag->seq = seq & IEEE802_11_SCTL_SEQ;
+				frag->seq = seq & IEEE80211_SCTL_SEQ;
 				skb_reserve(skb, 2);
 				memcpy(skb_put(skb, 12), &data[datalen-14], 12);
 				memcpy(skb_put(skb, 2), &data[6], 2);
@@ -365,7 +365,7 @@ static void zd1201_usbrx(struct urb *urb
 				goto resubmit;
 			}
 			hlist_for_each_entry(frag, node, &zd->fraglist, fnode)
-				if(frag->seq == (seq&IEEE802_11_SCTL_SEQ))
+				if(frag->seq == (seq&IEEE80211_SCTL_SEQ))
 					break;
 			if (!frag)
 				goto resubmit;
@@ -373,7 +373,7 @@ static void zd1201_usbrx(struct urb *urb
 			ptr = skb_put(skb, len);
 			if (ptr)
 				memcpy(ptr, data+8, len);
-			if (fc & IEEE802_11_FCTL_MOREFRAGS)
+			if (fc & IEEE80211_FCTL_MOREFRAGS)
 				goto resubmit;
 			hlist_del_init(&frag->fnode);
 			kfree(frag);
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -69,6 +69,12 @@ static inline int is_multicast_ether_add
 	return ((addr[0] != 0xff) && (0x01 & addr[0]));
 }
 
+static inline int is_broadcast_ether_addr(const u8 *addr)
+{
+        return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&  
+		(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
+}
+
 /**
  * is_valid_ether_addr - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -20,7 +20,6 @@
  */
 #ifndef IEEE80211_H
 #define IEEE80211_H
-
 #include <linux/if_ether.h> /* ETH_ALEN */
 #include <linux/kernel.h>   /* ARRAY_SIZE */
 
@@ -426,9 +425,7 @@ struct ieee80211_stats {
 
 struct ieee80211_device;
 
-#if 0 /* for later */
 #include "ieee80211_crypt.h"
-#endif
 
 #define SEC_KEY_1         (1<<0)
 #define SEC_KEY_2         (1<<1)
@@ -852,5 +849,4 @@ static inline const char *escape_essid(c
 	*d = '\0';
 	return escaped;
 }
-
 #endif /* IEEE80211_H */
diff --git a/net/Kconfig b/net/Kconfig
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -212,6 +212,7 @@ endmenu
 source "net/ax25/Kconfig"
 source "net/irda/Kconfig"
 source "net/bluetooth/Kconfig"
+source "net/ieee80211/Kconfig"
 
 endif   # if NET
 endmenu # Networking
diff --git a/net/Makefile b/net/Makefile
--- a/net/Makefile
+++ b/net/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_DECNET)		+= decnet/
 obj-$(CONFIG_ECONET)		+= econet/
 obj-$(CONFIG_VLAN_8021Q)	+= 8021q/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
+obj-$(CONFIG_IEEE80211)		+= ieee80211/
 
 ifeq ($(CONFIG_NET),y)
 obj-$(CONFIG_SYSCTL)		+= sysctl_net.o

^ permalink raw reply

* Re: [2.6 patch] net: Spelling mistakes threshoulds -> thresholds
From: David S. Miller @ 2005-07-31  0:42 UTC (permalink / raw)
  To: baruch; +Cc: bunk, netdev, linux-kernel
In-Reply-To: <42EA0346.8070703@ev-en.org>

From: Baruch Even <baruch@ev-en.org>
Date: Fri, 29 Jul 2005 11:21:58 +0100

> Just simple spelling mistake fixes.
> 
> Signed-Off-By: Baruch Even <baruch@ev-en.org>

Applied, thanks Baruch.

^ permalink raw reply

* Re: [PATCH] MASQUERADE: inherit masq_index to slave connections
From: David S. Miller @ 2005-07-31  0:45 UTC (permalink / raw)
  To: laforge; +Cc: netdev, netfilter-devel
In-Reply-To: <20050730135511.GE6620@rama.de.gnumonks.org>

From: Harald Welte <laforge@netfilter.org>
Date: Sat, 30 Jul 2005 15:55:12 +0200

> [NETFILTER] Inherit masq_index to slave connections
> 
> masq_index is used for cleanup in case the interface address changes
> (such as a dialup ppp link with dynamic addreses).  Without this patch,
> slave connections are not evicted in such a case, since they don't inherit
> masq_index.
> 
> Signed-off-by: Harald Welte <laforge@netfilter.org>

Applied, thanks Harald.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox