Re: [2.6 patch] net/ipv4/ipvs/: remove unused exports

2007-11-12 Thread David Miller
From: Adrian Bunk [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 08:58:36 +0100

 On Sun, Nov 11, 2007 at 04:09:40PM +0900, Simon Horman wrote:
  On Sun, Nov 11, 2007 at 07:48:40AM +0100, Adrian Bunk wrote:
   This patch removes the following unused EXPORT_SYMBOL's:
   - ip_vs_try_bind_dest
   - ip_vs_find_dest
   
   Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
  
  Looks fine to me.
  
  Should Dave Miller put this in his tree,
  or do you want to handle it a different way?
 ...
 
 If Dave applies it that would be perfect.

I will do this.
-
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] Use list_head-s in inetpeer.c

2007-11-12 Thread Pavel Emelyanov
David Miller wrote:
 From: Pavel Emelyanov [EMAIL PROTECTED]
 Date: Sat, 10 Nov 2007 17:32:58 +0300
 
 The inetpeer.c tracks the LRU list of inet_perr-s, but makes
 it by hands. Use the list_head-s for this.

 Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
 
 This makes every inetpeer struct consume 8 more bytes, and on some
 systems we have can have many of these objects active.  That space
 savings is why this was done the way it was.

No. I remove _two_ pointers unused_next and unused_prevp, and add
the list_head, which is _two_ pointers as well. I've even checked the
compilation on both i386 and x86_64 - the sizeof(struct inet_peer) 
is not changed.

You must have overlooked the unused_prevp member, because it is 
declared in the same line as the unused_next. Or I miss something else?

 It would be nice to have tailq like interfaces in linux/list.h
 for situations like this.
 
 Please do not submit a patch implementing that until the 2.6.25
 merge window, however, thanks.

If my explanation above is correct, should I delay this patch until
the 2.6.25 anyway?

Thanks,
Pavel
-
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] Use list_head-s in inetpeer.c

2007-11-12 Thread David Miller
From: Pavel Emelyanov [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 11:57:23 +0300

 No. I remove _two_ pointers unused_next and unused_prevp, and add
 the list_head, which is _two_ pointers as well. I've even checked the
 compilation on both i386 and x86_64 - the sizeof(struct inet_peer) 
 is not changed.
 
 You must have overlooked the unused_prevp member, because it is 
 declared in the same line as the unused_next. Or I miss something else?

I missed that, please resubmit your patch.

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] NET: Add the helper kernel_sock_shutdown()

2007-11-12 Thread David Howells
Trond Myklebust [EMAIL PROTECTED] wrote:

 take a SHUT_RD/SHUT_WR/SHUT_RDWR argument instead of the

Hmmm...  Why SHUT_*?  Why not SHUTDOWN_*?

David
-
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] NET: Add the helper kernel_sock_shutdown()

2007-11-12 Thread Trond Myklebust

On Mon, 2007-11-12 at 12:22 +, David Howells wrote:
 Trond Myklebust [EMAIL PROTECTED] wrote:
 
  take a SHUT_RD/SHUT_WR/SHUT_RDWR argument instead of the
 
 Hmmm...  Why SHUT_*?  Why not SHUTDOWN_*?

SHUT_RD/SHUT_WR/SHUT_RDWR are the traditional names for these constants
(see 'man 3 shutdown') and so should be easier to remember. I didn't
however feel comfortable naming the function kernel_shutdown() or
shutdown(), since those have other connotations, hence
kernel_sock_shutdown().

-
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] (resubmit) Use list_head-s in inetpeer.c

2007-11-12 Thread Pavel Emelyanov
The inetpeer.c tracks the LRU list of inet_perr-s, but makes
it by hands. Use the list_head-s for this.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]

---

diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index aa10a81..ad8404b 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,7 +22,7 @@ struct inet_peer
__be32  v4daddr;/* peer's address */
__u16   avl_height;
__u16   ip_id_count;/* IP ID for the next packet */
-   struct inet_peer*unused_next, **unused_prevp;
+   struct list_headunused;
__u32   dtime;  /* the time of last use of not
 * referenced entries */
atomic_trefcnt;
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 771031d..af99519 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -61,7 +61,7 @@
  *  4.  Global variable peer_total is modified under the pool lock.
  *  5.  struct inet_peer fields modification:
  * avl_left, avl_right, avl_parent, avl_height: pool lock
- * unused_next, unused_prevp: unused node list lock
+ * unused: unused node list lock
  * refcnt: atomically against modifications on other CPU;
  *usually under some other lock to prevent node disappearing
  * dtime: unused node list lock
@@ -94,8 +94,7 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ;/* 
usual time to live: 10 min
 int inet_peer_gc_mintime __read_mostly = 10 * HZ;
 int inet_peer_gc_maxtime __read_mostly = 120 * HZ;
 
-static struct inet_peer *inet_peer_unused_head;
-static struct inet_peer **inet_peer_unused_tailp = inet_peer_unused_head;
+static LIST_HEAD(unused_peers);
 static DEFINE_SPINLOCK(inet_peer_unused_lock);
 
 static void peer_check_expire(unsigned long dummy);
@@ -138,15 +137,7 @@ void __init inet_initpeers(void)
 static void unlink_from_unused(struct inet_peer *p)
 {
spin_lock_bh(inet_peer_unused_lock);
-   if (p-unused_prevp != NULL) {
-   /* On unused list. */
-   *p-unused_prevp = p-unused_next;
-   if (p-unused_next != NULL)
-   p-unused_next-unused_prevp = p-unused_prevp;
-   else
-   inet_peer_unused_tailp = p-unused_prevp;
-   p-unused_prevp = NULL; /* mark it as removed */
-   }
+   list_del_init(p-unused);
spin_unlock_bh(inet_peer_unused_lock);
 }
 
@@ -337,24 +328,24 @@ static void unlink_from_pool(struct inet_peer *p)
 /* May be called with local BH enabled. */
 static int cleanup_once(unsigned long ttl)
 {
-   struct inet_peer *p;
+   struct inet_peer *p = NULL;
 
/* Remove the first entry from the list of unused nodes. */
spin_lock_bh(inet_peer_unused_lock);
-   p = inet_peer_unused_head;
-   if (p != NULL) {
-   __u32 delta = (__u32)jiffies - p-dtime;
+   if (!list_empty(unused_peers)) {
+   __u32 delta;
+
+   p = list_first_entry(unused_peers, struct inet_peer, unused);
+   delta = (__u32)jiffies - p-dtime;
+
if (delta  ttl) {
/* Do not prune fresh entries. */
spin_unlock_bh(inet_peer_unused_lock);
return -1;
}
-   inet_peer_unused_head = p-unused_next;
-   if (p-unused_next != NULL)
-   p-unused_next-unused_prevp = p-unused_prevp;
-   else
-   inet_peer_unused_tailp = p-unused_prevp;
-   p-unused_prevp = NULL; /* mark as not on the list */
+
+   list_del_init(p-unused);
+
/* Grab an extra reference to prevent node disappearing
 * before unlink_from_pool() call. */
atomic_inc(p-refcnt);
@@ -412,7 +403,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
 
/* Link the node. */
link_to_pool(n);
-   n-unused_prevp = NULL; /* not on the list */
+   INIT_LIST_HEAD(n-unused);
peer_total++;
write_unlock_bh(peer_pool_lock);
 
@@ -467,10 +458,7 @@ void inet_putpeer(struct inet_peer *p)
 {
spin_lock_bh(inet_peer_unused_lock);
if (atomic_dec_and_test(p-refcnt)) {
-   p-unused_prevp = inet_peer_unused_tailp;
-   p-unused_next = NULL;
-   *inet_peer_unused_tailp = p;
-   inet_peer_unused_tailp = p-unused_next;
+   list_add_tail(p-unused, unused_peers);
p-dtime = (__u32)jiffies;
}
spin_unlock_bh(inet_peer_unused_lock);
-
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] NET: Add the helper kernel_sock_shutdown()

2007-11-12 Thread David Howells
Trond Myklebust [EMAIL PROTECTED] wrote:

 SHUT_RD/SHUT_WR/SHUT_RDWR are the traditional names for these constants
 (see 'man 3 shutdown') and so should be easier to remember.

Good point.

David
-
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: [Lksctp-developers] [PATCH] Fix memory leak in discard case of sctp_sf_abort_violation()

2007-11-12 Thread Vlad Yasevich
Jesper Juhl wrote:
 From: Jesper Juhl [EMAIL PROTECTED]
 
 In net/sctp/sm_statefuns.c::sctp_sf_abort_violation() we may leak 
 the storage allocated for 'abort' by returning from the function 
 without using or freeing it. This happens in case 
 sctp_auth_recv_cid(SCTP_CID_ABORT, asoc) is true and we jump to 
 the 'discard' label.
 Spotted by the Coverity checker.
 
 The simple fix is to simply move the creation of the abort chunk 
 to after the possible jump to the 'discard' label. This way we don't   
 even have to allocate the memory at all in the problem case.
 
 
 Signed-off-by: Jesper Juhl [EMAIL PROTECTED]

Thanks.  I've applied this to my tree.

-vlad
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Daniel Lezcano
The loopback is now dynamically allocated. The ipv6 code was written
considering the loopback is allocated before the ipv6 protocol 
initialization. This is still the case when we don't use multiple
network namespaces.

In the case of the network namespaces, ipv6 notification handler is
already setup and active (done by the initial network namespace), 
so when a network namespace is created, a new instance of the 
loopback device, via dynamic allocation, will trigger a REGISTER event
to addrconf_notify and this one will try to setup the network device
while the ipv6 protocol is not yet initialized for the network namespace.

Because the ipv6 is relying on the fact that the loopback device will
not trigger REGISTER/UNREGISTER events, I just protect the addrconf_notify
function when the loopback register event is triggered.

In the case of multiple network namespaces, the usual ipv6 protocol 
initialization will be done after the loopback initialization with 
the subsystem registration mechanism.

Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
---
 net/ipv6/addrconf.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-netns/net/ipv6/addrconf.c
===
--- linux-2.6-netns.orig/net/ipv6/addrconf.c
+++ linux-2.6-netns/net/ipv6/addrconf.c
@@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
 
switch(event) {
case NETDEV_REGISTER:
-   if (!idev  dev-mtu = IPV6_MIN_MTU) {
+   if (!(dev-flags  IFF_LOOPBACK) 
+   !idev  dev-mtu = IPV6_MIN_MTU) {
idev = ipv6_add_dev(dev);
if (!idev)
return notifier_from_errno(-ENOMEM);
@@ -2366,11 +2367,15 @@ static int addrconf_notify(struct notifi
/* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. 
*/
 
case NETDEV_DOWN:
+   addrconf_ifdown(dev, 0);
+   break;
+
case NETDEV_UNREGISTER:
/*
 *  Remove all addresses from this interface.
 */
-   addrconf_ifdown(dev, event != NETDEV_DOWN);
+   if (!(dev-flags  IFF_LOOPBACK))
+   addrconf_ifdown(dev, 1);
break;
 
case NETDEV_CHANGENAME:

-- 
-
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


Problem with frame time stamping

2007-11-12 Thread Antoine Zen-Ruffinen
Dear all,

I'm writing a network analyzer software using Linux and I need a VERY
precise frame time stamping. Therefor I am planing to add my own time
stamping algorithm on a modified network driver. For test purpose I
did so :

skb-tstamp.tv64 = 0x00010002;
netif_rx(skb);

On the user side, I ask for the timestamp that way :

...
sock = socket(AF_PACKET, SOCK_RAW, type);
...
//bind this socket with the interface using my modified driver.
...
recvByteCount = recv(sock, buffer, 1514, 0);
ioctl(sock, SIOCGSTAMP, timeStamp);

I was surprised to see that the var timeStamp was still holding a
count of second since  year 1970.

Investigating a bit into the kernel code, I found that ioctl(sock,
SIOCGSTAMP, ...) was giving just the current kernel time using
ktime_get_real().

Are my investigation wrong ?
Is that a bug in kernel code ?
Is there an other way to access skb.tstamp from user side ?

Thank's to any one that can help me !

Antoine Zen-Ruffinen
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Denis V. Lunev
Daniel Lezcano wrote:
 The loopback is now dynamically allocated. The ipv6 code was written
 considering the loopback is allocated before the ipv6 protocol 
 initialization. This is still the case when we don't use multiple
 network namespaces.
 
 In the case of the network namespaces, ipv6 notification handler is
 already setup and active (done by the initial network namespace), 
 so when a network namespace is created, a new instance of the 
 loopback device, via dynamic allocation, will trigger a REGISTER event
 to addrconf_notify and this one will try to setup the network device
 while the ipv6 protocol is not yet initialized for the network namespace.
 
 Because the ipv6 is relying on the fact that the loopback device will
 not trigger REGISTER/UNREGISTER events, I just protect the addrconf_notify
 function when the loopback register event is triggered.
 
 In the case of multiple network namespaces, the usual ipv6 protocol 
 initialization will be done after the loopback initialization with 
 the subsystem registration mechanism.
 
 Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
 Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
 ---
  net/ipv6/addrconf.c |9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 Index: linux-2.6-netns/net/ipv6/addrconf.c
 ===
 --- linux-2.6-netns.orig/net/ipv6/addrconf.c
 +++ linux-2.6-netns/net/ipv6/addrconf.c
 @@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
  
   switch(event) {
   case NETDEV_REGISTER:
 - if (!idev  dev-mtu = IPV6_MIN_MTU) {
 + if (!(dev-flags  IFF_LOOPBACK) 
 + !idev  dev-mtu = IPV6_MIN_MTU) {
   idev = ipv6_add_dev(dev);
   if (!idev)
   return notifier_from_errno(-ENOMEM);
 @@ -2366,11 +2367,15 @@ static int addrconf_notify(struct notifi
   /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. 
 */
  
   case NETDEV_DOWN:
 + addrconf_ifdown(dev, 0);
 + break;
 +
   case NETDEV_UNREGISTER:
   /*
*  Remove all addresses from this interface.
*/
 - addrconf_ifdown(dev, event != NETDEV_DOWN);
 + if (!(dev-flags  IFF_LOOPBACK))
 + addrconf_ifdown(dev, 1);
   break;
  
   case NETDEV_CHANGENAME:
 

why should we care on down? we are destroying the device. It should
gone. All references to it should also gone. So, we should perform the
cleaning and remove all IPv6 addresses, so notifier should also work.

The code relies on the persistent loopback and this is a _bad_ thing.
This is longstanding bug in the code, that the dst_entry should have a
valid reference to a device. This is the only purpose for a loopback
persistence. Though, at the namespace death no such entries must be and
this will be checked during unregister process. This patch definitely
breaks this assumption :(

Namespaces are good to catch leakage using standard codepaths, so they
should be preserved as much as possible. So, _all_ normal down code
should be called for a loopback device in other than init_net context.

Regards,
Den
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Daniel Lezcano

Denis V. Lunev wrote:

Daniel Lezcano wrote:

The loopback is now dynamically allocated. The ipv6 code was written
considering the loopback is allocated before the ipv6 protocol 
initialization. This is still the case when we don't use multiple

network namespaces.

In the case of the network namespaces, ipv6 notification handler is
already setup and active (done by the initial network namespace), 
so when a network namespace is created, a new instance of the 
loopback device, via dynamic allocation, will trigger a REGISTER event

to addrconf_notify and this one will try to setup the network device
while the ipv6 protocol is not yet initialized for the network namespace.

Because the ipv6 is relying on the fact that the loopback device will
not trigger REGISTER/UNREGISTER events, I just protect the addrconf_notify
function when the loopback register event is triggered.

In the case of multiple network namespaces, the usual ipv6 protocol 
initialization will be done after the loopback initialization with 
the subsystem registration mechanism.


Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
---
 net/ipv6/addrconf.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6-netns/net/ipv6/addrconf.c
===
--- linux-2.6-netns.orig/net/ipv6/addrconf.c
+++ linux-2.6-netns/net/ipv6/addrconf.c
@@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
 
 	switch(event) {

case NETDEV_REGISTER:
-   if (!idev  dev-mtu = IPV6_MIN_MTU) {
+   if (!(dev-flags  IFF_LOOPBACK) 
+   !idev  dev-mtu = IPV6_MIN_MTU) {
idev = ipv6_add_dev(dev);
if (!idev)
return notifier_from_errno(-ENOMEM);
@@ -2366,11 +2367,15 @@ static int addrconf_notify(struct notifi
/* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. 
*/
 
 	case NETDEV_DOWN:

+   addrconf_ifdown(dev, 0);
+   break;
+
case NETDEV_UNREGISTER:
/*
 *  Remove all addresses from this interface.
 */
-   addrconf_ifdown(dev, event != NETDEV_DOWN);
+   if (!(dev-flags  IFF_LOOPBACK))
+   addrconf_ifdown(dev, 1);
break;
 
 	case NETDEV_CHANGENAME:




why should we care on down? we are destroying the device. It should
gone. All references to it should also gone. So, we should perform the
cleaning and remove all IPv6 addresses, so notifier should also work.


We need to take care of netdev down, someone can put the loopback down 
if he wants.



The code relies on the persistent loopback and this is a _bad_ thing.
This is longstanding bug in the code, that the dst_entry should have a
valid reference to a device. This is the only purpose for a loopback
persistence. Though, at the namespace death no such entries must be and
this will be checked during unregister process. This patch definitely
breaks this assumption :(

Namespaces are good to catch leakage using standard codepaths, so they
should be preserved as much as possible. So, _all_ normal down code
should be called for a loopback device in other than init_net context.


I agree with you, this is a bug in ipv6 and the loopback; when playing 
with ipv6 we found that the loopback is still referenced 9 times when 
the system is shutdown.


The purpose of this patch is to protect the __actual__ code from the new 
loopback behavior. We are looking at a more generic approach with the 
namespace for ipv6, as you mentioned, namespaces are good for network 
leakage detection as we create several instances of the network stack.

-
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


Possible bug in bonding

2007-11-12 Thread Moni Shoua

Hi,

As reported last week by Or Gerlitz and confirmed by me, there is a kernel 
crash 
when trying to unenslave all ib slaves (which leads to bonding master 
destruction).
I also found that it happens with Ethernet slaves if following the steps:

1. unenslaving all slaves via sysfs
2. deleting the bonding master via sysfs


I see that in commit 6603a6f25e4bca922a7dfbf0bf03072d98850176 
the order of the bonding master destruction sequence was changed 
in 2 places (a part of the commitdiff is below).

Although I might be missing something it looks like a bug to me
to dereference the dev pointer after unregistering it. Am I right?

I also see that the kernel crash doesn't happen when reverting from this 
(part of) the patch.

I'd like to have your opinion please.

thanks
 
MoniS

-

commit 6603a6f25e4bca922a7dfbf0bf03072d98850176
Author: Jay Vosburgh [EMAIL PROTECTED]
Date:   Wed Oct 17 17:37:50 2007 -0700

bonding: Convert more locks to _bh, acquire rtnl, for new locking

Convert more lock acquisitions to _bh flavor to avoid deadlock
with workqueue activity and add acquisition of RTNL in appropriate places.
Affects ALB mode, as well as core bonding functions and sysfs.

Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
Signed-off-by: Jay Vosburgh [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]


--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1846,9 +1846,9 @@ int bond_release(struct net_device *bond
 */
 void bond_destroy(struct bonding *bond)
 {
+   unregister_netdevice(bond-dev);
bond_deinit(bond-dev);
bond_destroy_sysfs_entry(bond);
-   unregister_netdevice(bond-dev);
 }

.
.
.

@@ -4473,8 +4473,8 @@ static void bond_free_all(void)
bond_mc_list_destroy(bond);
/* Release the bonded slaves */
bond_release_all(bond_dev);
-   bond_deinit(bond_dev);
unregister_netdevice(bond_dev);
+   bond_deinit(bond_dev);
}
 
 

-
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


[GIT PATCHES v2] SCTP bug fixes

2007-11-12 Thread Vlad Yasevich
Hi David

I've updated the series of SCTP bugfixes.  These pass all of the regression
tests.

You can pull the changes from:
 master.kernel.org:/pub/scm/linux/kernel/git/vxy/lksctp-dev.git pending

Summary of changes:

Jesper Juhl (1):
  Fix memory leak in discard case of sctp_sf_abort_violation()

Vlad Yasevich (11):
  SCTP: Fix difference cases of retransmit.
  SCTP: Update RCU handling during the ADD-IP case
  SCTP: Correctly disable ADD-IP when AUTH is not supported.
  SCTP: Allow ADD_IP to work with AUTH for backward compatibility.
  SCTP: Fix a potential race between timers and receive path.
  SCTP: Use hashed lookup when looking for an association.
  SCTP: Convert custom hash lists to use hlist.
  SCTP: Make sctp_verify_param return multiple indications.
  SCTP: Fix PR-SCTP to deliver all the accumulated ordered chunks
  SCTP: Clean-up some defines for regressions tests.
  SCTP: Always flush the queue when uncorcking.

Wei Yongjun (2):
  SCTP : Fix bad formatted comment in outqueue.c
  SCTP : Fix to process bundled ASCONF chunk correctly

 include/net/sctp/command.h   |1 +
 include/net/sctp/constants.h |3 +
 include/net/sctp/sctp.h  |5 +-
 include/net/sctp/structs.h   |   22 +++---
 net/sctp/associola.c |   10 ++-
 net/sctp/bind_addr.c |   13 +---
 net/sctp/endpointola.c   |   35 ++---
 net/sctp/input.c |   43 +++
 net/sctp/inqueue.c   |4 +
 net/sctp/outqueue.c  |   41 +-
 net/sctp/proc.c  |6 +-
 net/sctp/protocol.c  |7 +-
 net/sctp/sm_make_chunk.c |  170 ++---
 net/sctp/sm_sideeffect.c |   10 ++-
 net/sctp/sm_statefuns.c  |   12 ++--
 net/sctp/socket.c|   16 ++---
 net/sctp/sysctl.c|9 ++
 net/sctp/transport.c |5 +-
 net/sctp/ulpqueue.c  |2 +-
 19 files changed, 220 insertions(+), 194 deletions(-)



-
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 01/14] SCTP : Fix bad formatted comment in outqueue.c

2007-11-12 Thread Vlad Yasevich
From: Wei Yongjun [EMAIL PROTECTED]

Just fix the bad format of the comment in outqueue.c.

Signed-off-by: Wei Yongjun [EMAIL PROTECTED]
Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/outqueue.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 28f4fe7..e315c6c 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -641,7 +641,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct 
sctp_packet *pkt,
 
/* If we are here due to a retransmit timeout or a fast
 * retransmit and if there are any chunks left in the retransmit
-* queue that could not fit in the PMTU sized packet, they need 
 * to be marked as ineligible for a subsequent fast retransmit.
+* queue that could not fit in the PMTU sized packet, they need
+* to be marked as ineligible for a subsequent fast retransmit.
 */
if (rtx_timeout  !lchunk) {
list_for_each(lchunk1, lqueue) {
-- 
1.5.2.4

-
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 04/14] SCTP: Update RCU handling during the ADD-IP case

2007-11-12 Thread Vlad Yasevich
After learning more about rcu, it looks like the ADD-IP hadling
doesn't need to call call_rcu_bh.  All the rcu critical sections
use rcu_read_lock, so using call_rcu_bh is wrong here.
Now, restore the local_bh_disable() code blocks and use normal
call_rcu() calls.  Also restore the missing return statement.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/structs.h |4 +---
 net/sctp/bind_addr.c   |   13 +++--
 net/sctp/sm_make_chunk.c   |6 +-
 net/sctp/socket.c  |2 +-
 4 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 482c2aa..a177017 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1185,9 +1185,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
int flags);
 int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
   __u8 use_as_src, gfp_t gfp);
-int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
-   void fastcall (*rcu_call)(struct rcu_head *,
- void (*func)(struct rcu_head *)));
+int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
 struct sctp_sock *);
 union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr  *bp,
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index dfffa94..cae95af 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -180,9 +180,7 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union 
sctp_addr *new,
 /* Delete an address from the bind address list in the SCTP_bind_addr
  * structure.
  */
-int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr,
-   void fastcall (*rcu_call)(struct rcu_head *head,
-void (*func)(struct rcu_head *head)))
+int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
 {
struct sctp_sockaddr_entry *addr, *temp;
 
@@ -198,15 +196,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union 
sctp_addr *del_addr,
}
}
 
-   /* Call the rcu callback provided in the args.  This function is
-* called by both BH packet processing and user side socket option
-* processing, but it works on different lists in those 2 contexts.
-* Each context provides it's own callback, whether call_rcu_bh()
-* or call_rcu(), to make sure that we wait for an appropriate time.
-*/
if (addr  !addr-valid) {
-   rcu_call(addr-rcu, sctp_local_addr_free);
+   call_rcu(addr-rcu, sctp_local_addr_free);
SCTP_DBG_OBJCNT_DEC(addr);
+   return 0;
}
 
return -EINVAL;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 5de4729..c60564d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2953,13 +2953,17 @@ static int sctp_asconf_param_success(struct 
sctp_association *asoc,
/* This is always done in BH context with a socket lock
 * held, so the list can not change.
 */
+   local_bh_disable();
list_for_each_entry(saddr, bp-address_list, list) {
if (sctp_cmp_addr_exact(saddr-a, addr))
saddr-use_as_src = 1;
}
+   local_bh_enable();
break;
case SCTP_PARAM_DEL_IP:
-   retval = sctp_del_bind_addr(bp, addr, call_rcu_bh);
+   local_bh_disable();
+   retval = sctp_del_bind_addr(bp, addr);
+   local_bh_enable();
list_for_each(pos, asoc-peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport,
 transports);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a7ecf31..6ce9b49 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -660,7 +660,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr 
*addrs, int addrcnt)
 * socket routing and failover schemes. Refer to comments in
 * sctp_do_bind(). -daisy
 */
-   retval = sctp_del_bind_addr(bp, sa_addr, call_rcu);
+   retval = sctp_del_bind_addr(bp, sa_addr);
 
addr_buf += af-sockaddr_len;
 err_bindx_rem:
-- 
1.5.2.4

-
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 03/14] SCTP: Fix difference cases of retransmit.

2007-11-12 Thread Vlad Yasevich
Commit d0ce92910bc04e107b2f3f2048f07e94f570035d broke several retransmit
cases including fast retransmit.  The reason is that we should
only delay by rto while doing retranmists as a result of a timeout.
Retransmit as a result of path mtu discover, fast retransmit, or
other evernts that should trigger immidiate retransmissions got broken.

Also, since rto is doubled prior to marking of packets elegable for
retransmission, we never marked correct chunks anyway.

The fix is provide a reason for a given retransmission so that we
can mark chunks appropriately and to save the old rto value to do
comparisons against.

All regressions tests passed with this code.

Spotted by Wei Yongjun [EMAIL PROTECTED]

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/command.h   |1 +
 include/net/sctp/constants.h |1 +
 include/net/sctp/sctp.h  |1 +
 include/net/sctp/structs.h   |5 +++--
 net/sctp/outqueue.c  |   33 +
 net/sctp/sm_sideeffect.c |   10 +-
 net/sctp/sm_statefuns.c  |2 +-
 net/sctp/transport.c |5 +++--
 8 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index b873336..c1f7976 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -103,6 +103,7 @@ typedef enum {
SCTP_CMD_ASSOC_CHANGE,   /* generate and send assoc_change event */
SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
SCTP_CMD_ASSOC_SHKEY,/* generate the association shared keys */
+   SCTP_CMD_T1_RETRAN,  /* Mark for retransmission after T1 timeout  */
SCTP_CMD_LAST
 } sctp_verb_t;
 
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index da8354e..73fbdf6 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -407,6 +407,7 @@ typedef enum {
SCTP_RTXR_T3_RTX,
SCTP_RTXR_FAST_RTX,
SCTP_RTXR_PMTUD,
+   SCTP_RTXR_T1_RTX,
 } sctp_retransmit_reason_t;
 
 /* Reasons to lower cwnd. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 93eb708..7082730 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -267,6 +267,7 @@ enum
SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
SCTP_MIB_DELAY_SACK_EXPIREDS,
SCTP_MIB_AUTOCLOSE_EXPIREDS,
+   SCTP_MIB_T1_RETRANSMITS,
SCTP_MIB_T3_RETRANSMITS,
SCTP_MIB_PMTUD_RETRANSMITS,
SCTP_MIB_FAST_RETRANSMITS,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ef892e0..482c2aa 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -873,10 +873,11 @@ struct sctp_transport {
 * address list derived from the INIT or INIT ACK chunk, a
 * number of data elements needs to be maintained including:
 */
-   __u32 rtt;  /* This is the most recent RTT.  */
-
/* RTO : The current retransmission timeout value.  */
unsigned long rto;
+   unsigned long last_rto;
+
+   __u32 rtt;  /* This is the most recent RTT.  */
 
/* RTTVAR  : The current RTT variation.  */
__u32 rttvar;
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index e315c6c..99a3db5 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -382,7 +382,7 @@ static void sctp_insert_list(struct list_head *head, struct 
list_head *new)
 /* Mark all the eligible packets on a transport for retransmission.  */
 void sctp_retransmit_mark(struct sctp_outq *q,
  struct sctp_transport *transport,
- __u8 fast_retransmit)
+ __u8 reason)
 {
struct list_head *lchunk, *ltemp;
struct sctp_chunk *chunk;
@@ -412,20 +412,20 @@ void sctp_retransmit_mark(struct sctp_outq *q,
continue;
}
 
-   /* If we are doing retransmission due to a fast retransmit,
-* only the chunk's that are marked for fast retransmit
-* should be added to the retransmit queue.  If we are doing
-* retransmission due to a timeout or pmtu discovery, only the
-* chunks that are not yet acked should be added to the
-* retransmit queue.
+   /* If we are doing  retransmission due to a timeout or pmtu
+* discovery, only the  chunks that are not yet acked should
+* be added to the retransmit queue.
 */
-   if ((fast_retransmit  (chunk-fast_retransmit  0)) ||
-  (!fast_retransmit  !chunk-tsn_gap_acked)) {
+   if ((reason == SCTP_RTXR_FAST_RTX  
+   (chunk-fast_retransmit  0)) ||
+   (reason != SCTP_RTXR_FAST_RTX   !chunk-tsn_gap_acked)) {
/* If this chunk was sent less then 1 rto ago, do not
   

[PATCH 07/14] SCTP: Fix a potential race between timers and receive path.

2007-11-12 Thread Vlad Yasevich
There is a possible race condition where the timer code will
free the association and the next packet in the queue will also
attempt to free the same association.

The example is, when we receive an ABORT at about the same time
as the retransmission timer fires.  If the timer wins the race,
it will free the association.  Once it releases the lock, the
queue processing will recieve the ABORT and will try to free
the association again.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/inqueue.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index f10fe7f..cf4b7eb 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -90,6 +90,10 @@ void sctp_inq_free(struct sctp_inq *queue)
 void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
 {
/* Directly call the packet handling routine. */
+   if (chunk-rcvr-dead) {
+   sctp_chunk_free(chunk);
+   return;
+   }
 
/* We are now calling this either from the soft interrupt
 * or from the backlog processing.
-- 
1.5.2.4

-
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 06/14] SCTP: Allow ADD_IP to work with AUTH for backward compatibility.

2007-11-12 Thread Vlad Yasevich
This patch adds a tunable that will allow ADD_IP to work without
AUTH for backward compatibility.  The default value is off since
the default value for ADD_IP is off as well.  People who need
to use ADD-IP with older implementations take risks of connection
hijacking and should consider upgrading or turning this tunable on.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/structs.h |2 ++
 net/sctp/associola.c   |8 ++--
 net/sctp/protocol.c|1 +
 net/sctp/sm_make_chunk.c   |4 +++-
 net/sctp/sysctl.c  |9 +
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 41f1039..44f2672 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -212,6 +212,7 @@ extern struct sctp_globals {

/* Flag to indicate if addip is enabled. */
int addip_enable;
+   int addip_noauth_enable;
 
/* Flag to indicate if PR-SCTP is enabled. */
int prsctp_enable;
@@ -249,6 +250,7 @@ extern struct sctp_globals {
 #define sctp_local_addr_list   (sctp_globals.local_addr_list)
 #define sctp_local_addr_lock   (sctp_globals.addr_list_lock)
 #define sctp_addip_enable  (sctp_globals.addip_enable)
+#define sctp_addip_noauth  (sctp_globals.addip_noauth_enable)
 #define sctp_prsctp_enable (sctp_globals.prsctp_enable)
 #define sctp_auth_enable   (sctp_globals.auth_enable)
 
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index eaad5c5..013e3d3 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -262,10 +262,14 @@ static struct sctp_association 
*sctp_association_init(struct sctp_association *a
 */
asoc-peer.sack_needed = 1;
 
-   /* Assume that the peer recongizes ASCONF until reported otherwise
-* via an ERROR chunk.
+   /* Assume that the peer will tell us if he recognizes ASCONF
+* as part of INIT exchange.
+* The sctp_addip_noauth option is there for backward compatibilty
+* and will revert old behavior.
 */
asoc-peer.asconf_capable = 0;
+   if (sctp_addip_noauth)
+   asoc-peer.asconf_capable = 1;
 
/* Create an input queue.  */
sctp_inq_init(asoc-base.inqueue);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 40c1a47..ecfab03 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1179,6 +1179,7 @@ SCTP_STATIC __init int sctp_init(void)
 
/* Disable ADDIP by default. */
sctp_addip_enable = 0;
+   sctp_addip_noauth = 0;
 
/* Enable PR-SCTP by default. */
sctp_prsctp_enable = 1;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 2ff3a3d..43e8de1 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2137,8 +2137,10 @@ int sctp_process_init(struct sctp_association *asoc, 
sctp_cid_t cid,
 
/* If the peer claims support for ADD-IP without support
 * for AUTH, disable support for ADD-IP.
+* Do this only if backward compatible mode is turned off.
 */
-   if (asoc-peer.asconf_capable  !asoc-peer.auth_capable) {
+   if (!sctp_addip_noauth 
+(asoc-peer.asconf_capable  !asoc-peer.auth_capable)) {
asoc-peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP |
  SCTP_PARAM_DEL_IP |
  SCTP_PARAM_SET_PRIMARY);
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 0669778..da4f157 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -263,6 +263,15 @@ static ctl_table sctp_table[] = {
.proc_handler   = proc_dointvec,
.strategy   = sysctl_intvec
},
+   {
+   .ctl_name   = CTL_UNNUMBERED,
+   .procname   = addip_noauth_enable,
+   .data   = sctp_addip_noauth,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec,
+   .strategy   = sysctl_intvec
+   },
{ .ctl_name = 0 }
 };
 
-- 
1.5.2.4

-
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 05/14] SCTP: Correctly disable ADD-IP when AUTH is not supported.

2007-11-12 Thread Vlad Yasevich
Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/structs.h |1 -
 net/sctp/associola.c   |2 +-
 net/sctp/sm_make_chunk.c   |5 +++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index a177017..41f1039 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1540,7 +1540,6 @@ struct sctp_association {
__u8asconf_capable;  /* Does peer support ADDIP? */
__u8prsctp_capable;  /* Can peer do PR-SCTP? */
__u8auth_capable;/* Is peer doing SCTP-AUTH? */
-   __u8addip_capable;   /* Can peer do ADD-IP */
 
__u32   adaptation_ind;  /* Adaptation Code point. */
 
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 03158e3..eaad5c5 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -265,7 +265,7 @@ static struct sctp_association 
*sctp_association_init(struct sctp_association *a
/* Assume that the peer recongizes ASCONF until reported otherwise
 * via an ERROR chunk.
 */
-   asoc-peer.asconf_capable = 1;
+   asoc-peer.asconf_capable = 0;
 
/* Create an input queue.  */
sctp_inq_init(asoc-base.inqueue);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index c60564d..2ff3a3d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1847,7 +1847,7 @@ static void sctp_process_ext_param(struct 
sctp_association *asoc,
break;
case SCTP_CID_ASCONF:
case SCTP_CID_ASCONF_ACK:
-   asoc-peer.addip_capable = 1;
+   asoc-peer.asconf_capable = 1;
break;
default:
break;
@@ -2138,10 +2138,11 @@ int sctp_process_init(struct sctp_association *asoc, 
sctp_cid_t cid,
/* If the peer claims support for ADD-IP without support
 * for AUTH, disable support for ADD-IP.
 */
-   if (asoc-peer.addip_capable  !asoc-peer.auth_capable) {
+   if (asoc-peer.asconf_capable  !asoc-peer.auth_capable) {
asoc-peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP |
  SCTP_PARAM_DEL_IP |
  SCTP_PARAM_SET_PRIMARY);
+   asoc-peer.asconf_capable = 0;
}
 
/* Walk list of transports, removing transports in the UNKNOWN state. */
-- 
1.5.2.4

-
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 08/14] SCTP: Use hashed lookup when looking for an association.

2007-11-12 Thread Vlad Yasevich
A SCTP endpoint may have a lot of associations on them and walking
the list is fairly inefficient.  Instead, use a hashed lookup,
and filter out the hash list based on the endopoing we already have.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/endpointola.c |   34 ++
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 2d2d81e..68f0556 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -328,24 +328,34 @@ static struct sctp_association 
*__sctp_endpoint_lookup_assoc(
const union sctp_addr *paddr,
struct sctp_transport **transport)
 {
+   struct sctp_association *asoc = NULL;
+   struct sctp_transport *t = NULL;
+   struct sctp_hashbucket *head;
+   struct sctp_ep_common *epb;
+   int hash;
int rport;
-   struct sctp_association *asoc;
-   struct list_head *pos;
 
+   *transport = NULL;
rport = ntohs(paddr-v4.sin_port);
 
-   list_for_each(pos, ep-asocs) {
-   asoc = list_entry(pos, struct sctp_association, asocs);
-   if (rport == asoc-peer.port) {
-   *transport = sctp_assoc_lookup_paddr(asoc, paddr);
-
-   if (*transport)
-   return asoc;
+   hash = sctp_assoc_hashfn(ep-base.bind_addr.port, rport);
+   head = sctp_assoc_hashtable[hash];
+   read_lock(head-lock);
+   for (epb = head-chain; epb; epb = epb-next) {
+   asoc = sctp_assoc(epb);
+   if (asoc-ep != ep || rport != asoc-peer.port)
+   goto next;
+
+   t = sctp_assoc_lookup_paddr(asoc, paddr);
+   if (t) {
+   *transport = t;
+   break;
}
+next:
+   asoc = NULL;
}
-
-   *transport = NULL;
-   return NULL;
+   read_unlock(head-lock);
+   return asoc;
 }
 
 /* Lookup association on an endpoint based on a peer address.  BH-safe.  */
-- 
1.5.2.4

-
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 02/14] SCTP : Fix to process bundled ASCONF chunk correctly

2007-11-12 Thread Vlad Yasevich
From: Wei Yongjun [EMAIL PROTECTED]

If ASCONF chunk is bundled with other chunks as the first chunk, when
process the ASCONF parameters, full packet data will be process as the
parameters of the ASCONF chunk, not only the real parameters. So if you
send a ASCONF chunk bundled with other chunks, you will get an unexpect
result.
This problem also exists when ASCONF-ACK chunk is bundled with other chunks.

This patch fix this problem.

Signed-off-by: Wei Yongjun [EMAIL PROTECTED]
Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/sm_make_chunk.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index c377e4e..5de4729 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2848,10 +2848,11 @@ struct sctp_chunk *sctp_process_asconf(struct 
sctp_association *asoc,
 
__be16  err_code;
int length = 0;
-   int chunk_len = asconf-skb-len;
+   int chunk_len;
__u32   serial;
int all_param_pass = 1;
 
+   chunk_len = ntohs(asconf-chunk_hdr-length) - sizeof(sctp_chunkhdr_t);
hdr = (sctp_addiphdr_t *)asconf-skb-data;
serial = ntohl(hdr-serial);
 
@@ -2990,7 +2991,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk 
*asconf_ack,
sctp_addip_param_t  *asconf_ack_param;
sctp_errhdr_t   *err_param;
int length;
-   int asconf_ack_len = asconf_ack-skb-len;
+   int asconf_ack_len;
__be16  err_code;
 
if (no_err)
@@ -2998,6 +2999,9 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk 
*asconf_ack,
else
err_code = SCTP_ERROR_REQ_REFUSED;
 
+   asconf_ack_len = ntohs(asconf_ack-chunk_hdr-length) -
+sizeof(sctp_chunkhdr_t);
+
/* Skip the addiphdr from the asconf_ack chunk and store a pointer to
 * the first asconf_ack parameter.
 */
-- 
1.5.2.4

-
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 09/14] SCTP: Convert custom hash lists to use hlist.

2007-11-12 Thread Vlad Yasevich
Convert the custom hash list traversals to use hlist functions.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/sctp.h|3 +++
 include/net/sctp/structs.h |   10 --
 net/sctp/endpointola.c |3 ++-
 net/sctp/input.c   |   43 +++
 net/sctp/proc.c|6 --
 net/sctp/protocol.c|6 +++---
 net/sctp/socket.c  |   14 +-
 7 files changed, 32 insertions(+), 53 deletions(-)

diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 7082730..67c997c 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -665,6 +665,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 
rport, __u32 vtag)
return (h  (sctp_assoc_hashsize-1));
 }
 
+#define sctp_for_each_hentry(epb, node, head) \
+   hlist_for_each_entry(epb, node, head, node)
+
 /* Is a socket of this style? */
 #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
 static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 44f2672..eb3113c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -100,20 +100,19 @@ struct crypto_hash;
 struct sctp_bind_bucket {
unsigned short  port;
unsigned short  fastreuse;
-   struct sctp_bind_bucket *next;
-   struct sctp_bind_bucket **pprev;
+   struct hlist_node   node;
struct hlist_head   owner;
 };
 
 struct sctp_bind_hashbucket {
spinlock_t  lock;
-   struct sctp_bind_bucket *chain;
+   struct hlist_head   chain;
 };
 
 /* Used for hashing all associations.  */
 struct sctp_hashbucket {
rwlock_tlock;
-   struct sctp_ep_common  *chain;
+   struct hlist_head   chain;
 } __attribute__((__aligned__(8)));
 
 
@@ -1230,8 +1229,7 @@ typedef enum {
 
 struct sctp_ep_common {
/* Fields to help us manage our entries in the hash tables. */
-   struct sctp_ep_common *next;
-   struct sctp_ep_common **pprev;
+   struct hlist_node node;
int hashent;
 
/* Runtime type information.  What kind of endpoint is this? */
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 68f0556..de6f505 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -332,6 +332,7 @@ static struct sctp_association 
*__sctp_endpoint_lookup_assoc(
struct sctp_transport *t = NULL;
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
+   struct hlist_node *node;
int hash;
int rport;
 
@@ -341,7 +342,7 @@ static struct sctp_association 
*__sctp_endpoint_lookup_assoc(
hash = sctp_assoc_hashfn(ep-base.bind_addr.port, rport);
head = sctp_assoc_hashtable[hash];
read_lock(head-lock);
-   for (epb = head-chain; epb; epb = epb-next) {
+   sctp_for_each_hentry(epb, node, head-chain) {
asoc = sctp_assoc(epb);
if (asoc-ep != ep || rport != asoc-peer.port)
goto next;
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 86503e7..91ae463 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -656,7 +656,6 @@ discard:
 /* Insert endpoint into the hash table.  */
 static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
 {
-   struct sctp_ep_common **epp;
struct sctp_ep_common *epb;
struct sctp_hashbucket *head;
 
@@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
head = sctp_ep_hashtable[epb-hashent];
 
sctp_write_lock(head-lock);
-   epp = head-chain;
-   epb-next = *epp;
-   if (epb-next)
-   (*epp)-pprev = epb-next;
-   *epp = epb;
-   epb-pprev = epp;
+   hlist_add_head(epb-node, head-chain);
sctp_write_unlock(head-lock);
 }
 
@@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint 
*ep)
 
epb = ep-base;
 
+   if (hlist_unhashed(epb-node))
+   return;
+
epb-hashent = sctp_ep_hashfn(epb-bind_addr.port);
 
head = sctp_ep_hashtable[epb-hashent];
 
sctp_write_lock(head-lock);
-
-   if (epb-pprev) {
-   if (epb-next)
-   epb-next-pprev = epb-pprev;
-   *epb-pprev = epb-next;
-   epb-pprev = NULL;
-   }
-
+   __hlist_del(epb-node);
sctp_write_unlock(head-lock);
 }
 
@@ -721,12 +711,13 @@ static struct sctp_endpoint 
*__sctp_rcv_lookup_endpoint(const union sctp_addr *l
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
struct sctp_endpoint *ep;
+   struct hlist_node *node;
int hash;
 
hash = sctp_ep_hashfn(ntohs(laddr-v4.sin_port));
head = sctp_ep_hashtable[hash];
read_lock(head-lock);
-   for (epb = head-chain; epb; epb = epb-next) {
+   sctp_for_each_hentry(epb, 

[PATCH 11/14] SCTP: Fix PR-SCTP to deliver all the accumulated ordered chunks

2007-11-12 Thread Vlad Yasevich
There is a small bug when we process a FWD-TSN.  We'll deliver
anything upto the current next expected SSN.  However, if the
next expected is already in the queue, it will take another
chunk to trigger its delivery.  The fix is to simply check
the current queued SSN is the next expected one.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/ulpqueue.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 4be92d0..4908041 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -862,7 +862,7 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq 
*ulpq, __u16 sid)
continue;
 
/* see if this ssn has been marked by skipping */
-   if (!SSN_lt(cssn, sctp_ssn_peek(in, csid)))
+   if (!SSN_lte(cssn, sctp_ssn_peek(in, csid)))
break;
 
__skb_unlink(pos, ulpq-lobby);
-- 
1.5.2.4

-
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 13/14] SCTP: Always flush the queue when uncorcking.

2007-11-12 Thread Vlad Yasevich
When the code calls uncork, trigger a queue flush, even
if the queue was not corked.  Most callers that explicitely
cork the queue will have additinal checks to see if they
corked it.  Callers who do not cork the queue expect packets
to flow when they call uncork.

The scneario that showcased this bug happend when we were not
able to bundle DATA with outgoing COOKIE-ECHO.  As a result
the data just sat in the outqueue and did not get transmitted.
The application expected a response, but nothing happened.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/outqueue.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 99a3db5..fa76f23 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -662,10 +662,9 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct 
sctp_packet *pkt,
 int sctp_outq_uncork(struct sctp_outq *q)
 {
int error = 0;
-   if (q-cork) {
+   if (q-cork)
q-cork = 0;
-   error = sctp_outq_flush(q, 0);
-   }
+   error = sctp_outq_flush(q, 0);
return error;
 }
 
-- 
1.5.2.4

-
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 14/14] Fix memory leak in discard case of sctp_sf_abort_violation()

2007-11-12 Thread Vlad Yasevich
From: Jesper Juhl [EMAIL PROTECTED]

In net/sctp/sm_statefuns.c::sctp_sf_abort_violation() we may leak
the storage allocated for 'abort' by returning from the function
without using or freeing it. This happens in case
sctp_auth_recv_cid(SCTP_CID_ABORT, asoc) is true and we jump to
the 'discard' label.
Spotted by the Coverity checker.

The simple fix is to simply move the creation of the abort chunk
to after the possible jump to the 'discard' label. This way we don't
even have to allocate the memory at all in the problem case.

Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/sm_statefuns.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index a66075a..5ebbe80 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4064,11 +4064,6 @@ static sctp_disposition_t sctp_sf_abort_violation(
struct sctp_chunk *chunk =  arg;
struct sctp_chunk *abort = NULL;
 
-   /* Make the abort chunk. */
-   abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
-   if (!abort)
-   goto nomem;
-
/* SCTP-AUTH, Section 6.3:
 *It should be noted that if the receiver wants to tear
 *down an association in an authenticated way only, the
@@ -4083,6 +4078,11 @@ static sctp_disposition_t sctp_sf_abort_violation(
if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
goto discard;
 
+   /* Make the abort chunk. */
+   abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
+   if (!abort)
+   goto nomem;
+
if (asoc) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
-- 
1.5.2.4

-
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 12/14] SCTP: Clean-up some defines for regressions tests.

2007-11-12 Thread Vlad Yasevich
Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/sctp.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 67c997c..34318a3 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -65,7 +65,6 @@
 
 
 #ifdef TEST_FRAME
-#undef CONFIG_PROC_FS
 #undef CONFIG_SCTP_DBG_OBJCNT
 #undef CONFIG_SYSCTL
 #endif /* TEST_FRAME */
-- 
1.5.2.4

-
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 10/14] SCTP: Make sctp_verify_param return multiple indications.

2007-11-12 Thread Vlad Yasevich
SCTP-AUTH and future ADD-IP updates have a requirement to
do additional verification of parameters and an ability to
ABORT the association if verification fails.  So, introduce
additional return code so that we can clear signal a required
action.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 include/net/sctp/constants.h |2 +
 net/sctp/sm_make_chunk.c |  149 +-
 2 files changed, 77 insertions(+), 74 deletions(-)

diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 73fbdf6..f30b537 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -186,6 +186,8 @@ typedef enum {
SCTP_IERROR_AUTH_BAD_HMAC,
SCTP_IERROR_AUTH_BAD_KEYID,
SCTP_IERROR_PROTO_VIOLATION,
+   SCTP_IERROR_ERROR,
+   SCTP_IERROR_ABORT,
 } sctp_ierror_t;
 
 
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 43e8de1..5a9783c 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1788,9 +1788,14 @@ static int sctp_process_inv_paramlength(const struct 
sctp_association *asoc,
sizeof(sctp_paramhdr_t);
 
 
+   /* This is a fatal error.  Any accumulated non-fatal errors are
+* not reported.
+*/
+   if (*errp)
+   sctp_chunk_free(*errp);
+
/* Create an error chunk and fill it in with our payload. */
-   if (!*errp)
-   *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
+   *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
 
if (*errp) {
sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
@@ -1813,9 +1818,15 @@ static int sctp_process_hn_param(const struct 
sctp_association *asoc,
 {
__u16 len = ntohs(param.p-length);
 
-   /* Make an ERROR chunk. */
-   if (!*errp)
-   *errp = sctp_make_op_error_space(asoc, chunk, len);
+   /* Processing of the HOST_NAME parameter will generate an
+* ABORT.  If we've accumulated any non-fatal errors, they
+* would be unrecognized parameters and we should not include
+* them in the ABORT.
+*/
+   if (*errp)
+   sctp_chunk_free(*errp);
+
+   *errp = sctp_make_op_error_space(asoc, chunk, len);
 
if (*errp) {
sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len);
@@ -1862,56 +1873,40 @@ static void sctp_process_ext_param(struct 
sctp_association *asoc,
  * taken if the processing endpoint does not recognize the
  * Parameter Type.
  *
- * 00 - Stop processing this SCTP chunk and discard it,
- * do not process any further chunks within it.
+ * 00 - Stop processing this parameter; do not process any further
+ * parameters within this chunk
  *
- * 01 - Stop processing this SCTP chunk and discard it,
- * do not process any further chunks within it, and report
- * the unrecognized parameter in an 'Unrecognized
- * Parameter Type' (in either an ERROR or in the INIT ACK).
+ * 01 - Stop processing this parameter, do not process any further
+ * parameters within this chunk, and report the unrecognized
+ * parameter in an 'Unrecognized Parameter' ERROR chunk.
  *
  * 10 - Skip this parameter and continue processing.
  *
  * 11 - Skip this parameter and continue processing but
  * report the unrecognized parameter in an
- * 'Unrecognized Parameter Type' (in either an ERROR or in
- * the INIT ACK).
+ * 'Unrecognized Parameter' ERROR chunk.
  *
  * Return value:
- * 0 - discard the chunk
- * 1 - continue with the chunk
+ * SCTP_IERROR_NO_ERROR - continue with the chunk
+ * SCTP_IERROR_ERROR- stop and report an error.
+ * SCTP_IERROR_NOMEME   - out of memory.
  */
-static int sctp_process_unk_param(const struct sctp_association *asoc,
- union sctp_params param,
- struct sctp_chunk *chunk,
- struct sctp_chunk **errp)
+static sctp_ierror_t sctp_process_unk_param(const struct sctp_association 
*asoc,
+   union sctp_params param,
+   struct sctp_chunk *chunk,
+   struct sctp_chunk **errp)
 {
-   int retval = 1;
+   int retval = SCTP_IERROR_NO_ERROR;
 
switch (param.p-type  SCTP_PARAM_ACTION_MASK) {
case SCTP_PARAM_ACTION_DISCARD:
-   retval =  0;
-   break;
-   case SCTP_PARAM_ACTION_DISCARD_ERR:
-   retval =  0;
-   /* Make an ERROR chunk, preparing enough room for
-* returning multiple unknown parameters.
-*/
-   if (NULL == *errp)
-   *errp = sctp_make_op_error_space(asoc, chunk,
-   ntohs(chunk-chunk_hdr-length));
-
-   if (*errp) {
-   

Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Eric W. Biederman
Daniel Lezcano [EMAIL PROTECTED] writes:

 The loopback is now dynamically allocated. The ipv6 code was written
 considering the loopback is allocated before the ipv6 protocol 
 initialization. This is still the case when we don't use multiple
 network namespaces.


You do know that register_netdevice_notifier delivers events 
REGISTER and UP events for devices that are already up?

Thinking about it I wonder if unregister_netdevice_notifier should
actually deliver UNREGISTER events.  It wouldn't change the ipv6
case as I don't believe you can unregister ipv6.

 In the case of the network namespaces, ipv6 notification handler is
 already setup and active (done by the initial network namespace), 
 so when a network namespace is created, a new instance of the 
 loopback device, via dynamic allocation, will trigger a REGISTER event
 to addrconf_notify and this one will try to setup the network device
 while the ipv6 protocol is not yet initialized for the network namespace.

Ok.  This sounds like a race in ipv6 that should get fixed.

I know last time my patchset covered ipv6 I did send patches for several
reference counting problems.  I'm surprised something bad still exists.

Anyway let's not patch around this and fix whatever the real problem.

 Because the ipv6 is relying on the fact that the loopback device will
 not trigger REGISTER/UNREGISTER events, I just protect the addrconf_notify
 function when the loopback register event is triggered.

This can't be the case REGISTER events happen.

 In the case of multiple network namespaces, the usual ipv6 protocol 
 initialization will be done after the loopback initialization with 
 the subsystem registration mechanism.

 Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
 Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
 ---
  net/ipv6/addrconf.c |9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)

 Index: linux-2.6-netns/net/ipv6/addrconf.c
 ===
 --- linux-2.6-netns.orig/net/ipv6/addrconf.c
 +++ linux-2.6-netns/net/ipv6/addrconf.c
 @@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
  
   switch(event) {
   case NETDEV_REGISTER:
 - if (!idev  dev-mtu = IPV6_MIN_MTU) {
 + if (!(dev-flags  IFF_LOOPBACK) 
 + !idev  dev-mtu = IPV6_MIN_MTU) {
   idev = ipv6_add_dev(dev);
   if (!idev)
   return notifier_from_errno(-ENOMEM);

This hunk is clearly bogus.

 @@ -2366,11 +2367,15 @@ static int addrconf_notify(struct notifi
   /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this
 interface. */
  
   case NETDEV_DOWN:
 + addrconf_ifdown(dev, 0);
 + break;
 +
   case NETDEV_UNREGISTER:
   /*
*  Remove all addresses from this interface.
*/
 - addrconf_ifdown(dev, event != NETDEV_DOWN);
 + if (!(dev-flags  IFF_LOOPBACK))
 + addrconf_ifdown(dev, 1);

I can see how this could be a problem.
   break;
  
   case NETDEV_CHANGENAME:

 -- 
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Denis V. Lunev
 why should we care on down? we are destroying the device. It should
 gone. All references to it should also gone. So, we should perform the
 cleaning and remove all IPv6 addresses, so notifier should also work.
 
 We need to take care of netdev down, someone can put the loopback down
 if he wants.
 
 The code relies on the persistent loopback and this is a _bad_ thing.
 This is longstanding bug in the code, that the dst_entry should have a
 valid reference to a device. This is the only purpose for a loopback
 persistence. Though, at the namespace death no such entries must be and
 this will be checked during unregister process. This patch definitely
 breaks this assumption :(

 Namespaces are good to catch leakage using standard codepaths, so they
 should be preserved as much as possible. So, _all_ normal down code
 should be called for a loopback device in other than init_net context.
 
 I agree with you, this is a bug in ipv6 and the loopback; when playing
 with ipv6 we found that the loopback is still referenced 9 times when
 the system is shutdown.

Pff...  I can't guess right now where the error can be :( We have
correct behavior of loopback even for IPv6 within OpenVZ. On down the
count is 0 and device is destroyed correctly without these kludges. So,
something is definitely wrong.

 The purpose of this patch is to protect the __actual__ code from the new
 loopback behavior. We are looking at a more generic approach with the
 namespace for ipv6, as you mentioned, namespaces are good for network
 leakage detection as we create several instances of the network stack.

The only kludge required is already in place. addrconf_ifdown has a
protection for init_net.
if (dev == init_net.loopback_dev  how == 1)
how = 0;
Other places should be untouched.

Unregister for a loopback in !init_net is a _valid_ operation and should
be clean, i.e. without kludges in the path. This is the only way to
check the ref-counting.
-
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 frame time stamping

2007-11-12 Thread Eric Dumazet
On Mon, 12 Nov 2007 16:42:34 +0100
Antoine Zen-Ruffinen [EMAIL PROTECTED] wrote:

 Dear all,
 
 I'm writing a network analyzer software using Linux and I need a VERY
 precise frame time stamping. Therefor I am planing to add my own time
 stamping algorithm on a modified network driver. For test purpose I
 did so :
 
   skb-tstamp.tv64 = 0x00010002;
   netif_rx(skb);
 
 On the user side, I ask for the timestamp that way :
 
   ...
   sock = socket(AF_PACKET, SOCK_RAW, type);
   ...
   //bind this socket with the interface using my modified driver.
   ...
   recvByteCount = recv(sock, buffer, 1514, 0);
   ioctl(sock, SIOCGSTAMP, timeStamp);
 
 I was surprised to see that the var timeStamp was still holding a
 count of second since  year 1970.
 
 Investigating a bit into the kernel code, I found that ioctl(sock,
 SIOCGSTAMP, ...) was giving just the current kernel time using
 ktime_get_real().
 
 Are my investigation wrong ?
 Is that a bug in kernel code ?
 Is there an other way to access skb.tstamp from user side ?
 
 Thank's to any one that can help me !

If your kernel is recent enough, you can already get nanosecond precision from 
skb tstamp, using SIOCGSTAMPNS ioctl or SO_TIMESTAMPNS / SCM_TIMESTAMPNS

(changes where done in March/April this year)

http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=b7aa0bf70c4afb9e38be25f5c0922498d0f8684c

http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=ae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23

http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=92f37fd2ee805aa77925c1e64fd56088b46094fc


No need to modify a network driver :)


-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Eric W. Biederman
Denis V. Lunev [EMAIL PROTECTED] writes:

 Index: linux-2.6-netns/net/ipv6/addrconf.c
 ===
 --- linux-2.6-netns.orig/net/ipv6/addrconf.c
 +++ linux-2.6-netns/net/ipv6/addrconf.c
 @@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
  
  switch(event) {
  case NETDEV_REGISTER:
 -if (!idev  dev-mtu = IPV6_MIN_MTU) {
 +if (!(dev-flags  IFF_LOOPBACK) 
 +!idev  dev-mtu = IPV6_MIN_MTU) {

It is idev being true here for the loopback device that would
prevent things not missing the REGISTER event.

Hmm.  But we do call ipv6_add_dev on loopback and now the loopback
device is practically guaranteed to be the first device so we can
probably just remove the special case in addrconf_init.

Anyway Daniels patch makes increasingly less sense the more I look
at it.


 Namespaces are good to catch leakage using standard codepaths, so they
 should be preserved as much as possible. So, _all_ normal down code
 should be called for a loopback device in other than init_net context.

In any context. After the code path is aware of multiple network namespaces
init_net should not be special in any way.

I completely agree about the ability to catch weird leakage scenarios.

Eric
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Eric W. Biederman
Denis V. Lunev [EMAIL PROTECTED] writes:

 why should we care on down? we are destroying the device. It should
 gone. All references to it should also gone. So, we should perform the
 cleaning and remove all IPv6 addresses, so notifier should also work.
 
 We need to take care of netdev down, someone can put the loopback down
 if he wants.
 
 The code relies on the persistent loopback and this is a _bad_ thing.
 This is longstanding bug in the code, that the dst_entry should have a
 valid reference to a device. This is the only purpose for a loopback
 persistence. Though, at the namespace death no such entries must be and
 this will be checked during unregister process. This patch definitely
 breaks this assumption :(

 Namespaces are good to catch leakage using standard codepaths, so they
 should be preserved as much as possible. So, _all_ normal down code
 should be called for a loopback device in other than init_net context.
 
 I agree with you, this is a bug in ipv6 and the loopback; when playing
 with ipv6 we found that the loopback is still referenced 9 times when
 the system is shutdown.

 Pff...  I can't guess right now where the error can be :( We have
 correct behavior of loopback even for IPv6 within OpenVZ. On down the
 count is 0 and device is destroyed correctly without these kludges. So,
 something is definitely wrong.

 The purpose of this patch is to protect the __actual__ code from the new
 loopback behavior. We are looking at a more generic approach with the
 namespace for ipv6, as you mentioned, namespaces are good for network
 leakage detection as we create several instances of the network stack.

 The only kludge required is already in place. addrconf_ifdown has a
 protection for init_net.
 if (dev == init_net.loopback_dev  how == 1)
 how = 0;
 Other places should be untouched.

 Unregister for a loopback in !init_net is a _valid_ operation and should
 be clean, i.e. without kludges in the path. This is the only way to
 check the ref-counting.

Oh.  Speaking of.  One way to catch this kind of thing during debugging
is to instrument dev_put and dev_hold to add a print statement.  Something
like:

/**
 *  dev_put - release reference to device
 *  @dev: network device
 *
 * Release reference to device to allow it to be freed.
 */
static inline void __dev_put(struct net_device *dev, char *file, char *func, 
int line)
{
if (dev-flags  IFF_LOOPBACK)
printk(%s: %s.%s.%d\n, __func__, file, file, line);
atomic_dec(dev-refcnt);
}

#define dev_put(DEV) __dev_put(DEV, __FILE__, __func__, __LINE__)

/**
 *  dev_hold - get reference to device
 *  @dev: network device
 *
 * Hold reference to device to keep it from being freed.
 */
static inline void __dev_hold(struct net_device *dev, char *file, char *func, 
int line)
{
if (dev-flags  IFF_LOOPBACK)
printk(%s: %s.%s.%d\n, __func__, file, file, line);
atomic_inc(dev-refcnt);
}

#define dev_hold(DEV) __dev_hold(DEV, __FILE__, __func__, __LINE__)

-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Daniel Lezcano

Eric W. Biederman wrote:

Denis V. Lunev [EMAIL PROTECTED] writes:


Index: linux-2.6-netns/net/ipv6/addrconf.c
===
--- linux-2.6-netns.orig/net/ipv6/addrconf.c
+++ linux-2.6-netns/net/ipv6/addrconf.c
@@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
 
 	switch(event) {

case NETDEV_REGISTER:
-   if (!idev  dev-mtu = IPV6_MIN_MTU) {
+   if (!(dev-flags  IFF_LOOPBACK) 
+   !idev  dev-mtu = IPV6_MIN_MTU) {


It is idev being true here for the loopback device that would
prevent things not missing the REGISTER event.

Hmm.  But we do call ipv6_add_dev on loopback and now the loopback
device is practically guaranteed to be the first device so we can
probably just remove the special case in addrconf_init.

Anyway Daniels patch makes increasingly less sense the more I look
at it.


Let me try to clarify:

 * when the init network namespace is created, the loopback is created 
first, before ipv6, and the notifier call chain for ipv6 is not setup, 
so the protocol does not receive the REGISTER event


 * when the init network namespace is destroyed during shutdown, the 
loopback is not unregistered, so there is no UNREGISTER event


 * when we create a new network namespace, a new instance of the 
loopback is created and a NETDEV_REGISTER is sent to ipv6 because the 
notifier call chain has been setup by the init netns (while ipv6 
protocol is not yet configured for the namespace which is being created)


 * when the network namespace exits, the loopback is unregistered after 
the ipv6 protocol but the NETDEV_UNREGISTER is sent to addrconf_notify 
while the ipv6 protocol has been destroyed.



The objective of the patch is to discard these events because they were 
never taken into account and they are not expected to be receive by ipv6 
protocol.

-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Kok, Auke
Joonwoo Park wrote:
 IMHO even though netdevice is in the promiscuous mode, we should receive all 
 of ingress packets.
 This disable the vlan filtering feature when a vlan hw accel configured e1000 
 device goes into promiscuous mode.
 This make packets visible to sniffers though it's not vlan id of itself.
 Any check, comments will be appreciated.

Actually I think this patch removes a choice from the user.

Before this patch, the user can sniff all traffic by disabling vlans, or a
specific vlan only by leaving vlans on when going into promisc mode.

After this patch, the user has no choice but to sniff all vlans at all times.

I don't think that that is such a good improvement.

Auke


 Thanks.
 
 Signed-off-by: Joonwoo Park [EMAIL PROTECTED]
 ---
  drivers/net/e1000/e1000_main.c |   26 --
  1 files changed, 20 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c 
 index 72deff0..cdd5c84 100644
 --- a/drivers/net/e1000/e1000_main.c
 +++ b/drivers/net/e1000/e1000_main.c
 @@ -2424,7 +2424,7 @@ e1000_set_multi(struct net_device *netdev)
   struct e1000_adapter *adapter = netdev_priv(netdev);
   struct e1000_hw *hw = adapter-hw;
   struct dev_mc_list *mc_ptr;
 - uint32_t rctl;
 + uint32_t rctl, ctrl;
   uint32_t hash_value;
   int i, rar_entries = E1000_RAR_ENTRIES;
   int mta_reg_count = (hw-mac_type == e1000_ich8lan) ?
 @@ -2441,14 +2441,25 @@ e1000_set_multi(struct net_device *netdev)
   /* Check for Promiscuous and All Multicast modes */
  
   rctl = E1000_READ_REG(hw, RCTL);
 + ctrl = E1000_READ_REG(adapter-hw, CTRL);
  
   if (netdev-flags  IFF_PROMISC) {
   rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 - } else if (netdev-flags  IFF_ALLMULTI) {
 - rctl |= E1000_RCTL_MPE;
 - rctl = ~E1000_RCTL_UPE;
 + if (adapter-hw.mac_type != e1000_ich8lan) {
 + if (ctrl  E1000_CTRL_VME)
 + rctl = ~E1000_RCTL_VFE;
 + }
   } else {
 - rctl = ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
 + if (adapter-hw.mac_type != e1000_ich8lan) {
 + if (ctrl  E1000_CTRL_VME)
 + rctl |= E1000_RCTL_VFE;
 + }
 + if (netdev-flags  IFF_ALLMULTI) {
 + rctl |= E1000_RCTL_MPE;
 + rctl = ~E1000_RCTL_UPE;
 + } else {
 + rctl = ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
 + }
   }
  
   E1000_WRITE_REG(hw, RCTL, rctl);
 @@ -4952,7 +4963,10 @@ e1000_vlan_rx_register(struct net_device *netdev, 
 struct vlan_group *grp)
   if (adapter-hw.mac_type != e1000_ich8lan) {
   /* enable VLAN receive filtering */
   rctl = E1000_READ_REG(adapter-hw, RCTL);
 - rctl |= E1000_RCTL_VFE;
 + if (netdev-flags  IFF_PROMISC)
 + rctl = ~E1000_RCTL_VFE;
 + else
 + rctl |= E1000_RCTL_VFE;
   rctl = ~E1000_RCTL_CFIEN;
   E1000_WRITE_REG(adapter-hw, RCTL, rctl);
   e1000_update_mng_vlan(adapter);
 ---
 
 -
 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
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Patrick McHardy

Kok, Auke wrote:

Joonwoo Park wrote:

IMHO even though netdevice is in the promiscuous mode, we should receive all of 
ingress packets.
This disable the vlan filtering feature when a vlan hw accel configured e1000 
device goes into promiscuous mode.
This make packets visible to sniffers though it's not vlan id of itself.
Any check, comments will be appreciated.


Actually I think this patch removes a choice from the user.

Before this patch, the user can sniff all traffic by disabling vlans, or a
specific vlan only by leaving vlans on when going into promisc mode.

After this patch, the user has no choice but to sniff all vlans at all times.

I don't think that that is such a good improvement.



Do you really consider that a realistic choice? Who is going to
remove interfaces that are in use just to see traffic for other
VLANs? Sniffing specific VLANs can always be done on the VLAN
device itself.

IMO its more a question of what we want promiscous mode to mean,
and I tend to agree with Joonwoo that it should receive all packets.
-
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] sungem: fix suspend regression due to NAPI changes

2007-11-12 Thread Johannes Berg
Commit bea3348e (the NAPI changes) made sungem unconditionally enable
NAPI when resuming and unconditionally disable when suspending, this,
however, makes napi_disable() hang when suspending when the interface
was taken down before suspend because taking the interface down also
disables NAPI. This patch makes touching the napi struct in
suspend/resume code paths depend on having the interface up, thereby
fixing the hang on suspend.

The patch also moves the napi_disable() in gem_close() under the lock so
that the NAPI state is always modified atomically together with the
opened variable.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]

---
 drivers/net/sungem.c |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

--- everything.orig/drivers/net/sungem.c2007-11-12 18:22:49.948748047 
+0100
+++ everything/drivers/net/sungem.c 2007-11-12 18:24:30.708748481 +0100
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *
 {
struct gem *gp = dev-priv;
 
-   napi_disable(gp-napi);
-
mutex_lock(gp-pm_mutex);
 
+   napi_disable(gp-napi);
+
gp-opened = 0;
if (!gp-asleep)
gem_do_stop(dev, 0);
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *p
 
mutex_lock(gp-pm_mutex);
 
-   napi_disable(gp-napi);
-
printk(KERN_INFO %s: suspending, WakeOnLan %s\n,
   dev-name,
   (gp-wake_on_lan  gp-opened) ? enabled : disabled);
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *p
 
/* If the driver is opened, we stop the MAC */
if (gp-opened) {
+   napi_disable(gp-napi);
+
/* Stop traffic, mark us closed */
netif_device_detach(dev);
 
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pd
/* Re-attach net device */
netif_device_attach(dev);
 
+   napi_enable(gp-napi);
}
 
spin_lock_irqsave(gp-lock, flags);
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pd
spin_unlock(gp-tx_lock);
spin_unlock_irqrestore(gp-lock, flags);
 
-   napi_enable(gp-napi);
-
mutex_unlock(gp-pm_mutex);
 
return 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


[PATCH 05/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This message attaches the combined diffs from
messages 01/05 through 04/05. This file should be
suitable for use with the patch utility.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]
--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
depends on IPV6  EXPERIMENTAL
--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1491,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
 *  - value 0
 *  - XXX: already 

[PATCH 04/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/sit.c.orig2007-11-08 12:03:41.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/sit.c 2007-11-12 07:13:13.0 -0800
@@ -16,6 +16,7 @@
  * Changes:
  * Roger Venning [EMAIL PROTECTED]:  6to4 support
  * Nate Thompson [EMAIL PROTECTED]:6to4 support
+ * Fred L. Templin [EMAIL PROTECTED]:isatap support
  */

 #include linux/module.h
@@ -182,6 +183,11 @@ static struct ip_tunnel * ipip6_tunnel_l
dev-init = ipip6_tunnel_init;
nt-parms = *parms;

+#if defined(CONFIG_IPV6_ISATAP)
+   if (parms-i_key)
+   dev-priv_flags |= IFF_ISATAP;
+#endif
+
if (register_netdevice(dev)  0) {
free_netdev(dev);
goto failed;
@@ -382,6 +388,48 @@ static int ipip6_rcv(struct sk_buff *skb
IPCB(skb)-flags = 0;
skb-protocol = htons(ETH_P_IPV6);
skb-pkt_type = PACKET_HOST;
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - check source address */
+   if (tunnel-dev-priv_flags  IFF_ISATAP) {
+   struct neighbour *neigh;
+   struct dst_entry *dst;
+   struct flowi fl;
+   struct in6_addr *addr6;
+   struct ipv6hdr *iph6;
+
+   /* from ISATAP router */
+   if ((tunnel-parms.i_key != INADDR_NONE) 
+   (iph-saddr == tunnel-parms.i_key)) goto accept;
+
+   iph6 = ipv6_hdr(skb);
+   addr6 = iph6-saddr;
+
+   /* from legitimate previous hop */
+   memset(fl, 0, sizeof(fl));
+   fl.proto = iph6-nexthdr;
+   ipv6_addr_copy(fl.fl6_dst, addr6);
+   fl.oif = tunnel-dev-ifindex;
+   security_skb_classify_flow(skb, fl);
+
+   if (!(dst = ip6_route_output(NULL, fl)) ||
+(dst-dev != tunnel-dev) ||
+((neigh = dst-neighbour) == NULL)) goto drop;
+
+   addr6 = (struct in6_addr*)neigh-primary_key;
+
+   if (!(ipv6_addr_is_isatap(addr6)) ||
+(addr6-s6_addr32[3] != iph-saddr)) {
+drop:
+   tunnel-stat.rx_errors++;
+   read_unlock(ipip6_lock);
+   dst_release(dst);
+   kfree_skb(skb);
+   return 0;
+   }
+   dst_release(dst);
+   }
+accept:
+#endif
tunnel-stat.rx_packets++;
tunnel-stat.rx_bytes += skb-len;
skb-dev = tunnel-dev;
@@ -444,6 +492,31 @@ static int ipip6_tunnel_xmit(struct sk_b
if (skb-protocol != htons(ETH_P_IPV6))
goto tx_error;

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - must come before 6to4 */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct neighbour *neigh = NULL;
+
+   if (skb-dst)
+   neigh = skb-dst-neighbour;
+
+   if (neigh == NULL) {
+   if (net_ratelimit())
+   printk(KERN_DEBUG sit: nexthop == NULL\n);
+   goto tx_error;
+   }
+
+   addr6 = (struct in6_addr*)neigh-primary_key;
+   addr_type = ipv6_addr_type(addr6);
+
+   if ((addr_type  IPV6_ADDR_UNICAST) 
+ipv6_addr_is_isatap(addr6))
+   dst = addr6-s6_addr32[3];
+   else
+   goto tx_error;
+   }
+#endif
+
if (!dst)
dst = try_6to4(iph6-daddr);

@@ -651,6 +724,10 @@ ipip6_tunnel_ioctl (struct net_device *d
ipip6_tunnel_unlink(t);
t-parms.iph.saddr = p.iph.saddr;
t-parms.iph.daddr = p.iph.daddr;
+#if defined(CONFIG_IPV6_ISATAP)
+   t-parms.i_key = p.i_key;
+   t-parms.o_key = p.o_key;
+#endif
memcpy(dev-dev_addr, p.iph.saddr, 4);
memcpy(dev-broadcast, p.iph.daddr, 4);
ipip6_tunnel_link(t);
@@ -663,6 +740,10 @@ ipip6_tunnel_ioctl (struct net_device *d
if (cmd == SIOCCHGTUNNEL) {
  

[PATCH 03/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h

 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }

+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui,
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1491,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
 *  - value 0
 *  - XXX: already assigned to an address on the device
 */
@@ -2201,6 +2221,31 @@ static void addrconf_sit_config(struct n
return;
}

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - NBMA link */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct in6_addr addr;
+
+   addrconf_add_lroute(dev);
+
+   ipv6_addr_set(addr,  htonl(0xFE80), 0, 0, 0);
+
+   if (ipv6_generate_eui64(addr.s6_addr + 8, dev) == 0) {
+   struct inet6_ifaddr *ifp;
+
+   ifp = ipv6_add_addr(idev, addr, 64,
+   IFA_LINK, IFA_F_PERMANENT);
+   if (!IS_ERR(ifp)) {
+   addrconf_prefix_route(ifp-addr,
+   ifp-prefix_len, idev-dev, 0, 0);
+   addrconf_dad_start(ifp, 0);
+   in6_ifa_put(ifp);
+   }
+   }
+   return;
+   }
+#endif
+
sit_add_v4_addrs(idev);

if (dev-flagsIFF_POINTOPOINT) {
@@ -2531,6 +2576,19 @@ static void addrconf_rs_timer(unsigned l
 *  Announcement received after solicitation
 *  was sent
 */
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - schedule next RS/RA */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t  = netdev_priv(ifp-idev-dev);
+   if (t-parms.i_key != INADDR_NONE) {
+   spin_lock(ifp-lock);
+   ifp-probes = 0;
+   ifp-idev-if_flags = ~(IF_RS_SENT|IF_RA_RCVD);
+   addrconf_mod_timer(ifp, AC_DAD, 
t-parms.o_key*HZ);
+   spin_unlock(ifp-lock);
+   }
+   }
+#endif
goto out;
}

@@ -2545,10 +2603,32 @@ static void addrconf_rs_timer(unsigned l
   ifp-idev-cnf.rtr_solicit_interval);
spin_unlock(ifp-lock);

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - unicast RS */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t = netdev_priv(ifp-idev-dev);
+
+   if (t-parms.i_key == INADDR_NONE) goto out;
+
+   ipv6_addr_set(all_routers, htonl(0xFE80), 0, 0, 0);
+   addrconf_ifid_isatap(all_routers.s6_addr + 8, 
t-parms.i_key);
+   } else
+#endif
ipv6_addr_all_routers(all_routers);

ndisc_send_rs(ifp-idev-dev, 

[PATCH 01/01] iproute2-2.6.23: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. The
attached file includes diffs that are specific to the
iproute2-2.6.23 software distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]
--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-12 06:53:38.0 -0800
@@ -39,7 +39,8 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, Usage: ip tunnel { add | change | del | show } [ NAME 
]\n);
-   fprintf(stderr,   [ mode { ipip | gre | sit } ] [ remote ADDR 
] [ local ADDR ]\n);
+   fprintf(stderr,   [ mode { ipip | gre | sit | isatap } ]\n);
+   fprintf(stderr,   [ remote ADDR ] [ local ADDR ] [ router ADDR 
] [ lifetime NUMBER ]\n);
fprintf(stderr,   [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n);
fprintf(stderr,   [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ 
dev PHYS_DEV ]\n);
fprintf(stderr, \n);
@@ -55,6 +56,9 @@ static int parse_args(int argc, char **a
 {
int count = 0;
char medium[IFNAMSIZ];
+   int isatap = 0;
+   unsigned router = 0;
+   unsigned lifetime = 0;
 
memset(p, 0, sizeof(*p));
memset(medium, 0, sizeof(medium));
@@ -90,6 +94,13 @@ static int parse_args(int argc, char **a
exit(-1);
}
p-iph.protocol = IPPROTO_IPV6;
+   } else if (strcmp(*argv, isatap) == 0) {
+   if (p-iph.protocol  p-iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,You managed to ask for 
more than one tunnel mode.\n);
+   exit(-1);
+   }
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
} else {
fprintf(stderr,Cannot guess tunnel mode.\n);
exit(-1);
@@ -160,6 +171,18 @@ static int parse_args(int argc, char **a
NEXT_ARG();
if (strcmp(*argv, any))
p-iph.saddr = get_addr32(*argv);
+   } else if (strcmp(*argv, router) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, any))
+   router = get_addr32(*argv);
+   } else if (strcmp(*argv, lifetime) == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(uval, *argv, 0)) {
+   invarg(invalid lifetime\n, *argv);
+   exit(-1);
+   }
+   lifetime = uval;
} else if (strcmp(*argv, dev) == 0) {
NEXT_ARG();
strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +235,10 @@ static int parse_args(int argc, char **a
p-iph.protocol = IPPROTO_IPIP;
else if (memcmp(p-name, sit, 3) == 0)
p-iph.protocol = IPPROTO_IPV6;
+   else if (memcmp(p-name, isatap, 6) == 0) {
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
}
 
if (p-iph.protocol == IPPROTO_IPIP || p-iph.protocol == IPPROTO_IPV6) 
{
@@ -239,6 +266,20 @@ static int parse_args(int argc, char **a
fprintf(stderr, Broadcast tunnel requires a source 
address.\n);
return -1;
}
+   if (isatap) {
+   if (p-iph.daddr) {
+   fprintf(stderr, no remote with isatap.\n);
+   return -1;
+   }
+   p-i_key = router ? router : INADDR_NONE;
+   p-o_key = lifetime ? lifetime : 120;   /* RFC4214 default */
+   } else {
+   if (router || lifetime) {
+   fprintf(stderr, router/lifetime only for isatap.\n);
+   return -1;
+   }
+   }
+
return 0;
 }
 


Re: [E1000-devel] [PATCH 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Kok, Auke
Patrick McHardy wrote:
 Kok, Auke wrote:
 Joonwoo Park wrote:
 IMHO even though netdevice is in the promiscuous mode, we should receive 
 all of ingress packets.
 This disable the vlan filtering feature when a vlan hw accel configured 
 e1000 device goes into promiscuous mode.
 This make packets visible to sniffers though it's not vlan id of itself.
 Any check, comments will be appreciated.
 Actually I think this patch removes a choice from the user.

 Before this patch, the user can sniff all traffic by disabling vlans, or a
 specific vlan only by leaving vlans on when going into promisc mode.

 After this patch, the user has no choice but to sniff all vlans at all times.

 I don't think that that is such a good improvement.
 
 
 Do you really consider that a realistic choice? Who is going to
 remove interfaces that are in use just to see traffic for other
 VLANs? Sniffing specific VLANs can always be done on the VLAN
 device itself.

right, I had not thought of that.

 IMO its more a question of what we want promiscous mode to mean,
 and I tend to agree with Joonwoo that it should receive all packets.

OK, Joonwoo: can you submit a patch against e1000e as well?

Auke
-
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: 2.6.24-rc1-gb4f5550 oops

2007-11-12 Thread Peter Zijlstra

On Thu, 2007-11-08 at 23:49 +0100, Rafael J. Wysocki wrote:
 On Thursday, 8 of November 2007, Grant Wilson wrote:
  On Thu, 8 Nov 2007 22:42:21 +0100
  Rafael J. Wysocki [EMAIL PROTECTED] wrote:
  
   On Thursday, 8 of November 2007, Grant Wilson wrote:
On Thu, 8 Nov 2007 16:53:10 +0100
Rafael J. Wysocki [EMAIL PROTECTED] wrote:

 On Thursday, 8 of November 2007, Grant Wilson wrote:
  On Thu, 8 Nov 2007 01:06:21 +0100
  Rafael J. Wysocki [EMAIL PROTECTED] wrote:
  
   On Monday, 5 of November 2007, Grant Wilson wrote:
Hi,
I got this oops on 2.6.24-rc1-641-gb4f5550:
   
   (1) Is this reproducible?
   (2) Did it happen previously on your system?
  
   [18073.371126] Unable to handle kernel NULL pointer dereference 
   at 0120 RIP: 
   [18073.371134]  [8023572e] 
   check_preempt_wakeup+0x6e/0x110
  
  This has now happened twice - the second time was last night when
  running 2.6.24-rc2.
  
  Here's that second occurrence:
  
[snip]
 
 Hmm.
 
 Please run gdb vmlinux and see what code corresponds to
 check_preempt_wakeup+0x6e in your kernel.
   

Dump of assembler code for function check_preempt_wakeup:
   
   Well, thanks, but I meant the source code.  Please do gdb vmlinux and 
   then
   l *check_preempt_wakeup+0x6e in gdb.
  
  Here's the requested output:
  
  (gdb) l *check_preempt_wakeup+0x6e
  0x802329ae is in check_preempt_wakeup (kernel/sched_fair.c:668).
  663
  664 /* Do the two (enqueued) entities belong to the same group ? */
  665 static inline int
  666 is_same_group(struct sched_entity *se, struct sched_entity *pse)
  667 {
  668 if (se-cfs_rq == pse-cfs_rq)
  669 return 1;
  670
  671 return 0;
  672 }
 
 Well, it looks like either se or pse is NULL.
 
 Ingo, can you please have a look?

Most puzzling this, it should be guaranteed that the top sched_entities
are of the same group, therefore avoiding this loop into NULL. Obviously
something has gone wrong.

Grant, is there anything specific you can tell us about how to reproduce
this?


-
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 02/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO

  If unsure, say N.

+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
depends on IPV6  EXPERIMENTAL

-
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 01/01] iproute2-2.6.23: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the iproute2-2.6.23
software distribution. The diff text file itself is also
attached and should be suitable for use with the patch
utility.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-12 06:53:38.0 -0800
@@ -39,7 +39,8 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, Usage: ip tunnel { add | change | del | show } [ NAME 
]\n);
-   fprintf(stderr,   [ mode { ipip | gre | sit } ] [ remote ADDR ] [ 
local ADDR ]\n);
+   fprintf(stderr,   [ mode { ipip | gre | sit | isatap } ]\n);
+   fprintf(stderr,   [ remote ADDR ] [ local ADDR ] [ router ADDR ] [ 
lifetime NUMBER ]\n);
fprintf(stderr,   [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n);
fprintf(stderr,   [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev 
PHYS_DEV ]\n);
fprintf(stderr, \n);
@@ -55,6 +56,9 @@ static int parse_args(int argc, char **a
 {
int count = 0;
char medium[IFNAMSIZ];
+   int isatap = 0;
+   unsigned router = 0;
+   unsigned lifetime = 0;

memset(p, 0, sizeof(*p));
memset(medium, 0, sizeof(medium));
@@ -90,6 +94,13 @@ static int parse_args(int argc, char **a
exit(-1);
}
p-iph.protocol = IPPROTO_IPV6;
+   } else if (strcmp(*argv, isatap) == 0) {
+   if (p-iph.protocol  p-iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,You managed to ask for more 
than one tunnel mode.\n);
+   exit(-1);
+   }
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
} else {
fprintf(stderr,Cannot guess tunnel mode.\n);
exit(-1);
@@ -160,6 +171,18 @@ static int parse_args(int argc, char **a
NEXT_ARG();
if (strcmp(*argv, any))
p-iph.saddr = get_addr32(*argv);
+   } else if (strcmp(*argv, router) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, any))
+   router = get_addr32(*argv);
+   } else if (strcmp(*argv, lifetime) == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(uval, *argv, 0)) {
+   invarg(invalid lifetime\n, *argv);
+   exit(-1);
+   }
+   lifetime = uval;
} else if (strcmp(*argv, dev) == 0) {
NEXT_ARG();
strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +235,10 @@ static int parse_args(int argc, char **a
p-iph.protocol = IPPROTO_IPIP;
else if (memcmp(p-name, sit, 3) == 0)
p-iph.protocol = IPPROTO_IPV6;
+   else if (memcmp(p-name, isatap, 6) == 0) {
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
}

if (p-iph.protocol == IPPROTO_IPIP || p-iph.protocol == IPPROTO_IPV6) 
{
@@ -239,6 +266,20 @@ static int parse_args(int argc, char **a
fprintf(stderr, Broadcast tunnel requires a source 
address.\n);
return -1;
}
+   if (isatap) {
+   if (p-iph.daddr) {
+   fprintf(stderr, no remote with isatap.\n);
+   return -1;
+   }
+   p-i_key = router ? router : INADDR_NONE;
+   p-o_key = lifetime ? lifetime : 120;   /* RFC4214 default */
+   } else {
+   if (router || lifetime) {
+   fprintf(stderr, router/lifetime only for isatap.\n);
+   return -1;
+   }
+   }
+
return 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


[PATCH] ethtool: Fix coalesce settings copy+paste typo

2007-11-12 Thread Auke Kok
Coalesce setting errors use the same error messages as the
descriptor ring errors.

Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 ethtool.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index 6c7a2e3..bb9dd59 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1470,7 +1470,7 @@ static int do_scoalesce(int fd, struct ifreq *ifr)
   changed);
 
if (!changed) {
-   fprintf(stderr, no ring parameters changed, aborting\n);
+   fprintf(stderr, no coalesce parameters changed, aborting\n);
return 80;
}
 
@@ -1478,7 +1478,7 @@ static int do_scoalesce(int fd, struct ifreq *ifr)
ifr-ifr_data = (caddr_t)ecoal;
err = ioctl(fd, SIOCETHTOOL, ifr);
if (err) {
-   perror(Cannot set device ring parameters);
+   perror(Cannot set device coalesce parameters);
return 81;
}
 
-
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: 2.6.24-rc1-gb4f5550 oops

2007-11-12 Thread Grant Wilson
On Mon, 12 Nov 2007 19:05:49 +0100
Peter Zijlstra [EMAIL PROTECTED] wrote:

 
 On Thu, 2007-11-08 at 23:49 +0100, Rafael J. Wysocki wrote:
  On Thursday, 8 of November 2007, Grant Wilson wrote:
   On Thu, 8 Nov 2007 22:42:21 +0100
   Rafael J. Wysocki [EMAIL PROTECTED] wrote:
   
On Thursday, 8 of November 2007, Grant Wilson wrote:
 On Thu, 8 Nov 2007 16:53:10 +0100
 Rafael J. Wysocki [EMAIL PROTECTED] wrote:
 
  On Thursday, 8 of November 2007, Grant Wilson wrote:
   On Thu, 8 Nov 2007 01:06:21 +0100
   Rafael J. Wysocki [EMAIL PROTECTED] wrote:
   
On Monday, 5 of November 2007, Grant Wilson wrote:
 Hi,
 I got this oops on 2.6.24-rc1-641-gb4f5550:

(1) Is this reproducible?
(2) Did it happen previously on your system?
   
[18073.371126] Unable to handle kernel NULL pointer dereference 
at 0120 RIP: 
[18073.371134]  [8023572e] 
check_preempt_wakeup+0x6e/0x110
   
   This has now happened twice - the second time was last night when
   running 2.6.24-rc2.
   
   Here's that second occurrence:
   
 [snip]
  
  Hmm.
  
  Please run gdb vmlinux and see what code corresponds to
  check_preempt_wakeup+0x6e in your kernel.

 
 Dump of assembler code for function check_preempt_wakeup:

Well, thanks, but I meant the source code.  Please do gdb vmlinux and 
then
l *check_preempt_wakeup+0x6e in gdb.
   
   Here's the requested output:
   
   (gdb) l *check_preempt_wakeup+0x6e
   0x802329ae is in check_preempt_wakeup (kernel/sched_fair.c:668).
   663
   664 /* Do the two (enqueued) entities belong to the same group ? */
   665 static inline int
   666 is_same_group(struct sched_entity *se, struct sched_entity *pse)
   667 {
   668 if (se-cfs_rq == pse-cfs_rq)
   669 return 1;
   670
   671 return 0;
   672 }
  
  Well, it looks like either se or pse is NULL.
  
  Ingo, can you please have a look?
 
 Most puzzling this, it should be guaranteed that the top sched_entities
 are of the same group, therefore avoiding this loop into NULL. Obviously
 something has gone wrong.
 
 Grant, is there anything specific you can tell us about how to reproduce
 this?

I'm afraid not.  It has only happened twice and both times I was away
from the box in question at the time of failure, so it wasn't doing a
great deal.

I'm running 2.6.24-rc2 on two boxes and both times it happened on the
box running a quad core processor.

Grant

-
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 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */

 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))

+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif

 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }

+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);




-
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


Problems with ULI 526x driver

2007-11-12 Thread Timur Tabi

Hi,

I'm trying to get the ULI 526x driver working on a Freescale 8610 reference 
board, and it can't connect.  When I turn on debug, I see this:


Configuring network interfaces...uli526x: uli526x_open 0
uli526x: uli526x_init() 0
uli526x: uli526x_descriptor_init() 0
uli526x: send_filter_frame() 0
uli526x: uli526x_set_filter_mode() 0
uli526x: Set multicast address 1
uli526x: send_filter_frame() 0
uli526x: uli526x_get_stats 0
uli526x: uli526x_set_filter_mode() 0
uli526x: Set multicast address 2
uli526x: send_filter_frame() 0
ADDRCONF(NETDEV_UP): eth0: link is not ready
uli526x: uli526x_set_filter_mode() 0
uli526x: Set multicast address 2
uli526x: send_filter_frame() 0
uli526x: uli526x_get_stats 0
uli526x: uli526x_set_filter_mode() 0
uli526x: Set multicast address 2
uli526x: send_filter_frame() 0
done.

and then some time later, I see thisL

uli526x: Link link OK 3
uli526x: eth0 NIC Link is Up 100 Mbps Full duplex
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
uli526x: uli526x_set_filter_mode() 0
uli526x: Set multicast address 3
uli526x: send_filter_frame() 0
uli526x: uli526x_get_stats 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0

If I try to ping, I get this:

 ping 10.82.48.106
PING 10.82.48.106 (10.82.48.106) 56(84) bytes of data.
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0
From 10.82.19.159 icmp_seq=2 Destination Host Unreachable
From 10.82.19.159 icmp_seq=3 Destination Host Unreachable
From 10.82.19.159 icmp_seq=4 Destination Host Unreachable
uli526x: uli526x_start_xmit 0
uli526x: uli526x_start_xmit 0


A long time ago, there was a patch for the Tulip driver that added support for 
the ULI 526x.  This support was removed in commit 
ea8f400c98ec9ae0604bc5a6721174ef68635815:


http://git.kernel.org/?p=linux/kernel/git/jgarzik/netdev-2.6.git;a=commit;h=ea8f400c98ec9ae0604bc5a6721174ef68635815

Now, if I revert those changes, the Tulip driver works for me.  So there's 
something that the tulip+uli526x driver does that the stand-alone uli526x driver 
doesn't do.


Unfortunately, I don't really know anything about the tulip or uli526x drivers. 
 Is there anyone who can give me a clue as to what could be wrong?


--
Timur Tabi
Linux kernel developer at Freescale
-
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: Problems with ULI 526x driver

2007-11-12 Thread Timur Tabi

Timur Tabi wrote:

Hi,

I'm trying to get the ULI 526x driver working on a Freescale 8610 
reference board, and it can't connect.  When I turn on debug, I see this:


Update: I can ping anything on my subnet, but nothing else.  Also, it looks like 
my MAC address is hosed:


eth0  Link encap:Ethernet  HWaddr 00:00:00:00:00:00
  inet addr:10.82.19.159  Bcast:10.82.19.255  Mask:255.255.255.0
  inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:5 errors:0 dropped:0 overruns:0 frame:0
  TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:414 (414.0 b)  TX bytes:1224 (1.1 KiB)
  Interrupt:18 Base address:0x1000

It turns out that the driver is getting the MAC address from the ID table:

	if(((u16 *) db-srom)[0] == 0x || ((u16 *) db-srom)[0] == 0)		/* SROM 
absent, so read MAC address from ID Table */

{


In my case, the address that is returned is all zeros.  I don't know anything 
about the ULI 526x hardware.  Is it possible that there's a missing EEPROM on my 
board that's supposed to hold the MAC address?  Are these registers user-writable?


--
Timur Tabi
Linux kernel developer at Freescale
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Eric W. Biederman
Daniel Lezcano [EMAIL PROTECTED] writes:

 Eric W. Biederman wrote:
 Denis V. Lunev [EMAIL PROTECTED] writes:

 Index: linux-2.6-netns/net/ipv6/addrconf.c
 ===
 --- linux-2.6-netns.orig/net/ipv6/addrconf.c
 +++ linux-2.6-netns/net/ipv6/addrconf.c
 @@ -2272,7 +2272,8 @@ static int addrconf_notify(struct notifi
switch(event) {
case NETDEV_REGISTER:
 -  if (!idev  dev-mtu = IPV6_MIN_MTU) {
 +  if (!(dev-flags  IFF_LOOPBACK) 
 +  !idev  dev-mtu = IPV6_MIN_MTU) {

 It is idev being true here for the loopback device that would
 prevent things not missing the REGISTER event.

 Hmm.  But we do call ipv6_add_dev on loopback and now the loopback
 device is practically guaranteed to be the first device so we can
 probably just remove the special case in addrconf_init.

 Anyway Daniels patch makes increasingly less sense the more I look
 at it.

 Let me try to clarify:

  * when the init network namespace is created, the loopback is created first,
 before ipv6, and the notifier call chain for ipv6 is not setup, so the 
 protocol
 does not receive the REGISTER event

  * when the init network namespace is destroyed during shutdown, the loopback 
 is
 not unregistered, so there is no UNREGISTER event

* When addrconf_init calls register_netdevice_notifier we receive
  NETDEV_REGISTER and NETDEV_UP for all network devices that are in
  the system including the loopback device.

  * when we create a new network namespace, a new instance of the loopback is
 created and a NETDEV_REGISTER is sent to ipv6 because the notifier call chain
 has been setup by the init netns (while ipv6 protocol is not yet configured 
 for
 the namespace which is being created)

Possibly there may be some ordering issues here.

  * when the network namespace exits, the loopback is unregistered after the 
 ipv6
 protocol but the NETDEV_UNREGISTER is sent to addrconf_notify while the ipv6
 protocol has been destroyed.


 The objective of the patch is to discard these events because they were never
 taken into account and they are not expected to be receive by ipv6 protocol.

My opinion is that both your analysis is slightly off (as to the cause
of your problems) and that your approach to fix your problem is wrong
because you don't untangle the knot you keep it.



...
I have register_pernet_subsys and register_per_net_device to ensure
that when we create a new network namespace all of the subsystems are
initialized before the network devices are initialize.  So ipv6 should
be ready before we initialize the new loopback device comes into
existence.

The preservation of the order of the network namespace callbacks
ensures that the loopback device will be the first network device
registered, and if it helps we can take advantage of that in reference
to the weirdness from the comment below.

/* The addrconf netdev notifier requires that loopback_dev
 * has it's ipv6 private information allocated and setup
 * before it can bring up and give link-local addresses
 * to other devices which are up.
 *
 * Unfortunately, loopback_dev is not necessarily the first
 * entry in the global dev_base list of net devices.  In fact,
 * it is likely to be the very last entry on that list.
 * So this causes the notifier registry below to try and
 * give link-local addresses to all devices besides loopback_dev
 * first, then loopback_dev, which cases all the non-loopback_dev
 * devices to fail to get a link-local address.
 *
 * So, as a temporary fix, allocate the ipv6 structure for
 * loopback_dev first by hand.
 * Longer term, all of the dependencies ipv6 has upon the loopback
 * device and it being up should be removed.
 */

We can just special case registration of the loopback device to
do:
ip6_null_entry.u.dst.dev = init_net.loopback_dev;
ip6_null_entry.rt6i_idev = in6_dev_get(init_net.loopback_dev);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
ip6_prohibit_entry.u.dst.dev = init_net.loopback_dev;
ip6_prohibit_entry.rt6i_idev = in6_dev_get(init_net.loopback_dev);
ip6_blk_hole_entry.u.dst.dev = init_net.loopback_dev;
ip6_blk_hole_entry.rt6i_idev = in6_dev_get(init_net.loopback_dev);
#endif

Which would remove the special case from addrconf_init.

Eric
-
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 05/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread osprey67

From: Fred L. Templin [EMAIL PROTECTED]

This message attaches the combined diffs from
messages 01/05 through 04/05. This file should be
suitable for use with the patch utility.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---




--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
depends on IPV6  EXPERIMENTAL
--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1491,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
 *  - value 0
 *  - XXX: 

[PATCH][RESEND] NET: Add the helper kernel_sock_shutdown()

2007-11-12 Thread Trond Myklebust
...and fix a couple of bugs in the NBD, CIFS and OCFS2 socket handlers.

Looking at the sock-op-shutdown() handlers, it looks as if all of them
take a SHUT_RD/SHUT_WR/SHUT_RDWR argument instead of the
RCV_SHUTDOWN/SEND_SHUTDOWN arguments.
Add a helper, and then define the SHUT_* enum to ensure that kernel users
of shutdown() don't get confused.

Signed-off-by: Trond Myklebust [EMAIL PROTECTED]
Cc: Paul Clements [EMAIL PROTECTED]
Acked-by: Mark Fasheh [EMAIL PROTECTED]
Cc: Steve French [EMAIL PROTECTED]
Acked-by: David Howells [EMAIL PROTECTED]
Cc: David S. Miller [EMAIL PROTECTED]
---

 drivers/block/nbd.c|3 ++-
 fs/cifs/connect.c  |2 +-
 fs/ocfs2/cluster/tcp.c |4 ++--
 include/linux/net.h|8 
 net/rxrpc/ar-local.c   |4 ++--
 net/socket.c   |6 ++
 6 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6332aca..b4c0888 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -28,6 +28,7 @@
 #include linux/err.h
 #include linux/kernel.h
 #include net/sock.h
+#include linux/net.h
 
 #include asm/uaccess.h
 #include asm/system.h
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
if (lo-sock) {
printk(KERN_WARNING %s: shutting down socket\n,
lo-disk-disk_name);
-   lo-sock-ops-shutdown(lo-sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
+   kernel_sock_shutdown(lo-sock, SHUT_RDWR);
lo-sock = NULL;
}
if (lock)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 1102160..c52a76f 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
if (server-ssocket) {
cFYI(1, (State: 0x%x Flags: 0x%lx, server-ssocket-state,
server-ssocket-flags));
-   server-ssocket-ops-shutdown(server-ssocket, SEND_SHUTDOWN);
+   kernel_sock_shutdown(server-ssocket, SHUT_WR);
cFYI(1, (Post shutdown state: 0x%x Flags: 0x%lx,
server-ssocket-state,
server-ssocket-flags));
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 685c180..d84bd15 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -58,6 +58,7 @@
 #include linux/slab.h
 #include linux/idr.h
 #include linux/kref.h
+#include linux/net.h
 #include net/tcp.h
 
 #include asm/uaccess.h
@@ -616,8 +617,7 @@ static void o2net_shutdown_sc(struct work_struct *work)
del_timer_sync(sc-sc_idle_timeout);
o2net_sc_cancel_delayed_work(sc, sc-sc_keepalive_work);
sc_put(sc);
-   sc-sc_sock-ops-shutdown(sc-sc_sock,
-  RCV_SHUTDOWN|SEND_SHUTDOWN);
+   kernel_sock_shutdown(sc-sc_sock, SHUT_RDWR);
}
 
/* not fatal so failed connects before the other guy has our
diff --git a/include/linux/net.h b/include/linux/net.h
index dd79cdb..596131e 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -95,6 +95,12 @@ enum sock_type {
 
 #endif /* ARCH_HAS_SOCKET_TYPES */
 
+enum sock_shutdown_cmd {
+   SHUT_RD = 0,
+   SHUT_WR = 1,
+   SHUT_RDWR   = 2,
+};
+
 /**
  *  struct socket - general BSD socket
  *  @state: socket state (%SS_CONNECTED, etc)
@@ -223,6 +229,8 @@ extern int kernel_setsockopt(struct socket *sock, int 
level, int optname,
 extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
   size_t size, int flags);
 extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
+extern int kernel_sock_shutdown(struct socket *sock,
+   enum sock_shutdown_cmd how);
 
 #ifndef CONFIG_SMP
 #define SOCKOPS_WRAPPED(name) name
diff --git a/net/rxrpc/ar-local.c b/net/rxrpc/ar-local.c
index fe03f71..f3a2bd7 100644
--- a/net/rxrpc/ar-local.c
+++ b/net/rxrpc/ar-local.c
@@ -114,7 +114,7 @@ static int rxrpc_create_local(struct rxrpc_local *local)
return 0;
 
 error:
-   local-socket-ops-shutdown(local-socket, 2);
+   kernel_sock_shutdown(local-socket, SHUT_RDWR);
local-socket-sk-sk_user_data = NULL;
sock_release(local-socket);
local-socket = NULL;
@@ -267,7 +267,7 @@ static void rxrpc_destroy_local(struct work_struct *work)
/* finish cleaning up the local descriptor */
rxrpc_purge_queue(local-accept_queue);
rxrpc_purge_queue(local-reject_queue);
-   local-socket-ops-shutdown(local-socket, 2);
+   kernel_sock_shutdown(local-socket, SHUT_RDWR);
sock_release(local-socket);
 
up_read(rxrpc_local_sem);
diff --git a/net/socket.c b/net/socket.c
index 5d879fd..74784df 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2319,6 +2319,11 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, 
unsigned long arg)
return err;

Re: [patch 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread Denis V. Lunev
 Let me try to clarify:
 
  * when the init network namespace is created, the loopback is created
 first, before ipv6, and the notifier call chain for ipv6 is not setup,
 so the protocol does not receive the REGISTER event
 
  * when the init network namespace is destroyed during shutdown, the
 loopback is not unregistered, so there is no UNREGISTER event
 
  * when we create a new network namespace, a new instance of the
 loopback is created and a NETDEV_REGISTER is sent to ipv6 because the
 notifier call chain has been setup by the init netns (while ipv6
 protocol is not yet configured for the namespace which is being created)
 
  * when the network namespace exits, the loopback is unregistered after
 the ipv6 protocol but the NETDEV_UNREGISTER is sent to addrconf_notify
 while the ipv6 protocol has been destroyed.

this should not be a problem :). IPv6 exiting code could remove in_dev6
at the protocol layer. In this case the notifier will be noop. This
approach is completely equivalent to the unloading of IPv6 module with
persistent loopback.

The registration is still the problem. May be we need to separate
registration from initialization and perform it after protocol layer for
all loopback devices? I'd like this right now, but this is tight change...

 
 
 The objective of the patch is to discard these events because they were
 never taken into account and they are not expected to be receive by ipv6
 protocol.
 
-
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


[Resend][PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 

-Original Message-
From: osprey67 [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 7:54 AM
To: netdev@vger.kernel.org
Subject: [PATCH 01/05] ipv6: RFC4214 Support (4)

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08
12:05:47.0 -0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0
-0800
@@ -61,6 +61,7 @@
  #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb.
*/
  #define IFF_BONDING0x20/* bonding master or slave
*/
  #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation
*/
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)
*/

  #define IF_GET_IFACE   0x0001  /* for querying only */
  #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09
08:00:32.0 -0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0
-0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
  #define ZERONET(x) (((x)  htonl(0xff00)) ==
htonl(0x))
  #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) ==
htonl(0xE000))

+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) ==
htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) ==
htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
  #endif

  #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09
08:12:29.0 -0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
 addr-s6_addr32[3] == htonl(0x0002));
  }

+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) ==
htonl(0x02005EFE));
+}
+#endif
+
  #ifdef CONFIG_PROC_FS
  extern int if6_proc_init(void);
  extern void if6_proc_exit(void);




-
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
-
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


[Resend] [PATCH 03/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 

-Original Message-
From: osprey67 [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 7:55 AM
To: netdev@vger.kernel.org
Subject: [PATCH 03/05] ipv6: RFC4214 Support (4)

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
  #include net/ip.h
  #include net/netlink.h
  #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
  #include linux/rtnetlink.h

  #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
 return 0;
  }

+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
  static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
  {
 switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui,
 return addrconf_ifid_arcnet(eui, dev);
 case ARPHRD_INFINIBAND:
 return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
 }
 return -1;
  }
@@ -1470,8 +1491,7 @@ regen:
  *
  *  - Reserved subnet anycast (RFC 2526)
  *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
  *  - value 0
  *  - XXX: already assigned to an address on the device
  */
@@ -2201,6 +2221,31 @@ static void addrconf_sit_config(struct n
 return;
 }

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - NBMA link */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct in6_addr addr;
+
+   addrconf_add_lroute(dev);
+
+   ipv6_addr_set(addr,  htonl(0xFE80), 0, 0, 0);
+
+   if (ipv6_generate_eui64(addr.s6_addr + 8, dev) == 0) {
+   struct inet6_ifaddr *ifp;
+
+   ifp = ipv6_add_addr(idev, addr, 64,
+   IFA_LINK, IFA_F_PERMANENT);
+   if (!IS_ERR(ifp)) {
+   addrconf_prefix_route(ifp-addr,
+   ifp-prefix_len, idev-dev, 0, 0);
+   addrconf_dad_start(ifp, 0);
+   in6_ifa_put(ifp);
+   }
+   }
+   return;
+   }
+#endif
+
 sit_add_v4_addrs(idev);

 if (dev-flagsIFF_POINTOPOINT) {
@@ -2531,6 +2576,19 @@ static void addrconf_rs_timer(unsigned l
  *  Announcement received after solicitation
  *  was sent
  */
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - schedule next RS/RA */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t  = netdev_priv(ifp-idev-dev);
+   if (t-parms.i_key != INADDR_NONE) {
+   spin_lock(ifp-lock);
+   ifp-probes = 0;
+   ifp-idev-if_flags = ~(IF_RS_SENT|IF_RA_RCVD);
+   addrconf_mod_timer(ifp, AC_DAD, 
t-parms.o_key*HZ);
+   spin_unlock(ifp-lock);
+   }
+   }
+#endif
 goto out;
 }

@@ -2545,10 +2603,32 @@ static void addrconf_rs_timer(unsigned l
ifp-idev-cnf.rtr_solicit_interval);
 spin_unlock(ifp-lock);

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - unicast RS */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t = netdev_priv(ifp-idev-dev);
+
+   if (t-parms.i_key == INADDR_NONE) goto out;
+
+   ipv6_addr_set(all_routers, htonl(0xFE80), 0, 0, 0);
+ 

[Resend] [PATCH 02/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 

-Original Message-
From: osprey67 [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 7:55 AM
To: netdev@vger.kernel.org
Subject: [PATCH 02/05] ipv6: RFC4214 Support (4)

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO

   If unsure, say N.

+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
  config IPV6_OPTIMISTIC_DAD
 bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
 depends on IPV6  EXPERIMENTAL

-
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
-
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


[Resend] [PATCH 01/01] iproute2-2.6.23: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 

-Original Message-
From: osprey67 [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 7:58 AM
To: netdev@vger.kernel.org
Subject: [PATCH 01/01] iproute2-2.6.23: RFC4214 Support (4)

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the iproute2-2.6.23
software distribution. The diff text file itself is also
attached and should be suitable for use with the patch
utility.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-12 06:53:38.0 -0800
@@ -39,7 +39,8 @@ static void usage(void) __attribute__((n
  static void usage(void)
  {
 fprintf(stderr, Usage: ip tunnel { add | change | del | show } [ NAME 
]\n);
-   fprintf(stderr,   [ mode { ipip | gre | sit } ] [ remote ADDR 
] [ local ADDR ]\n);
+   fprintf(stderr,   [ mode { ipip | gre | sit | isatap } ]\n);
+   fprintf(stderr,   [ remote ADDR ] [ local ADDR ] [ router ADDR 
] [ lifetime NUMBER ]\n);
 fprintf(stderr,   [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n);
 fprintf(stderr,   [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ 
dev PHYS_DEV ]\n);
 fprintf(stderr, \n);
@@ -55,6 +56,9 @@ static int parse_args(int argc, char **a
  {
 int count = 0;
 char medium[IFNAMSIZ];
+   int isatap = 0;
+   unsigned router = 0;
+   unsigned lifetime = 0;

 memset(p, 0, sizeof(*p));
 memset(medium, 0, sizeof(medium));
@@ -90,6 +94,13 @@ static int parse_args(int argc, char **a
 exit(-1);
 }
 p-iph.protocol = IPPROTO_IPV6;
+   } else if (strcmp(*argv, isatap) == 0) {
+   if (p-iph.protocol  p-iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,You managed to ask for 
more than one tunnel mode.\n);
+   exit(-1);
+   }
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
 } else {
 fprintf(stderr,Cannot guess tunnel mode.\n);
 exit(-1);
@@ -160,6 +171,18 @@ static int parse_args(int argc, char **a
 NEXT_ARG();
 if (strcmp(*argv, any))
 p-iph.saddr = get_addr32(*argv);
+   } else if (strcmp(*argv, router) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, any))
+   router = get_addr32(*argv);
+   } else if (strcmp(*argv, lifetime) == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(uval, *argv, 0)) {
+   invarg(invalid lifetime\n, *argv);
+   exit(-1);
+   }
+   lifetime = uval;
 } else if (strcmp(*argv, dev) == 0) {
 NEXT_ARG();
 strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +235,10 @@ static int parse_args(int argc, char **a
 p-iph.protocol = IPPROTO_IPIP;
 else if (memcmp(p-name, sit, 3) == 0)
 p-iph.protocol = IPPROTO_IPV6;
+   else if (memcmp(p-name, isatap, 6) == 0) {
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
 }

 if (p-iph.protocol == IPPROTO_IPIP || p-iph.protocol == 
IPPROTO_IPV6) {
@@ -239,6 +266,20 @@ static int parse_args(int argc, char **a
 fprintf(stderr, Broadcast tunnel requires a source 
address.\n);
 return -1;
 }
+   if (isatap) {
+   if (p-iph.daddr) {
+   fprintf(stderr, no remote with isatap.\n);
+   return -1;
+   }
+   p-i_key = router ? router : INADDR_NONE;
+   p-o_key = lifetime ? lifetime : 120;   /* RFC4214 default */
+   } else {
+   if (router || lifetime) {
+   fprintf(stderr, router/lifetime only for isatap.\n);
+   return -1;
+   }
+   }
+
 return 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
-
To unsubscribe from this list: send the line 

[Resend(2)] [PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 

-Original Message-
From: osprey67 [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 7:54 AM
To: netdev@vger.kernel.org
Subject: [PATCH 01/05] ipv6: RFC4214 Support (4)

From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
  #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
  #define IFF_BONDING0x20/* bonding master or slave  */
  #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */

  #define IF_GET_IFACE   0x0001  /* for querying only */
  #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
  #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
  #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))

+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
  #endif

  #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
 addr-s6_addr32[3] == htonl(0x0002));
  }

+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
  #ifdef CONFIG_PROC_FS
  extern int if6_proc_init(void);
  extern void if6_proc_exit(void);




-
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
-
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 01/04] ipv6: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using extensions to the
iproute2 utility.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
-
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 03/05] ipv6: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using extensions to the
iproute2 utility.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1491,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
 *  - value 0
 *  - XXX: already assigned to an address on the device
 */
@@ -2201,6 +2221,31 @@ static void addrconf_sit_config(struct n
return;
}
 
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - NBMA link */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct in6_addr addr;
+
+   addrconf_add_lroute(dev);
+
+   ipv6_addr_set(addr,  htonl(0xFE80), 0, 0, 0);
+
+   if (ipv6_generate_eui64(addr.s6_addr + 8, dev) == 0) {
+   struct inet6_ifaddr *ifp;
+
+   ifp = ipv6_add_addr(idev, addr, 64,
+   IFA_LINK, IFA_F_PERMANENT);
+   if (!IS_ERR(ifp)) {
+   addrconf_prefix_route(ifp-addr,
+   ifp-prefix_len, idev-dev, 0, 0);
+   addrconf_dad_start(ifp, 0);
+   in6_ifa_put(ifp);
+   }
+   }
+   return;
+   }
+#endif
+
sit_add_v4_addrs(idev);
 
if (dev-flagsIFF_POINTOPOINT) {
@@ -2531,6 +2576,19 @@ static void addrconf_rs_timer(unsigned l
 *  Announcement received after solicitation
 *  was sent
 */
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - schedule next RS/RA */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t  = netdev_priv(ifp-idev-dev);
+   if (t-parms.i_key != INADDR_NONE) {
+   spin_lock(ifp-lock);
+   ifp-probes = 0;
+   ifp-idev-if_flags = ~(IF_RS_SENT|IF_RA_RCVD);
+   addrconf_mod_timer(ifp, AC_DAD, 
t-parms.o_key*HZ);
+   spin_unlock(ifp-lock);
+   }
+   }
+#endif
goto out;
}
 
@@ -2545,10 +2603,32 @@ static void addrconf_rs_timer(unsigned l
   ifp-idev-cnf.rtr_solicit_interval);
spin_unlock(ifp-lock);
 
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - unicast RS */
+   if (ifp-idev-dev-priv_flags  IFF_ISATAP) {
+   struct ip_tunnel *t = netdev_priv(ifp-idev-dev);
+
+   if (t-parms.i_key == INADDR_NONE) goto out;
+
+   ipv6_addr_set(all_routers, htonl(0xFE80), 0, 0, 0);
+   addrconf_ifid_isatap(all_routers.s6_addr + 8, 
t-parms.i_key);
+   } else
+#endif
ipv6_addr_all_routers(all_routers);
 
ndisc_send_rs(ifp-idev-dev, ifp-addr, all_routers);

[PATCH 04/04] ipv6: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using extensions to the
iproute2 utility.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/sit.c.orig2007-11-08 12:03:41.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/sit.c 2007-11-12 07:13:13.0 -0800
@@ -16,6 +16,7 @@
  * Changes:
  * Roger Venning [EMAIL PROTECTED]:  6to4 support
  * Nate Thompson [EMAIL PROTECTED]:  6to4 support
+ * Fred L. Templin [EMAIL PROTECTED]:isatap support
  */
 
 #include linux/module.h
@@ -182,6 +183,11 @@ static struct ip_tunnel * ipip6_tunnel_l
dev-init = ipip6_tunnel_init;
nt-parms = *parms;
 
+#if defined(CONFIG_IPV6_ISATAP)
+   if (parms-i_key)
+   dev-priv_flags |= IFF_ISATAP;
+#endif
+
if (register_netdevice(dev)  0) {
free_netdev(dev);
goto failed;
@@ -382,6 +388,48 @@ static int ipip6_rcv(struct sk_buff *skb
IPCB(skb)-flags = 0;
skb-protocol = htons(ETH_P_IPV6);
skb-pkt_type = PACKET_HOST;
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - check source address */
+   if (tunnel-dev-priv_flags  IFF_ISATAP) {
+   struct neighbour *neigh;
+   struct dst_entry *dst;
+   struct flowi fl;
+   struct in6_addr *addr6;
+   struct ipv6hdr *iph6;
+
+   /* from ISATAP router */
+   if ((tunnel-parms.i_key != INADDR_NONE) 
+   (iph-saddr == tunnel-parms.i_key)) goto accept;
+
+   iph6 = ipv6_hdr(skb);
+   addr6 = iph6-saddr;
+
+   /* from legitimate previous hop */
+   memset(fl, 0, sizeof(fl));
+   fl.proto = iph6-nexthdr;
+   ipv6_addr_copy(fl.fl6_dst, addr6);
+   fl.oif = tunnel-dev-ifindex;
+   security_skb_classify_flow(skb, fl);
+
+   if (!(dst = ip6_route_output(NULL, fl)) ||
+(dst-dev != tunnel-dev) ||
+((neigh = dst-neighbour) == NULL)) goto drop;
+
+   addr6 = (struct in6_addr*)neigh-primary_key;
+
+   if (!(ipv6_addr_is_isatap(addr6)) ||
+(addr6-s6_addr32[3] != iph-saddr)) {
+drop:
+   tunnel-stat.rx_errors++;
+   read_unlock(ipip6_lock);
+   dst_release(dst);
+   kfree_skb(skb);
+   return 0;
+   }
+   dst_release(dst);
+   }
+accept:
+#endif
tunnel-stat.rx_packets++;
tunnel-stat.rx_bytes += skb-len;
skb-dev = tunnel-dev;
@@ -444,6 +492,31 @@ static int ipip6_tunnel_xmit(struct sk_b
if (skb-protocol != htons(ETH_P_IPV6))
goto tx_error;
 
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - must come before 6to4 */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct neighbour *neigh = NULL;
+
+   if (skb-dst)
+   neigh = skb-dst-neighbour;
+
+   if (neigh == NULL) {
+   if (net_ratelimit())
+   printk(KERN_DEBUG sit: nexthop == NULL\n);
+   goto tx_error;
+   }
+
+   addr6 = (struct in6_addr*)neigh-primary_key;
+   addr_type = ipv6_addr_type(addr6);
+
+   if ((addr_type  IPV6_ADDR_UNICAST) 
+ipv6_addr_is_isatap(addr6))
+   dst = addr6-s6_addr32[3];
+   else
+   goto tx_error;
+   }
+#endif
+
if (!dst)
dst = try_6to4(iph6-daddr);
 
@@ -651,6 +724,10 @@ ipip6_tunnel_ioctl (struct net_device *d
ipip6_tunnel_unlink(t);
t-parms.iph.saddr = p.iph.saddr;
t-parms.iph.daddr = p.iph.daddr;
+#if defined(CONFIG_IPV6_ISATAP)
+   t-parms.i_key = p.i_key;
+   t-parms.o_key = p.o_key;
+#endif
memcpy(dev-dev_addr, p.iph.saddr, 4);
memcpy(dev-broadcast, p.iph.daddr, 4);
ipip6_tunnel_link(t);
@@ -663,6 +740,10 @@ ipip6_tunnel_ioctl (struct net_device *d
if (cmd == SIOCCHGTUNNEL) {
t-parms.iph.ttl 

[PATCH 02/04] ipv6: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using extensions to the
iproute2 utility.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
depends on IPV6  EXPERIMENTAL
-
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 01/01] iproute2-2.6.23: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
ip utility with device names beginning with: isatap.

The following diffs are specific to the iproute2-2.6.23
software distribution. The diff text file itself is also
attached and should be suitable for use with the patch
utility.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-12 06:53:38.0 -0800
@@ -39,7 +39,8 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, Usage: ip tunnel { add | change | del | show } [ NAME 
]\n);
-   fprintf(stderr,   [ mode { ipip | gre | sit } ] [ remote ADDR 
] [ local ADDR ]\n);
+   fprintf(stderr,   [ mode { ipip | gre | sit | isatap } ]\n);
+   fprintf(stderr,   [ remote ADDR ] [ local ADDR ] [ router ADDR 
] [ lifetime NUMBER ]\n);
fprintf(stderr,   [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n);
fprintf(stderr,   [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ 
dev PHYS_DEV ]\n);
fprintf(stderr, \n);
@@ -55,6 +56,9 @@ static int parse_args(int argc, char **a
 {
int count = 0;
char medium[IFNAMSIZ];
+   int isatap = 0;
+   unsigned router = 0;
+   unsigned lifetime = 0;
 
memset(p, 0, sizeof(*p));
memset(medium, 0, sizeof(medium));
@@ -90,6 +94,13 @@ static int parse_args(int argc, char **a
exit(-1);
}
p-iph.protocol = IPPROTO_IPV6;
+   } else if (strcmp(*argv, isatap) == 0) {
+   if (p-iph.protocol  p-iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,You managed to ask for 
more than one tunnel mode.\n);
+   exit(-1);
+   }
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
} else {
fprintf(stderr,Cannot guess tunnel mode.\n);
exit(-1);
@@ -160,6 +171,18 @@ static int parse_args(int argc, char **a
NEXT_ARG();
if (strcmp(*argv, any))
p-iph.saddr = get_addr32(*argv);
+   } else if (strcmp(*argv, router) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, any))
+   router = get_addr32(*argv);
+   } else if (strcmp(*argv, lifetime) == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(uval, *argv, 0)) {
+   invarg(invalid lifetime\n, *argv);
+   exit(-1);
+   }
+   lifetime = uval;
} else if (strcmp(*argv, dev) == 0) {
NEXT_ARG();
strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +235,10 @@ static int parse_args(int argc, char **a
p-iph.protocol = IPPROTO_IPIP;
else if (memcmp(p-name, sit, 3) == 0)
p-iph.protocol = IPPROTO_IPV6;
+   else if (memcmp(p-name, isatap, 6) == 0) {
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
}
 
if (p-iph.protocol == IPPROTO_IPIP || p-iph.protocol == IPPROTO_IPV6) 
{
@@ -239,6 +266,20 @@ static int parse_args(int argc, char **a
fprintf(stderr, Broadcast tunnel requires a source 
address.\n);
return -1;
}
+   if (isatap) {
+   if (p-iph.daddr) {
+   fprintf(stderr, no remote with isatap.\n);
+   return -1;
+   }
+   p-i_key = router ? router : INADDR_NONE;
+   p-o_key = lifetime ? lifetime : 120;   /* RFC4214 default */
+   } else {
+   if (router || lifetime) {
+   fprintf(stderr, router/lifetime only for isatap.\n);
+   return -1;
+   }
+   }
+
return 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: [Resend][PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Vlad Yasevich
Hi Fred

First, are you breaking up the functionality into multiple
patches _only_ to ease review and plan to submit the final
version as a big patch?

The reason I ask, is that you Patch 02, which adds Kconfig
pieces could break compilations if the functionality is
enabled.


Templin, Fred L wrote:
  
 
 -Original Message-
 From: osprey67 [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 12, 2007 7:54 AM
 To: netdev@vger.kernel.org
 Subject: [PATCH 01/05] ipv6: RFC4214 Support (4)
 
 From: Fred L. Templin [EMAIL PROTECTED]
 
 This is experimental support for the Intra-Site Automatic
 Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
 the SIT module, and is configured using the unmodified
 ip utility with device names beginning with: isatap.
 
 The following diffs are specific to the Linux 2.6.24-rc2
 kernel distribution.
 
 Signed-off-by: Fred L. Templin [EMAIL PROTECTED]
 
 ---
 
 --- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08
 12:05:47.0 -0800
 +++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0
 -0800
 @@ -61,6 +61,7 @@
   #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb.
 */
   #define IFF_BONDING0x20/* bonding master or slave
 */
   #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation
 */
 +#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)
 */
 
   #define IF_GET_IFACE   0x0001  /* for querying only */
   #define IF_GET_PROTO   0x0002
 --- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09
 08:00:32.0 -0800
 +++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0
 -0800
 @@ -253,6 +253,14 @@ struct sockaddr_in {
   #define ZERONET(x) (((x)  htonl(0xff00)) ==
 htonl(0x))
   #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) ==
 htonl(0xE000))
 
 +/* Special-Use IPv4 Addresses (RFC3330) */
 +#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
 +#define LINKLOCAL_169(x) (((x)  htonl(0x)) ==
 htonl(0xA9FE))
 +#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
 +#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
 +#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) ==
 htonl(0xC0586300))
 +#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
 +#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
   #endif
 
   #endif /* _LINUX_IN_H */
 --- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08
 12:06:17.0 -0800
 +++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09
 08:12:29.0 -0800
 @@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
  addr-s6_addr32[3] == htonl(0x0002));
   }
 
 +#if defined(CONFIG_IPV6_ISATAP)
 +/* only for IFF_ISATAP interfaces */
 +static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
 +{
 +   return ((addr-s6_addr32[2] | htonl(0x0200)) ==
 htonl(0x02005EFE));
 +}
 +#endif
 +

I don't see the need for the # if above.

-vlad

-
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: [Resend][PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
Vlad,

Yes, I was breaking into multiples to ease review only.
The [PATCH 01/04] ... (5) thread includes the complete
reviewable and patchable final text in 4 files. In my
next message, I will put the entire patchfile as inline
text. (The [PATCH 01/01] ... (5) for 'iproute2' is
already complete.)

Thanks - Fred
[EMAIL PROTECTED]  

 -Original Message-
 From: Vlad Yasevich [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 12, 2007 2:11 PM
 To: Templin, Fred L
 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [Resend][PATCH 01/05] ipv6: RFC4214 Support (4)
 
 Hi Fred
 
 First, are you breaking up the functionality into multiple
 patches _only_ to ease review and plan to submit the final
 version as a big patch?
 
 The reason I ask, is that you Patch 02, which adds Kconfig
 pieces could break compilations if the functionality is
 enabled.
 
 
 Templin, Fred L wrote:
   
  
  -Original Message-
  From: osprey67 [mailto:[EMAIL PROTECTED] 
  Sent: Monday, November 12, 2007 7:54 AM
  To: netdev@vger.kernel.org
  Subject: [PATCH 01/05] ipv6: RFC4214 Support (4)
  
  From: Fred L. Templin [EMAIL PROTECTED]
  
  This is experimental support for the Intra-Site Automatic
  Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
  the SIT module, and is configured using the unmodified
  ip utility with device names beginning with: isatap.
  
  The following diffs are specific to the Linux 2.6.24-rc2
  kernel distribution.
  
  Signed-off-by: Fred L. Templin [EMAIL PROTECTED]
  
  ---
  
  --- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08
  12:05:47.0 -0800
  +++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 
 08:26:44.0
  -0800
  @@ -61,6 +61,7 @@
#define IFF_MASTER_ALB 0x10/* bonding master, 
 balance-alb.
  */
#define IFF_BONDING0x20/* bonding master or slave
  */
#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation
  */
  +#define IFF_ISATAP 0x80/* ISATAP interface 
 (RFC4214)
  */
  
#define IF_GET_IFACE   0x0001  /* for querying only */
#define IF_GET_PROTO   0x0002
  --- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09
  08:00:32.0 -0800
  +++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 
 07:37:05.0
  -0800
  @@ -253,6 +253,14 @@ struct sockaddr_in {
#define ZERONET(x) (((x)  htonl(0xff00)) ==
  htonl(0x))
#define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) ==
  htonl(0xE000))
  
  +/* Special-Use IPv4 Addresses (RFC3330) */
  +#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == 
 htonl(0x0A00))
  +#define LINKLOCAL_169(x) (((x)  htonl(0x)) ==
  htonl(0xA9FE))
  +#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == 
 htonl(0xAC10))
  +#define TEST_192(x)(((x)  htonl(0xff00)) == 
 htonl(0xC200))
  +#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) ==
  htonl(0xC0586300))
  +#define PRIVATE_192(x) (((x)  htonl(0x)) == 
 htonl(0xC0A8))
  +#define TEST_198(x)(((x)  htonl(0xfffe)) == 
 htonl(0xC612))
#endif
  
#endif /* _LINUX_IN_H */
  --- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08
  12:06:17.0 -0800
  +++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09
  08:12:29.0 -0800
  @@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
   addr-s6_addr32[3] == htonl(0x0002));
}
  
  +#if defined(CONFIG_IPV6_ISATAP)
  +/* only for IFF_ISATAP interfaces */
  +static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
  +{
  +   return ((addr-s6_addr32[2] | htonl(0x0200)) ==
  htonl(0x02005EFE));
  +}
  +#endif
  +
 
 I don't see the need for the # if above.
 
 -vlad
 
 
-
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 05/05] ipv6: RFC4214 Support (5)

2007-11-12 Thread Templin, Fred L
 
From: Fred L. Templin [EMAIL PROTECTED]

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using extensions to the
iproute2 utility.

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution. This message includes the full and patchable
diff text.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_ISATAP
+   bool IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the ip utility
+ with device names beginning with: isatap.
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
depends on IPV6  EXPERIMENTAL
--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 07:04:27.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,22 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1451,11 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1491,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - 

Re: [Resend][PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Vlad Yasevich
Hi Fred

Templin, Fred L wrote:
 Vlad,
 
 Yes, I was breaking into multiples to ease review only.
 The [PATCH 01/04] ... (5) thread includes the complete
 reviewable and patchable final text in 4 files. In my
 next message, I will put the entire patchfile as inline
 text. (The [PATCH 01/01] ... (5) for 'iproute2' is
 already complete.)
 

Ok, thanks for the explanation.  One questions is though why
do we need all the #if defines() throughout the file?

Most distros end up enabled almost everything anyway.  Looking
at the code, there is really nothing that needs a conditional.
Removing the conditionals would make things cleaner.

Just some of my thoughts.

Thanks
-vlad
-
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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread David Miller
From: Denis V. Lunev [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 19:49:03 +0300

 Unregister for a loopback in !init_net is a _valid_ operation and should
 be clean, i.e. without kludges in the path. This is the only way to
 check the ref-counting.

For ipv6 the stack really wants to pin down the loopback
device because we need a valid inet6_dev object to reference
at all times in order to simplify the per-device SNMP
statistic bumping.

When a non-loopback device goes down, we point any existing
references to that device's idev to the loopback one instead.

I really consider taking down the loopback device to be
an invalid operation at least how things are implemented
currently.

There was a suggestion to have a dummy device that takes the
place of point dangling idev refs to loopback's one.  But
some people get upset when statistical events get lost, and
rightly so.  Such a dummy device would either need to be
invisible to the user, or show up and be utterly confusing.

-
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: [Resend][PATCH 01/05] ipv6: RFC4214 Support (4)

2007-11-12 Thread Templin, Fred L
 Ok, thanks for the explanation.  One questions is though why
 do we need all the #if defines() throughout the file?

Was just trying to follow what I thought was
convention, but I'm willing to be educated...

 Most distros end up enabled almost everything anyway.  Looking
 at the code, there is really nothing that needs a conditional.
 Removing the conditionals would make things cleaner.

Works for me unless there are any objections. Anyone?

Fred
[EMAIL PROTECTED]
 
 Just some of my thoughts.
 
 Thanks
 -vlad
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread David Miller
From: Kok, Auke [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 09:12:40 -0800

 Actually I think this patch removes a choice from the user.
 
 Before this patch, the user can sniff all traffic by disabling vlans, or a
 specific vlan only by leaving vlans on when going into promisc mode.
 
 After this patch, the user has no choice but to sniff all vlans at all times.
 
 I don't think that that is such a good improvement.

I agree.

Look at the VLAN setting as being just like moving the
ethernet cable from one switch to another.

There is no logical difference.
-
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] sungem: fix suspend regression due to NAPI changes

2007-11-12 Thread Benjamin Herrenschmidt

On Mon, 2007-11-12 at 18:45 +0100, Johannes Berg wrote:
 Commit bea3348e (the NAPI changes) made sungem unconditionally enable
 NAPI when resuming and unconditionally disable when suspending, this,
 however, makes napi_disable() hang when suspending when the interface
 was taken down before suspend because taking the interface down also
 disables NAPI. This patch makes touching the napi struct in
 suspend/resume code paths depend on having the interface up, thereby
 fixing the hang on suspend.
 
 The patch also moves the napi_disable() in gem_close() under the lock so
 that the NAPI state is always modified atomically together with the
 opened variable.
 
 Signed-off-by: Johannes Berg [EMAIL PROTECTED]

Thanks for fixing that !

Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 ---
  drivers/net/sungem.c |   11 +--
  1 file changed, 5 insertions(+), 6 deletions(-)
 
 --- everything.orig/drivers/net/sungem.c  2007-11-12 18:22:49.948748047 
 +0100
 +++ everything/drivers/net/sungem.c   2007-11-12 18:24:30.708748481 +0100
 @@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *
  {
   struct gem *gp = dev-priv;
  
 - napi_disable(gp-napi);
 -
   mutex_lock(gp-pm_mutex);
  
 + napi_disable(gp-napi);
 +
   gp-opened = 0;
   if (!gp-asleep)
   gem_do_stop(dev, 0);
 @@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *p
  
   mutex_lock(gp-pm_mutex);
  
 - napi_disable(gp-napi);
 -
   printk(KERN_INFO %s: suspending, WakeOnLan %s\n,
  dev-name,
  (gp-wake_on_lan  gp-opened) ? enabled : disabled);
 @@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *p
  
   /* If the driver is opened, we stop the MAC */
   if (gp-opened) {
 + napi_disable(gp-napi);
 +
   /* Stop traffic, mark us closed */
   netif_device_detach(dev);
  
 @@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pd
   /* Re-attach net device */
   netif_device_attach(dev);
  
 + napi_enable(gp-napi);
   }
  
   spin_lock_irqsave(gp-lock, flags);
 @@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pd
   spin_unlock(gp-tx_lock);
   spin_unlock_irqrestore(gp-lock, flags);
  
 - napi_enable(gp-napi);
 -
   mutex_unlock(gp-pm_mutex);
  
   return 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 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 18:21:35 +0100

 Do you really consider that a realistic choice? Who is going to
 remove interfaces that are in use just to see traffic for other
 VLANs? Sniffing specific VLANs can always be done on the VLAN
 device itself.

Change the example to wanting to see traffic on another
physical switch.

How is this any different?

 IMO its more a question of what we want promiscous mode to mean,
 and I tend to agree with Joonwoo that it should receive all packets.

On what LAN?

When you select VLAN, you by definition are asking for non-VLAN
traffic to be elided.  It is like plugging the ethernet cable
into one switch or another.
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Chris Friesen

David Miller wrote:


When you select VLAN, you by definition are asking for non-VLAN
traffic to be elided.  It is like plugging the ethernet cable
into one switch or another.


For max functionality it seems like the raw eth device should show 
everything on the wire in promiscuous mode.


If we want to sniff only the traffic for a specific vlan, we can sniff 
the vlan device.


Chris
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Kok, Auke
Chris Friesen wrote:
 David Miller wrote:
 
 When you select VLAN, you by definition are asking for non-VLAN
 traffic to be elided.  It is like plugging the ethernet cable
 into one switch or another.
 
 For max functionality it seems like the raw eth device should show
 everything on the wire in promiscuous mode.
 
 If we want to sniff only the traffic for a specific vlan, we can sniff
 the vlan device.

actually the impact can be quite negative, imagine doing a tcpdump on a 10gig
interface with vlan's enabled - all of a sudden you might accidentally flood the
system with a 100-fold increase in traffic and force the stack to dump all those
packets for you.

I'm still very reluctant about this patch, I think the current situation is OK 
for
everyone and offers everyone the possibility to do what they need, without 
hidden
consequences.

Auke
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread David Miller
From: Chris Friesen [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 16:43:24 -0600

 David Miller wrote:
 
  When you select VLAN, you by definition are asking for non-VLAN
  traffic to be elided.  It is like plugging the ethernet cable
  into one switch or another.
 
 For max functionality it seems like the raw eth device should show 
 everything on the wire in promiscuous mode.
 
 If we want to sniff only the traffic for a specific vlan, we can sniff 
 the vlan device.

VLAN settings are a filter of sorts, much like plugging into
one switch or another filters traffic physically.

If you don't want that filter, turn the VLAN settings off.
-
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: [RFC][BNX2X] .h files rewrite

2007-11-12 Thread Ram Pai


On Sun, 2007-11-04 at 09:47 +0200, Eliezer Tamir wrote:
 On Fri, 2007-11-02 at 16:35 -0700, Max Asbock wrote:
 
  I built the newest bnx2x code against the net-2.6 kernel and ran a
  number of stress tests with netperf and pktgen. I did not encounter
  any
  errors.
  
  Max
  
  
 Thanks,

Dave/Jeff,

What is the current outlook for this driver? 
Is it ready for upstream?

thanks,
RP


 Eliezer
 
 
 -
 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

-
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: [RFC][BNX2X] .h files rewrite

2007-11-12 Thread David Miller
From: Ram Pai [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 15:13:23 -0800

 
 
 On Sun, 2007-11-04 at 09:47 +0200, Eliezer Tamir wrote:
  On Fri, 2007-11-02 at 16:35 -0700, Max Asbock wrote:
  
   I built the newest bnx2x code against the net-2.6 kernel and ran a
   number of stress tests with netperf and pktgen. I did not encounter
   any
   errors.
   
   Max
   
   
  Thanks,
 
 Dave/Jeff,
   
 What is the current outlook for this driver? 
   Is it ready for upstream?

Yes, I intend to add it for 2.6.25
-
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 01/01] ipv6: RFC4214 Support (v2.0)

2007-11-12 Thread Templin, Fred L

From: Fred L. Templin [EMAIL PROTECTED]

This patch includes support for the Intra-Site Automatic Tunnel
Addressing Protocol (ISATAP) per RFC4214. It uses the SIT
module, and is configured using extensions to the iproute2
utility.

The following diffs are specific to the Linux 2.6.24-rc2 kernel
distribution. This message includes the full and patchable diff text;
please use this version to apply patches.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-12 07:37:05.0 -0800
@@ -253,6 +253,14 @@ struct sockaddr_in {
 #define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
+#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-12 14:29:51.0 
-0800
@@ -241,6 +241,12 @@ static inline int ipv6_addr_is_ll_all_ro
addr-s6_addr32[3] == htonl(0x0002));
 }
 
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr-s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-12 14:32:43.0 
-0800
@@ -75,7 +75,7 @@
 #include net/ip.h
 #include net/netlink.h
 #include net/pkt_sched.h
-#include linux/if_tunnel.h
+#include net/ipip.h
 #include linux/rtnetlink.h
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,20 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, addr, 4);
+
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] = ~0x02;
+
+   return 0;
+}
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev-type) {
@@ -1435,6 +1449,9 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+   case ARPHRD_SIT:
+   if (dev-priv_flags  IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev-dev_addr);
}
return -1;
 }
@@ -1470,8 +1487,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx
 *  - value 0
 *  - XXX: already assigned to an address on the device
 */
@@ -2201,6 +2217,29 @@ static void addrconf_sit_config(struct n
return;
}
 
+   /* ISATAP (RFC4214) - NBMA link */
+   if (dev-priv_flags  IFF_ISATAP) {
+   struct in6_addr addr;
+
+   addrconf_add_lroute(dev);
+
+   ipv6_addr_set(addr,  htonl(0xFE80), 0, 0, 0);
+
+   if (ipv6_generate_eui64(addr.s6_addr + 8, dev) == 0) {
+   struct inet6_ifaddr *ifp;
+
+   ifp = ipv6_add_addr(idev, addr, 64,
+   IFA_LINK, IFA_F_PERMANENT);
+   if (!IS_ERR(ifp)) {
+ 

Re: [PATCH 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Willy Tarreau
On Mon, Nov 12, 2007 at 02:57:16PM -0800, David Miller wrote:
 From: Chris Friesen [EMAIL PROTECTED]
 Date: Mon, 12 Nov 2007 16:43:24 -0600
 
  David Miller wrote:
  
   When you select VLAN, you by definition are asking for non-VLAN
   traffic to be elided.  It is like plugging the ethernet cable
   into one switch or another.
  
  For max functionality it seems like the raw eth device should show 
  everything on the wire in promiscuous mode.
  
  If we want to sniff only the traffic for a specific vlan, we can sniff 
  the vlan device.
 
 VLAN settings are a filter of sorts, much like plugging into
 one switch or another filters traffic physically.
 
 If you don't want that filter, turn the VLAN settings off.

I don't really agree with that view. Having spent a lot of time with
tcpdump on production systems, I can say that sometimes you'd like to
be aware that one of your VLANs is wrong and you'd simply like to
sniff the wire to guess the correct tag. And on production, you simply
cannot remove other VLANs, otherwise you disrupt the service.

Basically, what generally happens is that the guy responsible for the
switch tells you it's OK now, but for you it isn't and you cannot
access the switch.

If the solution is to disable VLAN hardware acceleration, I agree that
it is very risky to do that without the user being aware of it. But at
least we should be able to do this by any means (eg: ethtool) without
disabling what's running.

And since you made the parallel with a switch, when you receive tagged
traffic on a switch port, you generally can mirror that port to another
one and catch all VLANs at once. A new feature that is starting to appear
is the ability to mirror tagged traffic to a VLAN on another port (which
means you get a double 802.1q tag). This is useful for inter-site links
between data-centers for instance.

Regards,
Willy

-
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 01/01] iproute2-2.6.23: RFC4214 Support (v2.0)

2007-11-12 Thread Templin, Fred L
From: Fred L. Templin [EMAIL PROTECTED]

This patch includes support for the Intra-Site Automatic Tunnel
Addressing Protocol (ISATAP) per RFC4214.

The following diffs are specific to the iproute2-2.6.23
software distribution. This message includes the full and
patchable diff text; please use this version to apply patches.

Signed-off-by: Fred L. Templin [EMAIL PROTECTED]

---

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-12 06:53:38.0 -0800
@@ -39,7 +39,8 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, Usage: ip tunnel { add | change | del | show } [ NAME 
]\n);
-   fprintf(stderr,   [ mode { ipip | gre | sit } ] [ remote ADDR 
] [ local ADDR ]\n);
+   fprintf(stderr,   [ mode { ipip | gre | sit | isatap } ]\n);
+   fprintf(stderr,   [ remote ADDR ] [ local ADDR ] [ router ADDR 
] [ lifetime NUMBER ]\n);
fprintf(stderr,   [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n);
fprintf(stderr,   [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ 
dev PHYS_DEV ]\n);
fprintf(stderr, \n);
@@ -55,6 +56,9 @@ static int parse_args(int argc, char **a
 {
int count = 0;
char medium[IFNAMSIZ];
+   int isatap = 0;
+   unsigned router = 0;
+   unsigned lifetime = 0;
 
memset(p, 0, sizeof(*p));
memset(medium, 0, sizeof(medium));
@@ -90,6 +94,13 @@ static int parse_args(int argc, char **a
exit(-1);
}
p-iph.protocol = IPPROTO_IPV6;
+   } else if (strcmp(*argv, isatap) == 0) {
+   if (p-iph.protocol  p-iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,You managed to ask for 
more than one tunnel mode.\n);
+   exit(-1);
+   }
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
} else {
fprintf(stderr,Cannot guess tunnel mode.\n);
exit(-1);
@@ -160,6 +171,18 @@ static int parse_args(int argc, char **a
NEXT_ARG();
if (strcmp(*argv, any))
p-iph.saddr = get_addr32(*argv);
+   } else if (strcmp(*argv, router) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, any))
+   router = get_addr32(*argv);
+   } else if (strcmp(*argv, lifetime) == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(uval, *argv, 0)) {
+   invarg(invalid lifetime\n, *argv);
+   exit(-1);
+   }
+   lifetime = uval;
} else if (strcmp(*argv, dev) == 0) {
NEXT_ARG();
strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +235,10 @@ static int parse_args(int argc, char **a
p-iph.protocol = IPPROTO_IPIP;
else if (memcmp(p-name, sit, 3) == 0)
p-iph.protocol = IPPROTO_IPV6;
+   else if (memcmp(p-name, isatap, 6) == 0) {
+   p-iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
}
 
if (p-iph.protocol == IPPROTO_IPIP || p-iph.protocol == IPPROTO_IPV6) 
{
@@ -239,6 +266,20 @@ static int parse_args(int argc, char **a
fprintf(stderr, Broadcast tunnel requires a source 
address.\n);
return -1;
}
+   if (isatap) {
+   if (p-iph.daddr) {
+   fprintf(stderr, no remote with isatap.\n);
+   return -1;
+   }
+   p-i_key = router ? router : INADDR_NONE;
+   p-o_key = lifetime ? lifetime : 120;   /* RFC4214 default */
+   } else {
+   if (router || lifetime) {
+   fprintf(stderr, router/lifetime only for isatap.\n);
+   return -1;
+   }
+   }
+
return 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 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread David Miller
From: Willy Tarreau [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 00:15:16 +0100

 I can say that sometimes you'd like to be aware that one of your
 VLANs is wrong and you'd simply like to sniff the wire to guess the
 correct tag. And on production, you simply cannot remove other
 VLANs, otherwise you disrupt the service.

If you were plugged into the wrong physical switch, how might
you debug that problem in production? :-)

Really, it's the same issue, just virtualized, as in the name
for the feature, VLAN.
-
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] Add support for the RDC R6040 Fast Ethernet controller

2007-11-12 Thread Florian Fainelli
This patch adds support for the RDC R6040 MAC we can find in the RDC R-321x 
System-on-chips.

Signed-off-by: Sten Wang [EMAIL PROTECTED]
Signed-off-by: Daniel Gimpelevich [EMAIL PROTECTED]
Signed-off-by: Florian Fainelli [EMAIL PROTECTED]
--
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index cb581eb..ab84303 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1645,6 +1645,18 @@ config 8139_OLD_RX_RESET
  experience problems, you can enable this option to restore the
  old RX-reset behavior.  If unsure, say N.
 
+config R6040
+   tristate RDC R6040 Fast Ethernet Adapter support (EXPERIMENTAL)
+   depends on NET_PCI  PCI
+   select CRC32
+   select MII
+   help
+ This is a driver for the R6040 Fast Ethernet MACs found in the
+ the RDC R-321x System-on-chips.
+ 
+ To compile this driver as a module, choose M here: the module
+ will be called r6040. This is recommended.
+
 config SIS900
tristate SiS 900/7016 PCI Fast Ethernet Adapter support
depends on NET_PCI  PCI
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 0e5fde4..afc60df 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_TLAN) += tlan.o
 obj-$(CONFIG_EPIC100) += epic100.o
 obj-$(CONFIG_SIS190) += sis190.o
 obj-$(CONFIG_SIS900) += sis900.o
+obj-$(CONFIG_R6040) += r6040.o
 obj-$(CONFIG_YELLOWFIN) += yellowfin.o
 obj-$(CONFIG_ACENIC) += acenic.o
 obj-$(CONFIG_ISERIES_VETH) += iseries_veth.o
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
new file mode 100644
index 000..edce5a4
--- /dev/null
+++ b/drivers/net/r6040.c
@@ -0,0 +1,1109 @@
+/*
+ * RDC R6040 Fast Ethernet MAC support
+ *
+ * Copyright (C) 2004 Sten Wang [EMAIL PROTECTED]
+ * Copyright (C) 2007
+ * Daniel Gimpelevich [EMAIL PROTECTED]
+ * Florian Fainelli [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+*/
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/moduleparam.h
+#include linux/string.h
+#include linux/timer.h
+#include linux/errno.h
+#include linux/ioport.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/pci.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/skbuff.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/mii.h
+#include linux/ethtool.h
+#include linux/crc32.h
+#include linux/spinlock.h
+
+#include asm/processor.h
+#include asm/bitops.h
+#include asm/io.h
+#include asm/irq.h
+#include asm/uaccess.h
+
+#define DRV_NAME   r6040
+#define DRV_VERSION0.16
+#define DRV_RELDATE10Nov2007
+
+/* PHY CHIP Address */
+#define PHY1_ADDR  1   /* For MAC1 */
+#define PHY2_ADDR  2   /* For MAC2 */
+#define PHY_MODE   0x3100  /* PHY CHIP Register 0 */
+#define PHY_CAP0x01E1  /* PHY CHIP Register 4 */
+
+/* Time in jiffies before concluding the transmitter is hung. */
+#define TX_TIMEOUT (6000 * HZ / 1000)
+#define TIMER_WUT  (jiffies + HZ * 1)/* timer wakeup time : 1 second */
+
+/* RDC MAC I/O Size */
+#define R6040_IO_SIZE  256
+
+/* MAX RDC MAC */
+#define MAX_MAC2
+
+/* MAC registers */
+#define MCR0   0x00/* Control register 0 */
+#define MCR1   0x04/* Control register 1 */
+#define  MAC_RST   0x0001  /* Reset the MAC */
+#define MBCR   0x08/* Bus control */
+#define MT_ICR 0x0C/* TX interrupt control */
+#define MR_ICR 0x10/* RX interrupt control */
+#define MTPR   0x14/* TX poll command register */
+#define MR_BSR 0x18/* RX buffer size */
+#define MR_DCR 0x1A/* RX descriptor control */
+#define MLSR   0x1C/* Last status */
+#define MMDIO  0x20/* MDIO control register */
+#define  MDIO_WRITE0x4000  /* MDIO write */
+#define  MDIO_READ 0x2000  /* MDIO read */
+#define MMRD   0x24/* MDIO read data register */
+#define MMWD   0x28/* MDIO write data register */
+#define MTD_SA00x2C/* TX descriptor start address 0 */
+#define MTD_SA10x30/* TX descriptor start address 1 */
+#define MRD_SA00x34/* RX descriptor start address 0 */

[PATCH] - drivers/net/ppp_* - remove ptr comparisons to 0

2007-11-12 Thread Joe Perches
fix sparse warnings Using plain integer as NULL pointer

Signed-off-by: Joe Perches [EMAIL PROTECTED]

---

 drivers/net/ppp_async.c   |   34 ++--
 drivers/net/ppp_generic.c |  126 ++--
 drivers/net/ppp_synctty.c |   27 +-
 3 files changed, 94 insertions(+), 93 deletions(-)

diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 8d278c8..f023d5b 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty)
 
err = -ENOMEM;
ap = kzalloc(sizeof(*ap), GFP_KERNEL);
-   if (ap == 0)
+   if (!ap)
goto out;
 
/* initialize the asyncppp structure */
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty)
ap = tty-disc_data;
tty-disc_data = NULL;
write_unlock_irq(disc_data_lock);
-   if (ap == 0)
+   if (!ap)
return;
 
/*
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty)
tasklet_kill(ap-tsk);
 
ppp_unregister_channel(ap-chan);
-   if (ap-rpkt != 0)
+   if (ap-rpkt)
kfree_skb(ap-rpkt);
skb_queue_purge(ap-rqueue);
-   if (ap-tpkt != 0)
+   if (ap-tpkt)
kfree_skb(ap-tpkt);
kfree(ap);
 }
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file 
*file,
int err, val;
int __user *p = (int __user *)arg;
 
-   if (ap == 0)
+   if (!ap)
return -ENXIO;
err = -EFAULT;
switch (cmd) {
case PPPIOCGCHAN:
err = -ENXIO;
-   if (ap == 0)
+   if (!ap)
break;
err = -EFAULT;
if (put_user(ppp_channel_index(ap-chan), p))
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file 
*file,
 
case PPPIOCGUNIT:
err = -ENXIO;
-   if (ap == 0)
+   if (!ap)
break;
err = -EFAULT;
if (put_user(ppp_unit_number(ap-chan), p))
@@ -350,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned 
char *buf,
struct asyncppp *ap = ap_get(tty);
unsigned long flags;
 
-   if (ap == 0)
+   if (!ap)
return;
spin_lock_irqsave(ap-recv_lock, flags);
ppp_async_input(ap, buf, cflags, count);
@@ -369,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
struct asyncppp *ap = ap_get(tty);
 
clear_bit(TTY_DO_WRITE_WAKEUP, tty-flags);
-   if (ap == 0)
+   if (!ap)
return;
set_bit(XMIT_WAKEUP, ap-xmit_flags);
tasklet_schedule(ap-tsk);
@@ -684,7 +684,7 @@ ppp_async_push(struct asyncppp *ap)
tty_stuffed = 1;
continue;
}
-   if (ap-optr = ap-olim  ap-tpkt != 0) {
+   if (ap-optr = ap-olim  ap-tpkt) {
if (ppp_async_encode(ap)) {
/* finished processing ap-tpkt */
clear_bit(XMIT_FULL, ap-xmit_flags);
@@ -704,7 +704,7 @@ ppp_async_push(struct asyncppp *ap)
clear_bit(XMIT_BUSY, ap-xmit_flags);
/* any more work to do? if not, exit the loop */
if (!(test_bit(XMIT_WAKEUP, ap-xmit_flags)
- || (!tty_stuffed  ap-tpkt != 0)))
+ || (!tty_stuffed  ap-tpkt)))
break;
/* more work to do, see if we can do it now */
if (test_and_set_bit(XMIT_BUSY, ap-xmit_flags))
@@ -715,7 +715,7 @@ ppp_async_push(struct asyncppp *ap)
 
 flush:
clear_bit(XMIT_BUSY, ap-xmit_flags);
-   if (ap-tpkt != 0) {
+   if (ap-tpkt) {
kfree_skb(ap-tpkt);
ap-tpkt = NULL;
clear_bit(XMIT_FULL, ap-xmit_flags);
@@ -848,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char 
*buf,
s = 0;
for (i = 0; i  count; ++i) {
c = buf[i];
-   if (flags != 0  flags[i] != 0)
+   if (flags  flags[i] != 0)
continue;
s |= (c  0x80)? SC_RCV_B7_1: SC_RCV_B7_0;
c = ((c  4) ^ c)  0xf;
@@ -865,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char 
*buf,
n = scan_ordinary(ap, buf, count);
 
f = 0;
-   if (flags != 0  (ap-state  SC_TOSS) == 0) {
+   if (flags  (ap-state  SC_TOSS) == 0) {
/* check the flags to see if any char had an error */
for (j = 0; j  n; ++j)
if ((f = flags[j]) != 0)
@@ -878,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char 

Re: [PATCH 2/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Kok, Auke
Willy Tarreau wrote:
 On Mon, Nov 12, 2007 at 03:19:23PM -0800, David Miller wrote:
 From: Willy Tarreau [EMAIL PROTECTED]
 Date: Tue, 13 Nov 2007 00:15:16 +0100

 I can say that sometimes you'd like to be aware that one of your
 VLANs is wrong and you'd simply like to sniff the wire to guess the
 correct tag. And on production, you simply cannot remove other
 VLANs, otherwise you disrupt the service.
 If you were plugged into the wrong physical switch, how might
 you debug that problem in production? :-)
 
 tcpdump on an unfiltered RJ45 tells you a lot of things. Some switches
 for instance send keepalive packets (ether proto 9000) with their own
 MAC as source+dest, others send CDP packets, etc... I've very rarely
 stayed plugged to the wrong switch for too long before discovering it.
 But that requires the ability to sniff.
 
 Really, it's the same issue, just virtualized, as in the name
 for the feature, VLAN.
 
 No, it's not the same, because as soon as you pass through a switch
 which is not configured for VLANs, it does not make any distinction,
 and the same DMAC is considered on a single port whatever the VLAN.
 This is not true with multiple switches. Also, sometimes, being able
 to see that your port gets flooded with traffic for a VLAN on which
 you're not configured helps you understand why you cannot fill the
 port.
 
 I'd like that we can use the hardware correctly without having to
 buy TAPs. It reminds me the discussions about TOE. You claim
 yourself that TOE is bad in part because you have little if any
 control on the bugs on the TCP stack on the chip. This is the same
 here. If I know that the chip does not send me what it receives
 when configured in promiscuous mode, I can I swear it never received
 the missing packet ? There's always a doubt. Maybe sometimes the
 filter is buggy, maybe it only passes tags when the remaining bits
 are all zero, etc... Promiscuous mode generally means that you're
 the closest possible to the wire. We already do not receive pause
 frames and sometimes that's annoying. But having no control over
 what we want to see is frustrating.
 
 At least, being able to disable the feature at module load time
 would be acceptable. Many people who often need to sniff on decent
 machines would always keep it disabled.

I really do not want to add another module parameter to the driver for this. It
seems bogus as well: if we can agree on one sane choice it's much better, and if
we don't then we should use ethtool to provide a uniform way of implementing 
this
for all drivers sanely.

Auke
-
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: [Bugme-new] [Bug 9349] New: RTNLGRP_ND_USEROPT does not report ifindex

2007-11-12 Thread Pierre Ynard
On Sun, 11 Nov 2007 10:52:41 -0800 (PST) [EMAIL PROTECTED] wrote:
 The RTNLGRP_ND_USEROPT NetLink message introduced in 2.6.24 does not
 seem to include any information as to which netif the user options
 come from. Considering this is meant to carry data that is heavily
 link-layer involved, this seems like a feature bug. Could an ifindex
 field be added there??

Ok, I am seeing to this.

-- 
Pierre Ynard
For hire in Quebec City, Canada, during Fall 2007
Une âme dans un corps, c'est comme un dessin sur une feuille de papier.
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Willy Tarreau
On Mon, Nov 12, 2007 at 03:19:23PM -0800, David Miller wrote:
 From: Willy Tarreau [EMAIL PROTECTED]
 Date: Tue, 13 Nov 2007 00:15:16 +0100
 
  I can say that sometimes you'd like to be aware that one of your
  VLANs is wrong and you'd simply like to sniff the wire to guess the
  correct tag. And on production, you simply cannot remove other
  VLANs, otherwise you disrupt the service.
 
 If you were plugged into the wrong physical switch, how might
 you debug that problem in production? :-)

tcpdump on an unfiltered RJ45 tells you a lot of things. Some switches
for instance send keepalive packets (ether proto 9000) with their own
MAC as source+dest, others send CDP packets, etc... I've very rarely
stayed plugged to the wrong switch for too long before discovering it.
But that requires the ability to sniff.

 Really, it's the same issue, just virtualized, as in the name
 for the feature, VLAN.

No, it's not the same, because as soon as you pass through a switch
which is not configured for VLANs, it does not make any distinction,
and the same DMAC is considered on a single port whatever the VLAN.
This is not true with multiple switches. Also, sometimes, being able
to see that your port gets flooded with traffic for a VLAN on which
you're not configured helps you understand why you cannot fill the
port.

I'd like that we can use the hardware correctly without having to
buy TAPs. It reminds me the discussions about TOE. You claim
yourself that TOE is bad in part because you have little if any
control on the bugs on the TCP stack on the chip. This is the same
here. If I know that the chip does not send me what it receives
when configured in promiscuous mode, I can I swear it never received
the missing packet ? There's always a doubt. Maybe sometimes the
filter is buggy, maybe it only passes tags when the remaining bits
are all zero, etc... Promiscuous mode generally means that you're
the closest possible to the wire. We already do not receive pause
frames and sometimes that's annoying. But having no control over
what we want to see is frustrating.

At least, being able to disable the feature at module load time
would be acceptable. Many people who often need to sniff on decent
machines would always keep it disabled.

Regards,
Willy

-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread David Miller
From: Willy Tarreau [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 00:32:57 +0100

 At least, being able to disable the feature at module load time
 would be acceptable. Many people who often need to sniff on decent
 machines would always keep it disabled.

I'm willing to accept the feature, in whatever form, as long
as the performance issue is dealt with properly.
-
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][IPv6] Add ifindex field in ND user option messages

2007-11-12 Thread Pierre Ynard
Userland neighbor discovery options are typically heavily involved with
the interface on which thay are received: add a missing ifindex field to
the original struct. Thanks to Rémi Denis-Courmont.

Signed-off-by: Pierre Ynard [EMAIL PROTECTED]

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5bf6182..4e81836 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -491,9 +491,11 @@ struct nduseroptmsg
unsigned char   nduseropt_family;
unsigned char   nduseropt_pad1;
unsigned short  nduseropt_opts_len; /* Total length of options */
+   int nduseropt_ifindex;
__u8nduseropt_icmp_type;
__u8nduseropt_icmp_code;
unsigned short  nduseropt_pad2;
+   unsigned intnduseropt_pad3;
/* Followed by one or more ND options */
 };
 
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 36f7dbf..67997a7 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1037,6 +1037,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct 
nd_opt_hdr *opt)
 
ndmsg = nlmsg_data(nlh);
ndmsg-nduseropt_family = AF_INET6;
+   ndmsg-nduseropt_ifindex = ra-dev-ifindex;
ndmsg-nduseropt_icmp_type = icmp6h-icmp6_type;
ndmsg-nduseropt_icmp_code = icmp6h-icmp6_code;
ndmsg-nduseropt_opts_len = opt-nd_opt_len  3;

-- 
Pierre Ynard
For hire in Quebec City, Canada, during Fall 2007
Une âme dans un corps, c'est comme un dessin sur une feuille de papier.
-
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] Add ifindex field in ND user option messages

2007-11-12 Thread David Miller
From: Pierre Ynard [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 01:54:13 +0100

 Userland neighbor discovery options are typically heavily involved with
 the interface on which thay are received: add a missing ifindex field to
 the original struct. Thanks to Rémi Denis-Courmont.
 
 Signed-off-by: Pierre Ynard [EMAIL PROTECTED]

Unfortunately you cannot change the layout of a structure
already exported to userspace, it is part of the ABI.

You'll need to create a new netlink attribute or similar
in order to provide this information.
-
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: Re : [PATCH][IPv6] Add ifindex field in ND user option messages

2007-11-12 Thread David Miller
From: Pierre Ynard [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 01:08:26 + (GMT)

  Unfortunately you cannot change the layout of a structure
  already exported to userspace, it is part of the ABI.
 
 Well, I thought it would not be a problem, as it is not exactly
 released yet. We are also currently developping the
 corresponding RDNSS daemon and would be totally ready to
 handle this change :)

Was it an interface added to 2.6.24?
-
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] Add ifindex field in ND user option messages

2007-11-12 Thread Pierre Ynard
 Unfortunately you cannot change the layout of a structure
 already exported to userspace, it is part of the ABI.

Well, I thought it would not be a problem, as it is not exactly
released yet. We are also currently developping the
corresponding RDNSS daemon and would be totally ready to
handle this change :)

-- 
Pierre Ynard





  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
-
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 : Re : [PATCH][IPv6] Add ifindex field in ND user option messages

2007-11-12 Thread Pierre Ynard
   Unfortunately you cannot change the layout of a structure
   already exported to userspace, it is part of the ABI.
  
  Well, I thought it would not be a problem, as it is not exactly
  released yet. We are also currently developping the
  corresponding RDNSS daemon and would be totally ready to
  handle this change :)
 
 Was it an interface added to 2.6.24?

Yes.

http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=31910575a9de61e78065e93846e8e7a4894a18bf


-- 
Pierre Ynard



  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Joonwoo Park
2007/11/13, Willy Tarreau [EMAIL PROTECTED]:
 On Mon, Nov 12, 2007 at 02:57:16PM -0800, David Miller wrote:
  From: Chris Friesen [EMAIL PROTECTED]
  Date: Mon, 12 Nov 2007 16:43:24 -0600
 
   David Miller wrote:
  
When you select VLAN, you by definition are asking for non-VLAN
traffic to be elided.  It is like plugging the ethernet cable
into one switch or another.
  
   For max functionality it seems like the raw eth device should show
   everything on the wire in promiscuous mode.
  
   If we want to sniff only the traffic for a specific vlan, we can sniff
   the vlan device.
 
  VLAN settings are a filter of sorts, much like plugging into
  one switch or another filters traffic physically.
 
  If you don't want that filter, turn the VLAN settings off.

 I don't really agree with that view. Having spent a lot of time with
 tcpdump on production systems, I can say that sometimes you'd like to
 be aware that one of your VLANs is wrong and you'd simply like to
 sniff the wire to guess the correct tag. And on production, you simply
 cannot remove other VLANs, otherwise you disrupt the service.


I agree.
If I had a mis-plugged cable, I can guess it with tcpdump.
Because I cannot see the packets. It means no such packets on the wire 100%.
But if I had a incorrect vlan configuration, it's hard to sure.
In a case both of mis-plugged and mis-configured situation, I cannot
see anything.
Moreover, if I am configuring a machine via vlan interface which is
mis-configured partially, I cannot disable vlan hw acceleration
feature.

Thanks.
Joonwoo
-
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/2] [e1000 VLAN] Disable vlan hw accel when promiscuous mode

2007-11-12 Thread Joonwoo Park
2007/11/13, David Miller [EMAIL PROTECTED]:
 From: Willy Tarreau [EMAIL PROTECTED]
 Date: Tue, 13 Nov 2007 00:32:57 +0100

  At least, being able to disable the feature at module load time
  would be acceptable. Many people who often need to sniff on decent
  machines would always keep it disabled.

 I'm willing to accept the feature, in whatever form, as long
 as the performance issue is dealt with properly.

I agree with disabling the hw acceleration feature by manually would
be a non-negative solution.
IMO implementation in the ethtool seems better than module param.
As like Auke mentioned.
If you guys confirm it, I'll try it.

Thanks.
Joonwoo
-
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


Hello!!

2007-11-12 Thread THUNDERBALL END OF YEAR BONANZA
You won the sum of 250,000,GBP by the Thunderball promotions. contact this 
email for further instructions: [EMAIL PROTECTED] 
TEL:+447045708596
Thank you.

-
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: Re : Re : [PATCH][IPv6] Add ifindex field in ND user option messages

2007-11-12 Thread David Miller
From: Pierre Ynard [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 01:19:47 + (GMT)

Unfortunately you cannot change the layout of a structure
already exported to userspace, it is part of the ABI.
   
   Well, I thought it would not be a problem, as it is not exactly
   released yet. We are also currently developping the
   corresponding RDNSS daemon and would be totally ready to
   handle this change :)
  
  Was it an interface added to 2.6.24?
 
 Yes.
 
 http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=31910575a9de61e78065e93846e8e7a4894a18bf

Great, then we can in fact fix it and I will apply your
patch.

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 1/1][NETNS][IPV6] protect addrconf from loopback registration

2007-11-12 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Mon, 12 Nov 2007 12:50:53 -0700), [EMAIL 
PROTECTED] (Eric W. Biederman) says:

 My opinion is that both your analysis is slightly off (as to the cause
 of your problems) and that your approach to fix your problem is wrong
 because you don't untangle the knot you keep it.
:
 I have register_pernet_subsys and register_per_net_device to ensure
 that when we create a new network namespace all of the subsystems are
 initialized before the network devices are initialize.  So ipv6 should
 be ready before we initialize the new loopback device comes into
 existence.

User may not load ipv6.ko at boot, and then do modprobe ipv6.
Do you take this into account?

--yoshfuji
-
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] - drivers/net/ppp_* - remove ptr comparisons to 0

2007-11-12 Thread David Miller
From: Joe Perches [EMAIL PROTECTED]
Date: Mon, 12 Nov 2007 15:33:51 -0800

 fix sparse warnings Using plain integer as NULL pointer
 
 Signed-off-by: Joe Perches [EMAIL PROTECTED]

Applied, thanks Joe.
-
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] sungem: fix suspend regression due to NAPI changes

2007-11-12 Thread David Miller
From: Benjamin Herrenschmidt [EMAIL PROTECTED]
Date: Tue, 13 Nov 2007 09:32:46 +1100

 
 On Mon, 2007-11-12 at 18:45 +0100, Johannes Berg wrote:
  Commit bea3348e (the NAPI changes) made sungem unconditionally enable
  NAPI when resuming and unconditionally disable when suspending, this,
  however, makes napi_disable() hang when suspending when the interface
  was taken down before suspend because taking the interface down also
  disables NAPI. This patch makes touching the napi struct in
  suspend/resume code paths depend on having the interface up, thereby
  fixing the hang on suspend.
  
  The patch also moves the napi_disable() in gem_close() under the lock so
  that the NAPI state is always modified atomically together with the
  opened variable.
  
  Signed-off-by: Johannes Berg [EMAIL PROTECTED]
 
 Thanks for fixing that !
 
 Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED]

Indeed, thanks a lot Johannes.

Patch applied.
-
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   >