[PATCH] TCP_MIB_OUTSEGS increased including retransmitted octets

2006-02-24 Thread Wei Yongjun
Linux kernel increased the TCP_MIB_OUTSEGS even if only retransmitted
octets is send out. RFC2012 saied that it excluding those containing
only retransmitted octets.

Refer to RFC2012, tcpOutSegs is defined as following:

   tcpOutSegs OBJECT-TYPE
   SYNTAX  Counter32
   MAX-ACCESS  read-only
   STATUS  current
   DESCRIPTION
   The total number of segments sent, including those on
   current connections but excluding those containing only
   retransmitted octets.
   ::= { tcp 11 }

--- a/net/ipv4/tcp_output.c 2006-02-23 09:20:24.660261904 +0900
+++ b/net/ipv4/tcp_output.c 2006-02-23 09:41:16.393969456 +0900
@@ -379,7 +379,8 @@
if (skb-len != tcp_header_size)
tcp_event_data_sent(tp, skb, sk);
 
-   TCP_INC_STATS(TCP_MIB_OUTSEGS);
+   if (!(tcb-sacked  TCPCB_LOST))
+   TCP_INC_STATS(TCP_MIB_OUTSEGS);
 
err = tp-af_specific-queue_xmit(skb, 0);
if (unlikely(err = 0))



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Uninline kfree_skb and allow NULL argument

2006-02-24 Thread Jörn Engel
On Thu, 23 February 2006 12:48:01 -0800, David S. Miller wrote:
 
 If you wish to contribute to a software project, you should adhere to
 the coding style and conventions of that project when submitting
 changes.  It doesn't matter what the reasons are for those
 conventions, you should follow them until the projects decides to
 change them.

Agreed.

 If you wish to discuss the merits of putting extern there or not in
 function declarations, you can start a thread about that and make
 proposals on linux-kernel.

Not really.  According to my limited understanding of C, the presence
or absence of extern shouldn't make a difference either way.  If this
understanding if correct and people simply prefer to have the extern,
that's perfectly fine with me.  But if it does indeed make a
difference, I'd like to learn something new.

 So place add extern here, thanks a lot.

Done.  Sorry about that.

Jörn

-- 
The cost of changing business rules is much more expensive for software
than for a secretaty.
-- unknown

o Uninline kfree_skb, which saves some 15k of object code on my notebook.

o Allow kfree_skb to be called with a NULL argument.

  Subsequent patches can remove conditional from drivers and further
  reduce source and object size.

Signed-off-by: Jörn Engel [EMAIL PROTECTED]
---

 include/linux/skbuff.h |   17 +
 net/core/skbuff.c  |   18 ++
 2 files changed, 19 insertions(+), 16 deletions(-)

--- kfree_skb/include/linux/skbuff.h~kfree_skb_uninline_null2006-02-23 
13:35:05.0 +0100
+++ kfree_skb/include/linux/skbuff.h2006-02-23 13:36:23.0 +0100
@@ -306,6 +306,7 @@ struct sk_buff {
 
 #include asm/system.h
 
+extern void kfree_skb(struct sk_buff *skb);
 extern void   __kfree_skb(struct sk_buff *skb);
 extern struct sk_buff *__alloc_skb(unsigned int size,
   gfp_t priority, int fclone);
@@ -406,22 +407,6 @@ static inline struct sk_buff *skb_get(st
  */
 
 /**
- * kfree_skb - free an sk_buff
- * @skb: buffer to free
- *
- * Drop a reference to the buffer and free it if the usage count has
- * hit zero.
- */
-static inline void kfree_skb(struct sk_buff *skb)
-{
-   if (likely(atomic_read(skb-users) == 1))
-   smp_rmb();
-   else if (likely(!atomic_dec_and_test(skb-users)))
-   return;
-   __kfree_skb(skb);
-}
-
-/**
  * skb_cloned - is the buffer a clone
  * @skb: buffer to check
  *
--- kfree_skb/net/core/skbuff.c~kfree_skb_uninline_null 2006-02-23 
13:35:05.0 +0100
+++ kfree_skb/net/core/skbuff.c 2006-02-23 13:37:01.0 +0100
@@ -355,6 +355,24 @@ void __kfree_skb(struct sk_buff *skb)
 }
 
 /**
+ * kfree_skb - free an sk_buff
+ * @skb: buffer to free
+ *
+ * Drop a reference to the buffer and free it if the usage count has
+ * hit zero.
+ */
+void kfree_skb(struct sk_buff *skb)
+{
+   if (unlikely(!skb))
+   return;
+   if (likely(atomic_read(skb-users) == 1))
+   smp_rmb();
+   else if (likely(!atomic_dec_and_test(skb-users)))
+   return;
+   __kfree_skb(skb);
+}
+
+/**
  * skb_clone   -   duplicate an sk_buff
  * @skb: buffer to clone
  * @gfp_mask: allocation priority
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Uninline kfree_skb and allow NULL argument

2006-02-24 Thread David S. Miller
From: Jörn Engel [EMAIL PROTECTED]
Date: Fri, 24 Feb 2006 09:18:38 +0100

 On Thu, 23 February 2006 12:48:01 -0800, David S. Miller wrote:
  So place add extern here, thanks a lot.
 
 Done.  Sorry about that.

Thanks.

One more problem :-)  Please export the kfree_skb() symbol so
networking modules don't break.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Uninline kfree_skb and allow NULL argument

2006-02-24 Thread Jörn Engel
On Fri, 24 February 2006 00:32:04 -0800, David S. Miller wrote:
 
 One more problem :-)  Please export the kfree_skb() symbol so
 networking modules don't break.

Doh!  Done.

Any more reasons to wear a brown paperbag?

Jörn

-- 
When in doubt, punt.  When somebody actually complains, go back and fix it...
The 90% solution is a good thing.
-- Rob Landley

o Uninline kfree_skb, which saves some 15k of object code on my notebook.

o Allow kfree_skb to be called with a NULL argument.

  Subsequent patches can remove conditional from drivers and further
  reduce source and object size.

Signed-off-by: Jörn Engel [EMAIL PROTECTED]
---

 include/linux/skbuff.h |   17 +
 net/core/skbuff.c  |   19 +++
 2 files changed, 20 insertions(+), 16 deletions(-)


--- kfree_skb/include/linux/skbuff.h~kfree_skb_uninline_null2006-02-23 
13:35:05.0 +0100
+++ kfree_skb/include/linux/skbuff.h2006-02-24 09:35:47.0 +0100
@@ -306,6 +306,7 @@ struct sk_buff {
 
 #include asm/system.h
 
+extern void kfree_skb(struct sk_buff *skb);
 extern void   __kfree_skb(struct sk_buff *skb);
 extern struct sk_buff *__alloc_skb(unsigned int size,
   gfp_t priority, int fclone);
@@ -406,22 +407,6 @@ static inline struct sk_buff *skb_get(st
  */
 
 /**
- * kfree_skb - free an sk_buff
- * @skb: buffer to free
- *
- * Drop a reference to the buffer and free it if the usage count has
- * hit zero.
- */
-static inline void kfree_skb(struct sk_buff *skb)
-{
-   if (likely(atomic_read(skb-users) == 1))
-   smp_rmb();
-   else if (likely(!atomic_dec_and_test(skb-users)))
-   return;
-   __kfree_skb(skb);
-}
-
-/**
  * skb_cloned - is the buffer a clone
  * @skb: buffer to check
  *
--- kfree_skb/net/core/skbuff.c~kfree_skb_uninline_null 2006-02-23 
13:35:05.0 +0100
+++ kfree_skb/net/core/skbuff.c 2006-02-24 09:36:15.0 +0100
@@ -355,6 +355,24 @@ void __kfree_skb(struct sk_buff *skb)
 }
 
 /**
+ * kfree_skb - free an sk_buff
+ * @skb: buffer to free
+ *
+ * Drop a reference to the buffer and free it if the usage count has
+ * hit zero.
+ */
+void kfree_skb(struct sk_buff *skb)
+{
+   if (unlikely(!skb))
+   return;
+   if (likely(atomic_read(skb-users) == 1))
+   smp_rmb();
+   else if (likely(!atomic_dec_and_test(skb-users)))
+   return;
+   __kfree_skb(skb);
+}
+
+/**
  * skb_clone   -   duplicate an sk_buff
  * @skb: buffer to clone
  * @gfp_mask: allocation priority
@@ -1807,6 +1825,7 @@ void __init skb_init(void)
 
 EXPORT_SYMBOL(___pskb_trim);
 EXPORT_SYMBOL(__kfree_skb);
+EXPORT_SYMBOL(kfree_skb);
 EXPORT_SYMBOL(__pskb_pull_tail);
 EXPORT_SYMBOL(__alloc_skb);
 EXPORT_SYMBOL(pskb_copy);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPv6 setsockopt software MTU patch

2006-02-24 Thread YOSHIFUJI Hideaki / 吉藤英明
Hello.

In article [EMAIL PROTECTED] (at Thu, 23 Feb 2006 17:10:18 -0800 (PST)), 
David S. Miller [EMAIL PROTECTED] says:

 From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 Date: Fri, 24 Feb 2006 00:23:51 +0900 (JST)
 
  David, please apply.  Thank you.
 
 Can you please resend the patch with a full changelog
 entry and Signed-off-by lines for me?  Thank you.
 
 This is for net-2.6 right?  Or net-2.6.17?

Here it is.  I think net-2.6 is fine.  Thanks.

--- 
2.6.x have ignored IPV6_MTU socket option, which control per-socket
Path MTU.  This patch, for net-2.6, implements that.

Based on patch by Hoerdt Mickael [EMAIL PROTECTED].

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index efa3e72..f999edd 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -494,6 +494,7 @@ static int ip6_fragment(struct sk_buff *
struct net_device *dev;
struct sk_buff *frag;
struct rt6_info *rt = (struct rt6_info*)skb-dst;
+   struct ipv6_pinfo *np = skb-sk ? inet6_sk(skb-sk) : NULL;
struct ipv6hdr *tmp_hdr;
struct frag_hdr *fh;
unsigned int mtu, hlen, left, len;
@@ -505,7 +506,12 @@ static int ip6_fragment(struct sk_buff *
hlen = ip6_find_1stfragopt(skb, prevhdr);
nexthdr = *prevhdr;
 
-   mtu = dst_mtu(rt-u.dst) - hlen - sizeof(struct frag_hdr);
+   mtu = dst_mtu(rt-u.dst);
+   if (np  np-frag_size  mtu) {
+   if (np-frag_size)
+   mtu = np-frag_size;
+   }
+   mtu -= hlen + sizeof(struct frag_hdr);
 
if (skb_shinfo(skb)-frag_list) {
int first_len = skb_pagelen(skb);
@@ -882,7 +888,12 @@ int ip6_append_data(struct sock *sk, int
inet-cork.fl = *fl;
np-cork.hop_limit = hlimit;
np-cork.tclass = tclass;
-   inet-cork.fragsize = mtu = dst_mtu(rt-u.dst.path);
+   mtu = dst_mtu(rt-u.dst.path);
+   if (np  np-frag_size  mtu) {
+   if (np-frag_size)
+   mtu = np-frag_size;
+   }
+   inet-cork.fragsize = mtu;
if (dst_allfrag(rt-u.dst.path))
inet-cork.flags |= IPCORK_ALLFRAG;
inet-cork.length = 0;

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add Wake on LAN support to sis900 (2)

2006-02-24 Thread Daniele Venzano
Attached you find the patch that fixes two bugs in the WoL  
implementation of sis900. The first causes hangs on some system on  
driver load, the second causes troubles when disabling WoL support.  
Both fixes are one liner and really simple. Patch is against latest  
netdev-2.6 tree.


Signed-off-by: Lennert Buytenhek [EMAIL PROTECTED]
Signed-off-by: Daniele Venzano [EMAIL PROTECTED]



sis900_wol_fix.diff
Description: Binary data


Re: [PATCH] Add Wake on LAN support to sis900 (2)

2006-02-24 Thread Daniele Venzano
Here's the full patch that adds WoL support to vanilla kernel version  
2.6.15.4 with the latest fixes. For reference, comments and general  
review. I hope my mailer doesn't feel too smart today.


Thanks.

Signed-off-by: Daniele Venzano [EMAIL PROTECTED]



sis900_wol.diff
Description: Binary data


--
Daniele Venzano
http://www.brownhat.org



Re: ip6_tunnel keeping dst_cache after change of params

2006-02-24 Thread Ville Nuorvala

Hugo Santos wrote:

Hi,


Hi Hugo!


   ip6_tunnel keeps a cached dst (dst_cache in ip6_tnl) per tunnel
 instance. This cached dst is re-used while it's not marked obsolete. A
 change of the tunnel's parameters (via SIOCCHGTUNNEL) does not
 invalidate the dst_cache directly, which results on it being used by
 ip6ip6_tnl_xmit after the tunnel is configured with new parameters.
   Shouldn't ip6ip6_tnl_change dst_release() the cached dst and leave
 ip6ip6_tnl_xmit to pick a new one based on the new local/remote
 addresses etc? I can provide a patch to fix this, meanwhile just wanted
 to confirm the expected behaviour.


Yes, you are right.

Regards,
Ville
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip6_tunnel: release cached dst on change of tunnel params

2006-02-24 Thread Ville Nuorvala

Hugo Santos wrote:

Hi,

   The included patch fixes ip6_tunnel to release the cached dst entry
 when the tunnel parameters (such as tunnel endpoints) are changed so
 they are used immediatly for the next encapsulated packets.

 Signed-off-by: Hugo Santos [EMAIL PROTECTED]

--- linux-2.6.16-rc4/net/ipv6/ip6_tunnel.c  2006-02-17 22:23:45.0 
+
+++ linux-2.6.16-rc4-new/net/ipv6/ip6_tunnel.c  2006-02-24 01:40:17.0 
+
@@ -884,6 +884,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, str
t-parms.encap_limit = p-encap_limit;
t-parms.flowinfo = p-flowinfo;
t-parms.link = p-link;
+   ip6_tnl_dst_reset(t);
ip6ip6_tnl_link_config(t);
return 0;
 }


Acked-by: Ville Nuorvala [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Problem with Ipsec transport mode over NAT

2006-02-24 Thread Chinh Nguyen
Patrick McHardy wrote:
I don't know what correct fix is. Adding an extra call to xfrm4_policy_check 
in
tcp_v4_rcv before the checksum check fixes this problem and doesn't seem to
break anything else. On the other hand, moving some of the code in
esp_post_input into esp_input (especially line 298) will work, too.
 
 
 So we could move checksum validation behind xfrm4_policy_check or
 already set ip_summed to CHECKSUM_UNNECESSARY in esp_input. Already
 setting ip_summed in esp4_input looks easier. But this still leaves
 one problem. With netfilter and local NAT, a decapsulated transport
 mode packet might be forwarded to another host. In that case the
 checksum contained in the packet is invalid. Any ideas how to fix
 this anyone?

I don't know what the functional separation or difference between a packet input
function and a packet post input function is but the entire code in
esp_post_input doesn't seem like it would cause any problem just by placing it
at end of esp_input instead of current location.

A forwarded decapsulated packet would have the destination IP changed from
server S to another IP. Shouldn't that cause the stack to automatically
recalculate the checksum?

Anyway, enough speculation. I will leave the solution to those who know the
linux kernel networking code.

Thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2006-02-24 Thread Stephen Hemminger

Wolfgang Hoffmann wrote:

On Friday 24 February 2006 06:22, Jeff Garzik wrote:
  

Please pull from 'upstream-fixes' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

[...]
Stephen Hemminger:
  sky2: yukon-ec-u chipset initialization
  sky2: limit coalescing values to ring size
  sky2: poke coalescing timer to fix hang
  sky2: force early transmit status
  sky2: use device iomem to access PCI config
  sky2: close race on IRQ mask update.
[...]



Thanks for the update.

Still I'm seeing reproducable hangs with this version of sky2 (as reported in 
bugzilla 6084 and discussed on netdev).


Stephen, if there is anything I can do to narrow down my hangs a bit more 
systematically, please let me know, I'd be happy to help.


Wolfgang
  
There is an outstanding bug where the sky2 will hang if it receives a 
packet larger than the

MTU.  At this point, there isn't enough information on chip behavior to fix.

You could try using a larger mut or patching the driver so that the 
rx_buffer_size is always big (like 4k).

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2006-02-24 Thread Wolfgang Hoffmann
On Friday 24 February 2006 17:14, Stephen Hemminger wrote:
 There is an outstanding bug where the sky2 will hang if it receives a
 packet larger than the MTU.  At this point, there isn't enough information
 on chip behavior to fix.

 You could try using a larger mut or patching the driver so that the
 rx_buffer_size is always big (like 4k).

I've raised the MTU from 1500 to 3000 and still reproduced the hang. Would you 
mind sending me a patch for forcing rx_buffer_size to 4k, so I can try that, 
or is no sense in that, given that raising the MTU didn't help?

Concerning information on chip behavior, are you missing vendor specs, or 
could I be helpful by reproducing the hang with an instrumented driver that 
gives more information about the chip status at hang time?

Another thing that may be worth to find out is why 0.13 with Carl-Daniel 
Hailfingers fix works. I didn't see a single hang with that version. I'm 
currently resorting to that version, but well ...

I'd really like to help get this driver working robustly. I'm not enough into 
networking to help by coding, but yes I'll give feedback on any driver 
version you send me. I'd just like to provide you more helpful data than 
repeating new version still hangs ;-)

Wolfgang

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip6_tunnel: release cached dst on change of tunnel params

2006-02-24 Thread David S. Miller
From: Ville Nuorvala [EMAIL PROTECTED]
Date: Fri, 24 Feb 2006 15:55:23 +0200

 Hugo Santos wrote:
  Hi,
  
 The included patch fixes ip6_tunnel to release the cached dst entry
   when the tunnel parameters (such as tunnel endpoints) are changed so
   they are used immediatly for the next encapsulated packets.
  
   Signed-off-by: Hugo Santos [EMAIL PROTECTED]
  
  --- linux-2.6.16-rc4/net/ipv6/ip6_tunnel.c  2006-02-17 
  22:23:45.0 +
  +++ linux-2.6.16-rc4-new/net/ipv6/ip6_tunnel.c  2006-02-24 
  01:40:17.0 +
  @@ -884,6 +884,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, str
  t-parms.encap_limit = p-encap_limit;
  t-parms.flowinfo = p-flowinfo;
  t-parms.link = p-link;
  +   ip6_tnl_dst_reset(t);
  ip6ip6_tnl_link_config(t);
  return 0;
   }
  
 Acked-by: Ville Nuorvala [EMAIL PROTECTED]

Applied, although the patch was tab/whitespace damaged by Hugo's
email client so I had to apply it by hand.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: IPv6 setsockopt software MTU patch

2006-02-24 Thread David S. Miller
From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date: Fri, 24 Feb 2006 18:22:25 +0900 (JST)

 Here it is.  I think net-2.6 is fine.  Thanks.

Applied, thanks a lot.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] [LLC]: Fix sap refcounting

2006-02-24 Thread Arnaldo Carvalho de Melo
Thanks to Leslie Harlley Watter [EMAIL PROTECTED] for reporting
the problem an testing this patch.

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]

---

 net/llc/af_llc.c   |4 +++-
 net/llc/llc_core.c |1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

42b30504aadc0e1e45eb915573e1d2c07d133b00
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 2337944..5a04db7 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -187,8 +187,10 @@ static int llc_ui_release(struct socket 
llc-laddr.lsap, llc-daddr.lsap);
if (!llc_send_disc(sk))
llc_ui_wait_for_disc(sk, sk-sk_rcvtimeo);
-   if (!sock_flag(sk, SOCK_ZAPPED))
+   if (!sock_flag(sk, SOCK_ZAPPED)) {
+   llc_sap_put(llc-sap);
llc_sap_remove_socket(llc-sap, sk);
+   }
release_sock(sk);
if (llc-dev)
dev_put(llc-dev);
diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
index ab0fcd3..bd242a4 100644
--- a/net/llc/llc_core.c
+++ b/net/llc/llc_core.c
@@ -127,7 +127,6 @@ struct llc_sap *llc_sap_open(unsigned ch
goto out;
sap-laddr.lsap = lsap;
sap-rcv_func   = func;
-   llc_sap_hold(sap);
llc_add_sap(sap);
 out:
write_unlock_bh(llc_sap_list_lock);
-- 
1.2.2.gd27d


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] [LLC]: Replace __inline__ with inline

2006-02-24 Thread Arnaldo Carvalho de Melo
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]

---

 net/llc/af_llc.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

bac4eba541726216405d373edae1b285de230e0d
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 490b3b4..2337944 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -54,7 +54,7 @@ static int llc_ui_wait_for_busy_core(str
  *
  * Return the next unused link number for a given sap.
  */
-static __inline__ u16 llc_ui_next_link_no(int sap)
+static inline u16 llc_ui_next_link_no(int sap)
 {
return llc_ui_sap_link_no_max[sap]++;
 }
@@ -65,7 +65,7 @@ static __inline__ u16 llc_ui_next_link_n
  *
  * Given an ARP header type return the corresponding ethernet protocol.
  */
-static __inline__ u16 llc_proto_type(u16 arphrd)
+static inline u16 llc_proto_type(u16 arphrd)
 {
return arphrd == ARPHRD_IEEE802_TR ?
 htons(ETH_P_TR_802_2) : htons(ETH_P_802_2);
@@ -75,7 +75,7 @@ static __inline__ u16 llc_proto_type(u16
  * llc_ui_addr_null - determines if a address structure is null
  * @addr: Address to test if null.
  */
-static __inline__ u8 llc_ui_addr_null(struct sockaddr_llc *addr)
+static inline u8 llc_ui_addr_null(struct sockaddr_llc *addr)
 {
return !memcmp(addr, llc_ui_addrnull, sizeof(*addr));
 }
@@ -89,8 +89,7 @@ static __inline__ u8 llc_ui_addr_null(st
  * operation the user would like to perform and the type of socket.
  * Returns the correct llc header length.
  */
-static __inline__ u8 llc_ui_header_len(struct sock *sk,
-  struct sockaddr_llc *addr)
+static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)
 {
u8 rc = LLC_PDU_LEN_U;
 
-- 
1.2.2.gd27d


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Uninline kfree_skb and allow NULL argument

2006-02-24 Thread David S. Miller
From: Jörn Engel [EMAIL PROTECTED]
Date: Fri, 24 Feb 2006 09:37:59 +0100

 On Fri, 24 February 2006 00:32:04 -0800, David S. Miller wrote:
  
  One more problem :-)  Please export the kfree_skb() symbol so
  networking modules don't break.
 
 Doh!  Done.
 
 Any more reasons to wear a brown paperbag?

Not that I can see :-)

Patch applied, thanks a lot.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] af_unix: use shift instead of integer division

2006-02-24 Thread David S. Miller
From: Benjamin LaHaise [EMAIL PROTECTED]
Date: Tue, 7 Feb 2006 06:54:44 -0800

 The patch below replaces a divide by 2 with a shift -- sk_sndbuf is an 
 integer, so gcc emits an idiv, which takes 10x longer than a shift by 1.  
 This improves af_unix bandwidth by ~6-10K/s.  Also, tidy up the comment 
 to fit in 80 columns while we're at it.
 
 Signed-off-by: Benjamin LaHaise [EMAIL PROTECTED]

Applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17 2/2] tg3: Fix tg3_get_ringparam()

2006-02-24 Thread David S. Miller

Both patches applied to net-2.6.17, thanks a lot Michael.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fib_trie initialzation fix [PATCH]

2006-02-24 Thread David S. Miller
From: Robert Olsson [EMAIL PROTECTED]
Date: Wed, 22 Feb 2006 14:23:35 +0100

 In some kernel configs /proc functions seems to be accessed before the trie 
 is initialized. The patch below checks for this.
 
 Signed-off-by: Robert Olsson [EMAIL PROTECTED]

Applied, thanks Robert.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [IPV6]: Ensure to join all-routers multicast address.

2006-02-24 Thread David S. Miller
From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date: Thu, 23 Feb 2006 03:18:26 +0900 (JST)

 If net.ipv6.conf.default.forwarding is !0 when bringing up the interface,
 we failed to join all routers multicast address, while we join/leave if we
 enable/disable net.ipv6.conf.ethX.forwarding later.
 
 This is inconsistent because we assume that we join all routers multicast
 if and only if net.ipv6.conf.ethX.forwarding is !0.
 
 So, make sure to join all routers multicast address if forwarding is enabled
 on the interface.
 
 Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

Applied, thanks a lot.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fib_trie stats fix [PATCH]

2006-02-24 Thread David S. Miller
From: Robert Olsson [EMAIL PROTECTED]
Date: Wed, 22 Feb 2006 14:32:43 +0100

 fib_triestats has been buggy and caused oopses some platforms as openwrt.
 The patch below should cure those problems.
 
 Signed-off-by: Robert Olsson [EMAIL PROTECTED]

Also applied, thanks Robert.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3][LLC]: Cleanups Fix

2006-02-24 Thread David S. Miller
From: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Date: Fri, 24 Feb 2006 18:31:35 -0300

Please consider pulling from:
 
 master.kernel.org:/pub/scm/linux/kernel/git/acme/net-2.6.17.git

Looks good, pulled, thanks Arnaldo.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Announce] Intel PRO/Wireless 3945ABG Network Connection

2006-02-24 Thread James Ketrenos
Intel is pleased to announce the launch of an open source project to
support the Intel PRO/Wireless 3945ABG Network Connection mini-PCI
express adapter (IPW3945).

The project is hosted at http://ipw3945.sourceforge.net.  A development
mailing list is available (linked from the top of the IPW3945 project
page.)  You can find the current development release for the adapter by
following the links on the project home page.

A stable [end user targetted] version is not yet available. Those
interested in using the development version should review
the notice linked to from the project page.  A stable version should
be available in the next few weeks.

Aside from a form factor change (our prior wireless cards were mini PCI
while this one is mini PCI express), this project has also changed the
division of work between what occurs on the adapter and what the host is
responsible for performing.  The microcode and hardware provide lower
level MAC services (timings, backoffs, transmit queue management, etc.)
The host is responsible for middle and upper layer MAC services.

As a result of this change, some of the capabilities currently required
to be provided on the host include enforcement of regulatory limits for
the radio transmitter (radio calibration, transmit power, valid
channels, 802.11h, etc.)  In order to meet the requirements of all
geographies into which our adapters ship (over 100 countries) we have
placed the regulatory enforcement logic into a user space daemon that
we provide as a binary under the same license agreement as the
microcode.  We provide that binary pre-compiled as both a 32-bit and
64-bit application.  The daemon utilizes a sysfs interface exposed by
the driver in order to communicate with the hardware and configure the
required regulatory parameters.

Those familiar with our prior projects may be pleased with the changes
we have made with the license agreement for binary portions of this new
project.  We were able to provide a more easily understood agreement
for the binary components required for the adapter to function.  While
this new license still restricts against reverse engineering and
modification, it has been changed to allow easier redistribution.  You
can find the terms of the agreement accessible from the microcode
and daemon download page linked to from the project site.

The current development snapshot contains backward compatibility code
to allow the driver to work in older kernels.  We will be removing 
that code prior to submitting the driver for inclusion in the kernel.

Thanks,
James

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Announce] Intel PRO/Wireless 3945ABG Network Connection

2006-02-24 Thread Jeff V. Merkey


Awesome. Now all we need is someone to write the bcm series for wireless 
and ndiswrapper

can go away.

Jeff

James Ketrenos wrote:


Intel is pleased to announce the launch of an open source project to
support the Intel PRO/Wireless 3945ABG Network Connection mini-PCI
express adapter (IPW3945).

The project is hosted at http://ipw3945.sourceforge.net.  A development
mailing list is available (linked from the top of the IPW3945 project
page.)  You can find the current development release for the adapter by
following the links on the project home page.

A stable [end user targetted] version is not yet available. Those
interested in using the development version should review
the notice linked to from the project page.  A stable version should
be available in the next few weeks.

Aside from a form factor change (our prior wireless cards were mini PCI
while this one is mini PCI express), this project has also changed the
division of work between what occurs on the adapter and what the host is
responsible for performing.  The microcode and hardware provide lower
level MAC services (timings, backoffs, transmit queue management, etc.)
The host is responsible for middle and upper layer MAC services.

As a result of this change, some of the capabilities currently required
to be provided on the host include enforcement of regulatory limits for
the radio transmitter (radio calibration, transmit power, valid
channels, 802.11h, etc.)  In order to meet the requirements of all
geographies into which our adapters ship (over 100 countries) we have
placed the regulatory enforcement logic into a user space daemon that
we provide as a binary under the same license agreement as the
microcode.  We provide that binary pre-compiled as both a 32-bit and
64-bit application.  The daemon utilizes a sysfs interface exposed by
the driver in order to communicate with the hardware and configure the
required regulatory parameters.

Those familiar with our prior projects may be pleased with the changes
we have made with the license agreement for binary portions of this new
project.  We were able to provide a more easily understood agreement
for the binary components required for the adapter to function.  While
this new license still restricts against reverse engineering and
modification, it has been changed to allow easier redistribution.  You
can find the terms of the agreement accessible from the microcode
and daemon download page linked to from the project site.

The current development snapshot contains backward compatibility code
to allow the driver to work in older kernels.  We will be removing 
that code prior to submitting the driver for inclusion in the kernel.


Thanks,
James

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


question about struct ipv6hdr

2006-02-24 Thread Didier Barvaux
Hello everybody,

As a comment says in include/linux/ipv6.h, the ipv6hdr structure is not
correct. The variables priority and flow_lbl do not match the IPv6
header fields as described in the RFC.

/*
 * IPv6 fixed header
 *
 * BEWARE, it is incorrect. The first 4 bits of flow_lbl
 * are glued to priority now, forming class.
 */

struct ipv6hdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
   __u8priority:4,
version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
   __u8version:4,
priority:4;
#else
#error   Please fix asm/byteorder.h
#endif
   __u8flow_lbl[3];

[snip]


Is there some specific reason (other than historical one) ?

Didier Barvaux


signature.asc
Description: PGP signature


Re: [Announce] Intel PRO/Wireless 3945ABG Network Connection

2006-02-24 Thread Dax Kelson
On Fri, 2006-02-24 at 16:29 -0600, James Ketrenos wrote:
 Intel is pleased to announce the launch of an open source project to
 support the Intel PRO/Wireless 3945ABG Network Connection mini-PCI
 express adapter (IPW3945).

Cool!

   In order to meet the requirements of all
 geographies into which our adapters ship (over 100 countries) we have
 placed the regulatory enforcement logic into a user space daemon that
 we provide as a binary under the same license agreement as the
 microcode.  We provide that binary pre-compiled as both a 32-bit and
 64-bit application.  The daemon utilizes a sysfs interface exposed by
 the driver in order to communicate with the hardware and configure the
 required regulatory parameters.

It was exciting to watch the centrino wireless cards go from the least
supported cards in the Linux to the near the best G and A cards from a
feature and licensing stand point (modulo the firmware restart issues).

I have a ipw2200 and have recommended it and now the ipw2915 to anyone
who has asked (myself and ipw2xxx using co-workers have taught thousands
of students and decision makers in Linux classes worldwide).

It is very disappointing to see this binary user space daemon (that must
run as root, presumably to write into /sys/) requirement. I recognize
that it is a better poison than a binary kernel module.

At the point when I'm in the market for a mini-PCI express wireless
adapter I hope there are other cards available that don't require any
kernel or userland binary pieces. I'll vote with my wallet so to speak.

Dax Kelson
Guru Labs

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add Wake on LAN support to sis900 (2)

2006-02-24 Thread John Reiser
Daniele Venzano wrote:
 Attached you find the patch that fixes two bugs in the WoL 
 implementation of sis900. The first causes hangs on some system on 
 driver load, the second causes troubles when disabling WoL support. 
 Both fixes are one liner and really simple. Patch is against latest 
 netdev-2.6 tree.

Thank you for your prompt attention.  The patch works for me
(my SiS 730 board now boots again) when applied to Fedora Core
kernel-2.6.15-1.1977_FC5 which claims to be 2.6.16rc4-git6
of 2006-02-23.

-- 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


SOLUÇÕES GRÁFICAS

2006-02-24 Thread cezar
SOLUÇÕES GRÁFICAS

Re: Problem with Ipsec transport mode over NAT

2006-02-24 Thread Herbert Xu
On Fri, Feb 24, 2006 at 04:57:33AM +, Patrick McHardy wrote:
 
 So we could move checksum validation behind xfrm4_policy_check or
 already set ip_summed to CHECKSUM_UNNECESSARY in esp_input. Already
 setting ip_summed in esp4_input looks easier. But this still leaves

Absolutely.

The only reason post_input exists at all is that it gives us the
potential to adjust the checksums incrementally in future which
we ought to do.

However, after thinking about it for a bit we can adjust the
checksums without using this post_input stuff at all.  The crucial
point is that only the inner-most NAT-T SA needs to be considered
when adjusting checksums.  What's more, the checksum adjustment
comes down to a single u32 due to the linearity of IP checksums.

We just happen to have a spare u32 lying around in our skb structure :)
When ip_summed is set to CHECKSUM_NONE on input, the value of skb-csum
is currently unused.  All we have to do is to make that the checksum
adjustment and voila, there goes all the post_input and decap structures!

I'll send patches to get rid of post_input now.

 one problem. With netfilter and local NAT, a decapsulated transport
 mode packet might be forwarded to another host. In that case the
 checksum contained in the packet is invalid. Any ideas how to fix
 this anyone?

I suppose you should treat CHECKSUM_UNNECESSARY as an indication that
you need to recompute the checksum from scratch instead of adjusting
it.  So start by getting skb_checksum_help to only zap CHECKSUM_HW,
and then test on this in the *_manip_pkt functions.

BTW, the original address (nat_oa) structure is wrong.  We need the
original src as well as the original dst addresses to incrementally
adjust the checksum.  I wonder why everyone keeps getting this wrong.

Fortunately it shouldn't be too hard to fix up, for netlink at least.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[1/2] [IPSEC] esp: Kill unnecessary block and indentation

2006-02-24 Thread Herbert Xu
Hi Dave:

This is the first of two patches which should fix the recent report about
transport mode NAT-T and TCP checksums.

[IPSEC] esp: Kill unnecessary block and indentation

We used to keep sg on the stack which is why the extra block was useful.
We've long since stopped doing that so let's kill the block and save
some indentation.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -150,6 +150,10 @@ static int esp_input(struct xfrm_state *
int elen = skb-len - sizeof(struct ip_esp_hdr) - esp-conf.ivlen - 
alen;
int nfrags;
int encap_len = 0;
+   u8 nexthdr[2];
+   struct scatterlist *sg;
+   u8 workbuf[60];
+   int padlen;
 
if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr)))
goto out;
@@ -185,61 +189,56 @@ static int esp_input(struct xfrm_state *
if (esp-conf.ivlen)
crypto_cipher_set_iv(esp-conf.tfm, esph-enc_data, 
crypto_tfm_alg_ivsize(esp-conf.tfm));
 
-{
-   u8 nexthdr[2];
-   struct scatterlist *sg = esp-sgbuf[0];
-   u8 workbuf[60];
-   int padlen;
-
-   if (unlikely(nfrags  ESP_NUM_FAST_SG)) {
-   sg = kmalloc(sizeof(struct scatterlist)*nfrags, 
GFP_ATOMIC);
-   if (!sg)
-   goto out;
-   }
-   skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + 
esp-conf.ivlen, elen);
-   crypto_cipher_decrypt(esp-conf.tfm, sg, sg, elen);
-   if (unlikely(sg != esp-sgbuf[0]))
-   kfree(sg);
-
-   if (skb_copy_bits(skb, skb-len-alen-2, nexthdr, 2))
-   BUG();
+   sg = esp-sgbuf[0];
 
-   padlen = nexthdr[0];
-   if (padlen+2 = elen)
+   if (unlikely(nfrags  ESP_NUM_FAST_SG)) {
+   sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
+   if (!sg)
goto out;
+   }
+   skb_to_sgvec(skb, sg, sizeof(struct ip_esp_hdr) + esp-conf.ivlen, 
elen);
+   crypto_cipher_decrypt(esp-conf.tfm, sg, sg, elen);
+   if (unlikely(sg != esp-sgbuf[0]))
+   kfree(sg);
 
-   /* ... check padding bits here. Silly. :-) */ 
+   if (skb_copy_bits(skb, skb-len-alen-2, nexthdr, 2))
+   BUG();
 
-   if (x-encap  decap  decap-decap_type) {
-   struct esp_decap_data *encap_data;
-   struct udphdr *uh = (struct udphdr *) (iph+1);
-
-   encap_data = (struct esp_decap_data *) 
(decap-decap_data);
-   encap_data-proto = 0;
-
-   switch (decap-decap_type) {
-   case UDP_ENCAP_ESPINUDP:
-   case UDP_ENCAP_ESPINUDP_NON_IKE:
-   encap_data-proto = AF_INET;
-   encap_data-saddr.a4 = iph-saddr;
-   encap_data-sport = uh-source;
-   encap_len = (void*)esph - (void*)uh;
-   break;
+   padlen = nexthdr[0];
+   if (padlen+2 = elen)
+   goto out;
 
-   default:
-   goto out;
-   }
-   }
+   /* ... check padding bits here. Silly. :-) */ 
+
+   if (x-encap  decap  decap-decap_type) {
+   struct esp_decap_data *encap_data;
+   struct udphdr *uh = (struct udphdr *) (iph+1);
+
+   encap_data = (struct esp_decap_data *) (decap-decap_data);
+   encap_data-proto = 0;
 
-   iph-protocol = nexthdr[1];
-   pskb_trim(skb, skb-len - alen - padlen - 2);
-   memcpy(workbuf, skb-nh.raw, iph-ihl*4);
-   skb-h.raw = skb_pull(skb, sizeof(struct ip_esp_hdr) + 
esp-conf.ivlen);
-   skb-nh.raw += encap_len + sizeof(struct ip_esp_hdr) + 
esp-conf.ivlen;
-   memcpy(skb-nh.raw, workbuf, iph-ihl*4);
-   skb-nh.iph-tot_len = htons(skb-len);
+   switch (decap-decap_type) {
+   case UDP_ENCAP_ESPINUDP:
+   case UDP_ENCAP_ESPINUDP_NON_IKE:
+   encap_data-proto = AF_INET;
+   encap_data-saddr.a4 = iph-saddr;
+   encap_data-sport = uh-source;
+   encap_len = (void*)esph - (void*)uh;
+   break;
+
+   default:
+   goto out;
+   }
}
 
+   iph-protocol = nexthdr[1];
+   pskb_trim(skb, skb-len - alen - padlen - 2);
+   

[2/2] [IPSEC]: Kill post_input hook and do NAT-T in esp_input directly

2006-02-24 Thread Herbert Xu
Hi Dave:

Here is the patch that kills the post_input stuff.

[IPSEC]: Kill post_input hook and do NAT-T in esp_input directly

The only reason post_input exists at all is that it gives us the
potential to adjust the checksums incrementally in future which
we ought to do.

However, after thinking about it for a bit we can adjust the
checksums without using this post_input stuff at all.  The crucial
point is that only the inner-most NAT-T SA needs to be considered
when adjusting checksums.  What's more, the checksum adjustment
comes down to a single u32 due to the linearity of IP checksums.

We just happen to have a spare u32 lying around in our skb structure :)
When ip_summed is set to CHECKSUM_NONE on input, the value of skb-csum
is currently unused.  All we have to do is to make that the checksum
adjustment and voila, there goes all the post_input and decap structures!

I've left in the decap data structures for now since it's intricately
woven into the sec_path stuff.  We can kill them later too.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -233,7 +233,6 @@ struct xfrm_type
int (*init_state)(struct xfrm_state *x);
void(*destructor)(struct xfrm_state *);
int (*input)(struct xfrm_state *, struct 
xfrm_decap_state *, struct sk_buff *skb);
-   int (*post_input)(struct xfrm_state *, struct 
xfrm_decap_state *, struct sk_buff *skb);
int (*output)(struct xfrm_state *, struct sk_buff 
*pskb);
/* Estimate maximal size of result of transformation of a dgram */
u32 (*get_max_size)(struct xfrm_state *, int size);
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -12,13 +12,6 @@
 #include net/protocol.h
 #include net/udp.h
 
-/* decapsulation data for use when post-processing */
-struct esp_decap_data {
-   xfrm_address_t  saddr;
-   __u16   sport;
-   __u8proto;
-};
-
 static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 {
int err;
@@ -210,25 +203,47 @@ static int esp_input(struct xfrm_state *
 
/* ... check padding bits here. Silly. :-) */ 
 
-   if (x-encap  decap  decap-decap_type) {
-   struct esp_decap_data *encap_data;
-   struct udphdr *uh = (struct udphdr *) (iph+1);
+   if (x-encap) {
+   struct xfrm_encap_tmpl *encap = x-encap;
+   struct udphdr *uh;
 
-   encap_data = (struct esp_decap_data *) (decap-decap_data);
-   encap_data-proto = 0;
+   if (encap-encap_type != decap-decap_type)
+   goto out;
 
-   switch (decap-decap_type) {
-   case UDP_ENCAP_ESPINUDP:
-   case UDP_ENCAP_ESPINUDP_NON_IKE:
-   encap_data-proto = AF_INET;
-   encap_data-saddr.a4 = iph-saddr;
-   encap_data-sport = uh-source;
-   encap_len = (void*)esph - (void*)uh;
-   break;
+   uh = (struct udphdr *)(iph + 1);
+   encap_len = (void*)esph - (void*)uh;
 
-   default:
-   goto out;
+   /*
+* 1) if the NAT-T peer's IP or port changed then
+*advertize the change to the keying daemon.
+*This is an inbound SA, so just compare
+*SRC ports.
+*/
+   if (iph-saddr != x-props.saddr.a4 ||
+   uh-source != encap-encap_sport) {
+   xfrm_address_t ipaddr;
+
+   ipaddr.a4 = iph-saddr;
+   km_new_mapping(x, ipaddr, uh-source);
+   
+   /* XXX: perhaps add an extra
+* policy check here, to see
+* if we should allow or
+* reject a packet from a
+* different source
+* address/port.
+*/
}
+   
+   /*
+* 2) ignore UDP/TCP checksums in case
+*of NAT-T in Transport Mode, or
+*perform other post-processing fixes
+*as per draft-ietf-ipsec-udp-encaps-06,
+*section 3.1.2
+*/
+   if (!x-props.mode)
+   skb-ip_summed = CHECKSUM_UNNECESSARY;
}
 
iph-protocol = nexthdr[1];
@@ -245,63 +260,6 @@ out:
return -EINVAL;