Re: [IPv6] BUG: NULL pointer dereference in(?) ip6_flush_pending_frames

2007-09-09 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 10 Sep 2007 00:24:00 +0200), Bernhard 
Schmidt <[EMAIL PROTECTED]> says:

> I'm running a public Teredo relay (IPv4-to-IPv6 migration protocol)
> using Miredo. Every once in a while (a few minutes to days after
> daemon restart) it becomes unusable and I see the following kernel
> message:
> 
> BUG: unable to handle kernel NULL pointer dereference at virtual address
> 008c
:
> EIP is at ip6_flush_pending_frames+0x97/0x121

I think I've found a bug.

Some of skbs in sk->write_queue do not have skb->dst because
we do not fill skb->dst when we allocate new skb in append_data().

Miyazawa-san, am I right?

BTW, I think we may not need to (or we should not) increment some stats
when using corking; if 100 sendmsg() (with MSG_MORE) result in 2 packets,
how many should we increment?

If 100, we should set skb->dst for every queued skbs.

If 1 (or 2 (*)), we increment the stats for the first queued skb and
we should just skip incrementing OutDiscards for the rest of queued skbs,
adn we should also impelement this semantics in other places;
e.g., we should increment other stats just once, not 100 times.

*: depends on the place we are discarding the datagram.

I guess should just increment by 1 (or 2).

Anyway, please try this.

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

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4704b5f..e489499 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1423,8 +1423,9 @@ void ip6_flush_pending_frames(struct sock *sk)
struct sk_buff *skb;
 
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
-   IP6_INC_STATS(ip6_dst_idev(skb->dst),
- IPSTATS_MIB_OUTDISCARDS);
+   if (skb->dst)
+   IP6_INC_STATS(ip6_dst_idev(skb->dst),
+ IPSTATS_MIB_OUTDISCARDS);
kfree_skb(skb);
}
 


--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][2/2] Add ICMPMsgStats MIB (RFC 4293)

2007-09-11 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 10 Sep 2007 20:27:03 -0600), David 
Stevens <[EMAIL PROTECTED]> says:

> These patches "remove" (but not really) the existing counters, and
> replace them with the ICMPMsgStats tables for v4 and v6.
> It includes the named counters in the /proc places they were, but gets the
> values for them from the new tables. It also counts packets generated
> from raw socket output (e.g., OutEchoes, MLD queries, RA's from
> radvd, etc).

Dave, we've been supporting per-interface stats for IPv6, and
you seem to remove them.  Please keep them.  Thank you.

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


[PATCH 1/4] [IPV6]: Fix unbalanced socket reference with MSG_CONFIRM.

2007-09-12 Thread YOSHIFUJI Hideaki /
Also applicable for stable releases.

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

-- 
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index a58459a..fc5cb83 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -858,11 +858,10 @@ back_from_confirm:
ip6_flush_pending_frames(sk);
else if (!(msg->msg_flags & MSG_MORE))
err = rawv6_push_pending_frames(sk, &fl, rp);
+   release_sock(sk);
}
 done:
dst_release(dst);
-   if (!inet->hdrincl)
-   release_sock(sk);
 out:
fl6_sock_release(flowlabel);
return err<0?err:len;

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


[PATCH 2/4] [IPV6]: Fix oops during flushing corked datagrams.

2007-09-12 Thread YOSHIFUJI Hideaki /
When we corking sub-datagrams, we do not clone skb->dst for sub-datagrams
other than the first one, so we get oops if we have multiple sub-datagrams
here.

One possible way to fix this is to clone skb->dst for all sub-datagrams,
but we do not take this approach because skb->dst is not used in other
places and it is more natural to increment statistics once per a datagram.

Also applicable for stable releases.

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

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4704b5f..6530044 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1423,8 +1423,15 @@ void ip6_flush_pending_frames(struct sock *sk)
struct sk_buff *skb;
 
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
-   IP6_INC_STATS(ip6_dst_idev(skb->dst),
- IPSTATS_MIB_OUTDISCARDS);
+   if (skb->dst) {
+   /*
+* Note: we count standard stats once per "datagram"
+* and skb->dst is set only for the first 
+* sub-datagram of the datagram.
+*/
+   IP6_INC_STATS(ip6_dst_idev(skb->dst),
+ IPSTATS_MIB_OUTDISCARDS);
+   }
kfree_skb(skb);
}
 

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


[PATCH 3/4] [IPV6]: Just increment OutDatagrams once per a datagram.

2007-09-12 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4210951..c347f3e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -555,6 +555,8 @@ static int udp_v6_push_pending_frames(struct sock *sk)
 out:
up->len = 0;
up->pending = 0;
+   if (!err)
+   UDP6_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, up->pcflag);
return err;
 }
 
@@ -823,10 +825,8 @@ do_append_data:
release_sock(sk);
 out:
fl6_sock_release(flowlabel);
-   if (!err) {
-   UDP6_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, is_udplite);
+   if (!err)
return len;
-   }
/*
 * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space.  Reporting
 * ENOBUFS might not be good (it's not tunable per se), but otherwise

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


[PATCH 4/4] [IPV4]: Just increment OutDatagrams once per a datagram.

2007-09-12 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

---
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index facb7e2..ccb67f3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -504,6 +504,8 @@ send:
 out:
up->len = 0;
up->pending = 0;
+   if (!err)
+   UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, up->pcflag);
return err;
 }
 
@@ -692,10 +694,8 @@ out:
ip_rt_put(rt);
if (free)
kfree(ipc.opt);
-   if (!err) {
-   UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, is_udplite);
+   if (!err)
return len;
-   }
/*
 * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space.  Reporting
 * ENOBUFS might not be good (it's not tunable per se), but otherwise

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


Re: [PATCH 1/4] [IPV6]: Fix unbalanced socket reference with MSG_CONFIRM.

2007-09-12 Thread YOSHIFUJI Hideaki /
| [PATCH 1/4] [IPV6]: Fix unbalanced socket reference with MSG_CONFIRM.

Ah, I should say, socket locking, probably...
Anyway, lock_sock() and release_sock() are not paired approriately.

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


2.6.23-rc regression: bcm43xx does not work after commit 4cf92a3c

2007-09-16 Thread YOSHIFUJI Hideaki /
Hello.

With latest git tree, bcm43xx driver does not work.
By bisect, I've found the commit 4cf92a3c is the first "bad" commit.

[PATCH] softmac: Fix ESSID problem

Victor Porton reported that the SoftMAC layer had random problem when 
setting the ESSID :
http://bugzilla.kernel.org/show_bug.cgi?id=8686 After investigation, it 
turned out to be
worse, the SoftMAC layer is left in an inconsistent state. The fix is 
pretty trivial.

Signed-off-by: Jean Tourrilhes <[EMAIL PROTECTED]>
Acked-by: Michael Buesch <[EMAIL PROTECTED]>
Acked-by: Larry Finger <[EMAIL PROTECTED]>
Signed-off-by: John W. Linville <[EMAIL PROTECTED]>

After reverting this commit, the driver starts working again.

Regards,

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


Re: [PATCH] 2.6.22.6 NETWORKING [IPV4]: Always use source addr in skb to reply packet

2007-09-17 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 17 Sep 2007 19:20:44 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> From: lepton <[EMAIL PROTECTED]>
> Date: Tue, 18 Sep 2007 10:16:17 +0800
> 
> > Hi,
> >   In some situation, icmp_reply and ip_send_reply will send
> >   out packet with the wrong source addr, the following patch
> >   will fix this.
> > 
> >   I don't understand why we must use rt->rt_src in the current
> >   code, if this is a wrong fix, please correct me.
> > 
> > Signed-off-by: Lepton Wu <[EMAIL PROTECTED]>
> 
> That the address is wrong is your opinion only :-)
> 
> Source address selection is a rather complex topic, and
> here we are definitely purposefully using the source
> address selected by the routing lookup for the reply.

And, if you do think something is "wrong", you need to describe it
in detail, at least.

--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 5/7] CAN: Add virtual CAN netdevice driver

2007-09-25 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Tue, 25 Sep 2007 14:20:34 +0200), Urs 
Thuermann <[EMAIL PROTECTED]> says:

> Index: net-2.6.24/drivers/net/can/vcan.c
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ net-2.6.24/drivers/net/can/vcan.c 2007-09-25 13:32:23.0 +0200
> @@ -0,0 +1,208 @@
> +/*
> + * vcan.c - Virtual CAN interface
> + *
> + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions, the following disclaimer and
> + *the referenced file 'COPYING'.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + * 3. Neither the name of Volkswagen nor the names of its contributors
> + *may be used to endorse or promote products derived from this software
> + *without specific prior written permission.
> + *
> + * Alternatively, provided that this notice is retained in full, this
 ~~
> + * software may be distributed under the terms of the GNU General
> + * Public License ("GPL") version 2 as distributed in the 'COPYING'
> + * file from the main directory of the linux kernel source.
> + *
> + * The provided data structures and external interfaces from this code
> + * are not restricted to be used by modules with a GPL compatible license.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> + * DAMAGE.
> + *
> + * Send feedback to <[EMAIL PROTECTED]>
> + *
> + */

I'm not a lawyer, but the following lines:

| + * Alternatively, provided that this notice is retained in full, this
 ~~
| + * software may be distributed under the terms of the GNU General
| + * Public License ("GPL") version 2 as distributed in the 'COPYING'
| + * file from the main directory of the linux kernel source.

make this whole licence imcompatible with GPL.
I do think you need to allow people to select GPLv2 only.

--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: IPv6 Davelopment Tree

2007-03-06 Thread YOSHIFUJI Hideaki /
Dave,

In article <[EMAIL PROTECTED]> (at Tue, 06 Mar 2007 13:36:11 -0800 (PST)), 
David Miller <[EMAIL PROTECTED]> says:

> From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
> Date: Fri, 23 Feb 2007 12:53:01 +0900 (JST)
> 
> > I have cooked up new git tree for IPv6 development.
> > It is available as branch named
> > 2.6.21-rc1-net-2.6-20070223-FOR_DAVEM-20070223
> > at
> > .
> > 
> > I will shift to new branch time to time (e.g. every -rc releases) in order
> > to chase the latest tree.
> 
> What is the current branch name?  I'd like to pull whatever
> you have into my net-2.6.22 tree.

Please pull from "net-2.6.22-20070307-FOR_DAVEM-20070307" branch at
.

Thank you.

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


[ATM] ENI: Convert to struct timeval to ktime_t.

2007-03-06 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--- 
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 8fccf01..0d3a38b 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -536,7 +536,7 @@ static int rx_aal0(struct atm_vcc *vcc)
return 0;
}
skb_put(skb,length);
-   skb_set_timestamp(skb, &eni_vcc->timestamp);
+   skb->tstamp = eni_vcc->timestamp;
DPRINTK("got len %ld\n",length);
if (do_rx_dma(vcc,skb,1,length >> 2,length >> 2)) return 1;
eni_vcc->rxing++;
@@ -701,7 +701,7 @@ static void get_service(struct atm_dev *dev)
DPRINTK("Grr, servicing VCC %ld twice\n",vci);
continue;
}
-   do_gettimeofday(&ENI_VCC(vcc)->timestamp);
+   ENI_VCC(vcc)->timestamp = ktime_get_real();
ENI_VCC(vcc)->next = NULL;
if (vcc->qos.rxtp.traffic_class == ATM_CBR) {
if (eni_dev->fast)
diff --git a/drivers/atm/eni.h b/drivers/atm/eni.h
index 385090c..d04fefb 100644
--- a/drivers/atm/eni.h
+++ b/drivers/atm/eni.h
@@ -59,7 +59,7 @@ struct eni_vcc {
int rxing;  /* number of pending PDUs */
int servicing;  /* number of waiting VCs (0 or 1) */
int txing;  /* number of pending TX bytes */
-   struct timeval timestamp;   /* for RX timing */
+   ktime_t timestamp;  /* for RX timing */
struct atm_vcc *next;   /* next pending RX */
struct sk_buff *last;   /* last PDU being DMAed (used to carry
   discard information) */

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


[NET]: Use {htons,htonl,cpu_to_le16}() where appropriate.

2007-03-06 Thread YOSHIFUJI Hideaki /
Dave,

Please consider pulling following changesets from the
"net-2.6.22-20070307a-byteorder-20070307" branch at
.

Thank you.

HEADLINES
-

[NET] 802: Use hton{s,l}() where appropriate.
[NET] 8021Q: Use htons() where appropriate.
[NET] ATM: Use htons() where appropriate.
[NET] BLUETOOTH: Use cpu_to_le16() where appropriate.
[NET] CORE: Use htons() where appropriate.
[NET] ETHERNET: Use htons() where appropriate.
[NET] IEEE80211: Use htons() where appropriate.
[NET] IPV4: Use hton{s,l}() where appropriate.
[NET] NETFILTER: Use htonl() where appropriate.
[NET] SCHED: Use htons() where appropriate.
[NET] TIPC: Use htons() where appropriate.

DIFFSTAT


 net/802/fddi.c  |4 ++--
 net/802/hippi.c |4 ++--
 net/8021q/vlan_dev.c|6 +++---
 net/atm/br2684.c|4 ++--
 net/bluetooth/hci_conn.c|   18 +-
 net/core/netpoll.c  |2 +-
 net/ethernet/eth.c  |2 +-
 net/ieee80211/ieee80211_tx.c|2 +-
 net/ipv4/ipvs/ip_vs_core.c  |   10 +-
 net/ipv4/ipvs/ip_vs_proto_ah.c  |   16 
 net/ipv4/ipvs/ip_vs_xmit.c  |   16 
 net/ipv4/netfilter/ip_conntrack_proto_tcp.c |9 -
 net/netfilter/nf_conntrack_proto_tcp.c  |9 -
 net/sched/cls_rsvp.h|2 +-
 net/sched/sch_api.c |2 +-
 net/tipc/eth_media.c|2 +-
 16 files changed, 53 insertions(+), 55 deletions(-)

CHANGESETS
--

commit 2893c534ffba19c31c0321f8221eaf844306e951
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Wed Mar 7 14:18:33 2007 +0900

[NET] 802: Use hton{s,l}() where appropriate.

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

diff --git a/net/802/fddi.c b/net/802/fddi.c
index ace6386..8c86216 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -100,7 +100,7 @@ static int fddi_rebuild_header(struct sk_buff   *skb)
struct fddihdr *fddi = (struct fddihdr *)skb->data;
 
 #ifdef CONFIG_INET
-   if (fddi->hdr.llc_snap.ethertype == __constant_htons(ETH_P_IP))
+   if (fddi->hdr.llc_snap.ethertype == htons(ETH_P_IP))
/* Try to get ARP to resolve the header and fill destination 
address */
return arp_find(fddi->daddr, skb);
else
@@ -135,7 +135,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct 
net_device *dev)
if(fddi->hdr.llc_8022_1.dsap==0xe0)
{
skb_pull(skb, FDDI_K_8022_HLEN-3);
-   type = __constant_htons(ETH_P_802_2);
+   type = htons(ETH_P_802_2);
}
else
{
diff --git a/net/802/hippi.c b/net/802/hippi.c
index 578f2a3..35dd938 100644
--- a/net/802/hippi.c
+++ b/net/802/hippi.c
@@ -60,7 +60,7 @@ static int hippi_header(struct sk_buff *skb, struct 
net_device *dev,
 * Due to the stupidity of the little endian byte-order we
 * have to set the fp field this way.
 */
-   hip->fp.fixed   = __constant_htonl(0x04800018);
+   hip->fp.fixed   = htonl(0x04800018);
hip->fp.d2_size = htonl(len + 8);
hip->le.fc  = 0;
hip->le.double_wide = 0;/* only HIPPI 800 for the time being */
@@ -104,7 +104,7 @@ static int hippi_rebuild_header(struct sk_buff *skb)
 * Only IP is currently supported
 */
 
-   if(hip->snap.ethertype != __constant_htons(ETH_P_IP))
+   if(hip->snap.ethertype != htons(ETH_P_IP))
{
printk(KERN_DEBUG "%s: unable to resolve type %X 
addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype));
return 0;

---
commit 60e71cd6525fdf2b35c71158bb5441a252e62a0e
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Wed Mar 7 14:18:35 2007 +0900

[NET] 8021Q: Use htons() where appropriate.

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

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2fc8fe2..e961d59 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -258,7 +258,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
 * won't work for fault tolerant netware but does for the rest.
 */
if (*(unsigned short *)rawp == 0x) {
-   skb->protocol = __constant_htons(ETH_P_802_3);
+   skb->protocol = htons(ETH_P_802_3);
/* place it back on the queue to be handled by true layer 3 
protocols.
 */
 
@@ -281,7 +281,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
/*
 *  Real 802.2 LLC
 */
-   skb->protocol = __constant_htons(ETH_P_802_2);
+   skb->protocol = htons(ETH_P_802_2);
/* place it back 

[GIT PATCH (TAKE 2)] [NET]: Use {htons,htonl,cpu_to_le16}() where appropriate.

2007-03-06 Thread YOSHIFUJI Hideaki /
Dave,

In article <[EMAIL PROTECTED]> (at Wed, 07 Mar 2007 14:58:07 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> Please consider pulling following changesets from the
> "net-2.6.22-20070307a-byteorder-20070307" branch at
> .

Argh, I found more places to convert in bluetooth.

I've made a new branch "net-2.6.22-20070307a-byteorder-20070307a" at
.

Thanks.

HEADLINES
-

[NET] 802: Use hton{s,l}() where appropriate.
[NET] 8021Q: Use htons() where appropriate.
[NET] ATM: Use htons() where appropriate.
[NET] BLUETOOTH: Use cpu_to_le{16,32}() where appropriate.
[NET] CORE: Use htons() where appropriate.
[NET] ETHERNET: Use htons() where appropriate.
[NET] IEEE80211: Use htons() where appropriate.
[NET] IPV4: Use hton{s,l}() where appropriate.
[NET] NETFILTER: Use htonl() where appropriate.
[NET] SCHED: Use htons() where appropriate.
[NET] TIPC: Use htons() where appropriate.

DIFFSTAT


 net/802/fddi.c  |4 +-
 net/802/hippi.c |4 +-
 net/8021q/vlan_dev.c|6 +-
 net/atm/br2684.c|4 +-
 net/bluetooth/hci_conn.c|   36 +++---
 net/bluetooth/hci_core.c|   20 
 net/bluetooth/hci_event.c   |8 ++-
 net/bluetooth/l2cap.c   |   70 ++-
 net/core/netpoll.c  |2 -
 net/ethernet/eth.c  |2 -
 net/ieee80211/ieee80211_tx.c|2 -
 net/ipv4/ipvs/ip_vs_core.c  |   10 ++--
 net/ipv4/ipvs/ip_vs_proto_ah.c  |   16 +++---
 net/ipv4/ipvs/ip_vs_xmit.c  |   16 +++---
 net/ipv4/netfilter/ip_conntrack_proto_tcp.c |9 ++-
 net/netfilter/nf_conntrack_proto_tcp.c  |9 ++-
 net/sched/cls_rsvp.h|2 -
 net/sched/sch_api.c |2 -
 net/tipc/eth_media.c|2 -
 19 files changed, 111 insertions(+), 113 deletions(-)

CHANGESETS
--

commit 9f72aaaed003b2dda0fc5fa28c2caccc4ae358e3
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Wed Mar 7 14:18:33 2007 +0900

[NET] 802: Use hton{s,l}() where appropriate.

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

diff --git a/net/802/fddi.c b/net/802/fddi.c
index ace6386..8c86216 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -100,7 +100,7 @@ static int fddi_rebuild_header(struct sk_buff   *skb)
struct fddihdr *fddi = (struct fddihdr *)skb->data;
 
 #ifdef CONFIG_INET
-   if (fddi->hdr.llc_snap.ethertype == __constant_htons(ETH_P_IP))
+   if (fddi->hdr.llc_snap.ethertype == htons(ETH_P_IP))
/* Try to get ARP to resolve the header and fill destination 
address */
return arp_find(fddi->daddr, skb);
else
@@ -135,7 +135,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct 
net_device *dev)
if(fddi->hdr.llc_8022_1.dsap==0xe0)
{
skb_pull(skb, FDDI_K_8022_HLEN-3);
-   type = __constant_htons(ETH_P_802_2);
+   type = htons(ETH_P_802_2);
}
else
{
diff --git a/net/802/hippi.c b/net/802/hippi.c
index 578f2a3..35dd938 100644
--- a/net/802/hippi.c
+++ b/net/802/hippi.c
@@ -60,7 +60,7 @@ static int hippi_header(struct sk_buff *skb, struct 
net_device *dev,
 * Due to the stupidity of the little endian byte-order we
 * have to set the fp field this way.
 */
-   hip->fp.fixed   = __constant_htonl(0x04800018);
+   hip->fp.fixed   = htonl(0x04800018);
hip->fp.d2_size = htonl(len + 8);
hip->le.fc  = 0;
hip->le.double_wide = 0;/* only HIPPI 800 for the time being */
@@ -104,7 +104,7 @@ static int hippi_rebuild_header(struct sk_buff *skb)
 * Only IP is currently supported
 */
 
-   if(hip->snap.ethertype != __constant_htons(ETH_P_IP))
+   if(hip->snap.ethertype != htons(ETH_P_IP))
{
printk(KERN_DEBUG "%s: unable to resolve type %X 
addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype));
return 0;

---
commit d186c0a25b23079f5faac2500d3dcbd8b7d6e166
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Wed Mar 7 14:18:35 2007 +0900

[NET] 8021Q: Use htons() where appropriate.

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

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2fc8fe2..e961d59 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -258,7 +258,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
 * won't work for fault tolerant netware but does for the rest.
 */
 

[PATCH] NETLINK: convert NLMSG_GOODSIZE to constant expression.

2007-03-06 Thread YOSHIFUJI Hideaki /
This fixes the following error:
:
|  CC [M]  net/ipv4/netfilter/ipt_ULOG.o
|net/ipv4/netfilter/ipt_ULOG.c:82: error: braced-group within expression 
allowed only inside a function
|net/ipv4/netfilter/ipt_ULOG.c:82: error: syntax error before "void"
|make[1]: *** [net/ipv4/netfilter/ipt_ULOG.o] Error 1
|make: *** [net/ipv4/netfilter/] Error 2

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

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 54597e4..a9d3ad5 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -175,8 +175,12 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, 
int protocol);
  * use enormous buffer sizes on recvmsg() calls just to avoid
  * MSG_TRUNC when PAGE_SIZE is very large.
  */
-#define NLMSG_GOODSIZE \
-   SKB_WITH_OVERHEAD(min(PAGE_SIZE,8192UL))
+#if PAGE_SIZE < 8192UL
+#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
+#else
+#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
+#endif
+
 #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
 
 

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


Re: IPV6: make ipv6_getsockopt_sticky honor user's buffer size

2007-03-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 08 Mar 2007 14:38:04 -0800 (PST)), 
David Miller <[EMAIL PROTECTED]> says:

> From: Chris Wright <[EMAIL PROTECTED]>
> Date: Wed, 7 Mar 2007 23:10:48 -0800
> 
> > Make sure not to copy_to_user more than user's buffer can handle (we
> > already checked the min, just use it) in ipv6_getsockopt_sticky.  And
> > while there, minor whitespace cleanup now that ipv6_getsockopt_sticky
> > call can nicely fit on one line.
> > 
> > Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
> 
> I wonder about this :-)
> 
> This gives the user now way to figure out that ipv6_optlen(hdr) is
> larger than the len they supplied.
> 
> In other situations usually we validate the length and return -EINVAL
> if it is too small.
> 
> That might be the thing to do in this case too.

We should give truncated result and return full length
from the POSIX POV.

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


[PATCH 1/2] [IPV6]: Return correct result for sticky options.

2007-03-08 Thread YOSHIFUJI Hideaki /
We returned incorrect result with IPV6_RTHDRDSTOPTS, IPV6_RTHDR and
IPV6_DSTOPTS.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/ipv6_sockglue.c |   27 +++
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 4e0561a..44ccdf0 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -796,13 +796,32 @@ EXPORT_SYMBOL(compat_ipv6_setsockopt);
 #endif
 
 static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
- char __user *optval, int len)
+ int optname, char __user *optval, int len)
 {
struct ipv6_opt_hdr *hdr;
 
-   if (!opt || !opt->hopopt)
+   if (!opt)
+   return 0;
+
+   switch(optname) {
+   case IPV6_HOPOPTS:
+   hdr = opt->hopopt;
+   break;
+   case IPV6_RTHDRDSTOPTS:
+   hdr = opt->dst0opt;
+   break;
+   case IPV6_RTHDR:
+   hdr = (struct ipv6_opt_hdr *)opt->srcrt;
+   break;
+   case IPV6_DSTOPTS:
+   hdr = opt->dst1opt;
+   break;
+   default:
+   return -EINVAL; /* should not happen */
+   }
+
+   if (!hdr)
return 0;
-   hdr = opt->hopopt;
 
len = min_t(int, len, ipv6_optlen(hdr));
if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
@@ -945,7 +964,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, 
int optname,
 
lock_sock(sk);
len = ipv6_getsockopt_sticky(sk, np->opt,
-optval, len);
+optname, optval, len);
release_sock(sk);
return put_user(len, optlen);
}
-- 
1.4.4.1.g562ce

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


[PATCH 2/2] [IPV6]: Ensure to truncate result and return full length for sticky options.

2007-03-08 Thread YOSHIFUJI Hideaki /
Bug noticed by Chris Wright <[EMAIL PROTECTED]>.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/ipv6_sockglue.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 44ccdf0..6ad8921 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -824,9 +824,9 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct 
ipv6_txoptions *opt,
return 0;
 
len = min_t(int, len, ipv6_optlen(hdr));
-   if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
+   if (copy_to_user(optval, hdr, len));
return -EFAULT;
-   return len;
+   return ipv6_optlen(hdr);
 }
 
 static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
-- 
1.4.4.1.g562ce

-
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: Fix for ipv6_setsockopt NULL dereference

2007-03-09 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 9 Mar 2007 15:15:54 +0100), Olaf Kirch 
<[EMAIL PROTECTED]> says:

> I came across this bug in http://bugzilla.kernel.org/show_bug.cgi?id=8155
:
> Fix NULL pointer derefence in ipv6_setsockopt, as described in bug #8155.
> 
> Signed-off-by: [EMAIL PROTECTED]

Acked-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

I also ack to push this to -stable.

--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 2/2] [IPV6]: Ensure to truncate result and return full length for sticky options.

2007-03-09 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 09 Mar 2007 16:15:06 -0800 (PST)), 
David Miller <[EMAIL PROTECTED]> says:

> > on arch's that don't protect < 0 copy_to_user like i386 does).  Here's
> > a simple fix ontop of yoshifuji's two changes.  Hope that's it ;-)
> 
> copy_to_user() will check it, actually, it will make sure that
> optval + len doesn't wrap or overlap into kernel space.
> 
> Actually, like sparc64 it BUG's on negative length so we have
> to fix this :-)

Oh I did not know this BUG.
Anyway, thanks for taking care of this.

--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: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1

2007-03-20 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 20 Mar 2007 10:27:51 +0200 (EET)), 
Pekka Savola <[EMAIL PROTECTED]> says:

> On Mon, 19 Mar 2007, David Miller wrote:
> > From: Patrick McHardy <[EMAIL PROTECTED]>
> > Date: Mon, 19 Mar 2007 16:27:29 +0100
> >
> >> Mhh actually this looks intentional:
> >>
> >> icmpv6_send and some other output functions do:
> >>int hlimit;
> >> ...
> >> if (hlimit < 0)
> >> hlimit = dst_metric(dst, RTAX_HOPLIMIT);
> >> if (hlimit < 0)
> >> hlimit = ipv6_get_hoplimit(dst->dev);
> >
> > Yep, negative value has a specific meaning.
> 
> Which seems to indicate that the kernel-internal implementation has a 
> need to store a negative TTL.  Reporting it to the userspace as a 
> negative doesn't seem right though?

I think it is better to fix iproute2 instead, 1) to treat the variable as 
int, or, 2) not to show such variable.

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


ping6 to own link-local address

2007-03-20 Thread YOSHIFUJI Hideaki /
Hello.

Recent 2.6.21-git kernels do not respond to ping6 queries
to our own (local) link-local address.  Now bisecting...

--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: ping6 to own link-local address

2007-03-20 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 20 Mar 2007 15:16:40 -0700), Sridhar 
Samudrala <[EMAIL PROTECTED]> says:

> On Tue, 2007-03-20 at 10:19 +0100, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> > Hello.
> > 
> > Recent 2.6.21-git kernels do not respond to ping6 queries
> > to our own (local) link-local address.  Now bisecting...
> 
> The following patch seems to be the cause for this regression.
> 
> [IPV6] ROUTE: Do not route packets to link-local address on other device.
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a0d78ebf3a0e33a1aeacf2fc518ad9273d6a1c2f

Right.  Hmm...

--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 10/12] [IPv6]: Use rtnl registration interface

2007-03-20 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 21 Mar 2007 01:06:03 +0100), Thomas 
Graf <[EMAIL PROTECTED]> says:

> -static int
> -inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
> +static int nl_addr_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
>  {
>   struct ifaddrmsg *ifm;

I'm rather not favor changing function names here...

--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: IPv6: Connection reset/timeout under heavy load

2007-03-27 Thread YOSHIFUJI Hideaki /
Hello.

(CC: netdev added.)

In article <[EMAIL PROTECTED]> (at Tue, 27 Mar 2007 11:45:46 +0200), Agoston 
Horvath <[EMAIL PROTECTED]> says:

> I'm using kernel 2.6.16.29, libc is 2.3.2.ds1-22sarge5. However, same result 
> was achieved using kernel version 2.6.13 on the same box.
> 
> I'm out of further ideas. If anyone can give me some pointers about what 
> could be wrong, please, don't spare me.

Would you test with latest kernel, if possible, please?

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


[PATCH net-2.6.22] [IPV6] FIB6RULE: Find source address during looking up route.

2007-03-27 Thread YOSHIFUJI Hideaki /
When looking up route for destination with rules with
source address restrictions, we may need to find a source
address for the traffic if not given.

Based on patch from Noriaki TAKAMIYA <[EMAIL PROTECTED]>.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 include/linux/fib_rules.h |7 +--
 net/ipv6/fib6_rules.c |   34 +++---
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 8270aac..2bbfa87 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,8 +5,11 @@
 #include 
 
 /* rule is permanent, and cannot be deleted */
-#define FIB_RULE_PERMANENT 1
-#define FIB_RULE_INVERT2
+#define FIB_RULE_PERMANENT 0x0001
+#define FIB_RULE_INVERT0x0002
+
+/* try to find source address in routing lookups */
+#defineFIB_RULE_FIND_SADDR 0x0001
 
 struct fib_rule_hdr
 {
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index f0f0e8c..514a743 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -95,8 +96,27 @@ static int fib6_rule_action(struct fib_rule *rule, struct 
flowi *flp,
if (table)
rt = lookup(table, flp, flags);
 
-   if (rt != &ip6_null_entry)
+   if (rt != &ip6_null_entry) {
+   struct fib6_rule *r = (struct fib6_rule *)rule;
+
+   /*
+* If we need to find a source address for this traffic,
+* we check the result if it meets requirement of the rule.
+*/
+   if ((rule->flags & FIB_RULE_FIND_SADDR) &&
+   r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) {
+   struct in6_addr saddr;
+   if (ipv6_get_saddr(&rt->u.dst, &flp->fl6_dst,
+  &saddr))
+   goto again;
+   if (!ipv6_prefix_equal(&saddr, &r->src.addr,
+  r->src.plen))
+   goto again;
+   ipv6_addr_copy(&flp->fl6_src, &saddr);
+   }
goto out;
+   }
+again:
dst_release(&rt->u.dst);
rt = NULL;
goto out;
@@ -117,9 +137,17 @@ static int fib6_rule_match(struct fib_rule *rule, struct 
flowi *fl, int flags)
!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
return 0;
 
+   /*
+* If FIB_RULE_FIND_SADDR is set and we do not have a
+* source address for the traffic, we defer check for
+* source address.
+*/
if (r->src.plen) {
-   if (!(flags & RT6_LOOKUP_F_HAS_SADDR) ||
-   !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen))
+   if (flags & RT6_LOOKUP_F_HAS_SADDR) {
+   if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr,
+  r->src.plen))
+   return 0;
+   } else if (!(r->common.flags & FIB_RULE_FIND_SADDR))
return 0;
}
 
-- 
1.4.4.1.g562ce

-
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-2.6.22] [IPV6] FIB6RULE: Find source address during looking up route.

2007-03-27 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 27 Mar 2007 16:25:19 +0200), Thomas 
Graf <[EMAIL PROTECTED]> says:

> * YOSHIFUJI Hideaki / ?$B5HF#1QL@ <[EMAIL PROTECTED]> 2007-03-27 22:45
> > When looking up route for destination with rules with
> > source address restrictions, we may need to find a source
> > address for the traffic if not given.
> 
> Out of curiosity, what sort of rules would have this flag set?
> The majority of lookups don't provide a valid source address.
> This new address search could become very expensive, because
> none of the results are cached.

This flags is used for Mobile IPv6.

Well, for non-connected sockets on hosts, yes,
the process might not be light-weight.
But, on routers, or once the socket is connected,
source address should be always set.

> This chunk won't apply to latest net-2.6.22, I've added two more
> flags yesterday.

Oops,... I'll send rebased version...

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


[PATCH net-2.6.22 TAKE 2] [IPV6] FIB6RULE: Find source address during looking up route.

2007-03-27 Thread YOSHIFUJI Hideaki /
When looking up route for destination with rules with
source address restrictions, we may need to find a source
address for the traffic if not given.

Based on patch from Noriaki TAKAMIYA <[EMAIL PROTECTED]>.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 include/linux/fib_rules.h |   11 +++
 net/ipv6/fib6_rules.c |   34 +++---
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index f278ba7..87b606b 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,10 +5,13 @@
 #include 
 
 /* rule is permanent, and cannot be deleted */
-#define FIB_RULE_PERMANENT 1
-#define FIB_RULE_INVERT2
-#define FIB_RULE_UNRESOLVED4
-#define FIB_RULE_DEV_DETACHED  8
+#define FIB_RULE_PERMANENT 0x0001
+#define FIB_RULE_INVERT0x0002
+#define FIB_RULE_UNRESOLVED0x0004
+#define FIB_RULE_DEV_DETACHED  0x0008
+
+/* try to find source address in routing lookups */
+#define FIB_RULE_FIND_SADDR0x0001
 
 struct fib_rule_hdr
 {
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index dd9720e..fc3882c 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -95,8 +96,27 @@ static int fib6_rule_action(struct fib_rule *rule, struct 
flowi *flp,
if (table)
rt = lookup(table, flp, flags);
 
-   if (rt != &ip6_null_entry)
+   if (rt != &ip6_null_entry) {
+   struct fib6_rule *r = (struct fib6_rule *)rule;
+
+   /*
+* If we need to find a source address for this traffic,
+* we check the result if it meets requirement of the rule.
+*/
+   if ((rule->flags & FIB_RULE_FIND_SADDR) &&
+   r->src.plen && !(flags & RT6_LOOKUP_F_HAS_SADDR)) {
+   struct in6_addr saddr;
+   if (ipv6_get_saddr(&rt->u.dst, &flp->fl6_dst,
+  &saddr))
+   goto again;
+   if (!ipv6_prefix_equal(&saddr, &r->src.addr,
+  r->src.plen))
+   goto again;
+   ipv6_addr_copy(&flp->fl6_src, &saddr);
+   }
goto out;
+   }
+again:
dst_release(&rt->u.dst);
rt = NULL;
goto out;
@@ -117,9 +137,17 @@ static int fib6_rule_match(struct fib_rule *rule, struct 
flowi *fl, int flags)
!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
return 0;
 
+   /*
+* If FIB_RULE_FIND_SADDR is set and we do not have a
+* source address for the traffic, we defer check for
+* source address.
+*/
if (r->src.plen) {
-   if (!(flags & RT6_LOOKUP_F_HAS_SADDR) ||
-   !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen))
+   if (flags & RT6_LOOKUP_F_HAS_SADDR) {
+   if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr,
+  r->src.plen))
+   return 0;
+   } else if (!(r->common.flags & FIB_RULE_FIND_SADDR))
return 0;
}
 
-- 
1.4.4.1.g562ce

-
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: ping6 to own link-local address

2007-03-27 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 21 Mar 2007 00:26:09 +0100 (CET)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> In article <[EMAIL PROTECTED]> (at Tue, 20 Mar 2007 15:16:40 -0700), Sridhar 
> Samudrala <[EMAIL PROTECTED]> says:
> 
> > On Tue, 2007-03-20 at 10:19 +0100, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> > > Hello.
> > > 
> > > Recent 2.6.21-git kernels do not respond to ping6 queries
> > > to our own (local) link-local address.  Now bisecting...
> > 
> > The following patch seems to be the cause for this regression.
> > 
> > [IPV6] ROUTE: Do not route packets to link-local address on other device.
> > 
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a0d78ebf3a0e33a1aeacf2fc518ad9273d6a1c2f
> 
> Right.  Hmm...

Well, 2.6.21 is coming.  I think it is better to revert it for now.
Current situation is more critical than the original.

Dave?

--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]: Fix ipv6 round-robin locking

2007-03-28 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Sat, 24 Mar 2007 12:44:36 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> The fix for the most serious of them is below, and I'd appreciate
> any feedback if people spot any problems or holes in that approach.

I hoped we could save some memory per fib6_node,
but I'm fine with it.

Regards,

--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: IPv6: Connection reset/timeout under heavy load

2007-03-28 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 28 Mar 2007 10:48:27 +0200), Agoston 
Horvath <[EMAIL PROTECTED]> says:

> YOSHIFUJI Hideaki / 吉藤英明 wrote:
> > Would you test with latest kernel, if possible, please?
> 
> For the archive: switching to 2.6.20.4 fixed this problem.

Thank you for your report.

I guess the following change will fix the issue for 2.6.16.y:
http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=gitroot/yoshfuji/linux-2.6-fix.git;a=commit;h=33a79bba0cc2f197b46cc54182f94c31ff6ad334

I hope this patch will go in 2.6.16-stable...

Regards,

--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: IPv6: Connection reset/timeout under heavy load

2007-03-28 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 28 Mar 2007 02:26:24 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> > http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=gitroot/yoshfuji/linux-2.6-fix.git;a=commit;h=33a79bba0cc2f197b46cc54182f94c31ff6ad334
> > 
> > I hope this patch will go in 2.6.16-stable...
> 
> Please forward this patch to Adrian Bunk ([EMAIL PROTECTED]),
> he will definitely add it to 2.6.16-stable for you.

I will do it again...

--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][IPv6]: Fix incorrect length check in rawv6_sendmsg()

2007-03-29 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 29 Mar 2007 14:26:44 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> From: Sridhar Samudrala <[EMAIL PROTECTED]>
> Date: Thu, 29 Mar 2007 14:17:28 -0700
> 
> > The check for length in rawv6_sendmsg() is incorrect.
> > As len is an unsigned int, (len < 0) will never be TRUE.
> > I think checking for IPV6_MAXPLEN(65535) is better.
> > 
> > Is it possible to send ipv6 jumbo packets using raw
> > sockets? If so, we can remove this check.
> 
> I don't see why such a limitation against jumbo would exist,
> does anyone else?
> 
> Thanks for catching this Sridhar.  A good compiler should simply
> fail to compile "if (x < 0)" when 'x' is an unsigned type, don't
> you think :-)

Dave, we use "int" for returning value,
so we should fix this anyway, IMHO;
we should not allow len > INT_MAX.

Don't you think so?

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

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 306d5d8..203e069 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -687,9 +687,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock 
*sk,
int err;
 
/* Rough check on arithmetic overflow,
-  better check is made in ip6_build_xmit
+  better check is made in ip6_append_data().
 */
-   if (len < 0)
+   if (len > INT_MAX)
return -EMSGSIZE;
 
/* Mirror BSD error message compatibility */
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0ad4719..f590db5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -615,7 +615,7 @@ do_udp_sendmsg:
return udp_sendmsg(iocb, sk, msg, len);
 
/* Rough check on arithmetic overflow,
-  better check is made in ip6_build_xmit
+  better check is made in ip6_append_data().
   */
if (len > INT_MAX - sizeof(struct udphdr))
return -EMSGSIZE;

--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 0/2] [iputils] MTU discovery changes

2007-04-03 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 23 Mar 2007 20:46:25 -0400), John 
Heffner <[EMAIL PROTECTED]> says:

> These add some changes that make tracepath a little more useful for 
> diagnosing MTU issues.  The length flag helps distinguish between MTU 
> black holes and other types of black holes by allowing you to vary the 
> probe packet lengths.  Using PMTUDISC_PROBE gives you the same results 
> on each run without having to flush the route cache, so you can see 
> where MTU changes in the path actually occur.
> 
> The PMTUDISC_PROBE patch goes in should be conditional on whether the 
> corresponding kernel patch (just sent) goes in.

Please update documents (docs/*.sgml) as well.  Thanks.

--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 0/2] [iputils] MTU discovery changes

2007-04-03 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 03 Apr 2007 17:45:06 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> > The PMTUDISC_PROBE patch goes in should be conditional on whether the 
> > corresponding kernel patch (just sent) goes in.
> 
> Please update documents (docs/*.sgml) as well.  Thanks.

doc/*.sgml. Sorry for typo.

--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] [IPv6] Exclude truncated packets from InHdrErrors statistics

2007-04-04 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 3 Apr 2007 15:55:51 +0900), Mitsuru 
Chinen <[EMAIL PROTECTED]> says:

> Incoming trancated packets are counted as not only InTruncatedPkts but
> also InHdrErrors. They should be counted as InTruncatedPkts only.
> 
> Signed-off-by: Mitsuru Chinen <[EMAIL PROTECTED]>
Acked-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--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 1/4] [IPv6] Add link and site-local scope inline

2007-04-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 05 Apr 2007 23:21:05 -0400), Brian 
Haley <[EMAIL PROTECTED]> says:

> Add link and site-local scope inline to avoid calls to ipv6_addr_type().
> 

I disagree.  Multicast scopes should also be handled appropriately.

--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 2/4] [IPv6] Add multicast address type inline

2007-04-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 05 Apr 2007 23:21:16 -0400), Brian 
Haley <[EMAIL PROTECTED]> says:

> Add multicast address type inline to avoid calls to ipv6_addr_type().
> 
> Signed-off-by: Brian Haley <[EMAIL PROTECTED]>
> ---
>   include/net/ipv6.h|5 +
>   net/ipv6/icmp.c   |   12 
>   net/ipv6/ip6_tunnel.c |4 ++--
>   net/ipv6/route.c  |4 ++--
>   4 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index d473789..a888b0e 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -439,6 +439,11 @@ static inline int ipv6_addr_scope_sitelocal(const struct 
> in6_addr *a)
>   return ((a->s6_addr32[0] & htonl(0xFFC0)) == htonl(0xFEC0));
>   }
> 
> +static inline int ipv6_addr_type_multicast(const struct in6_addr *a)
> +{
> + return ((a->s6_addr32[0] & htonl(0xFF00)) == htonl(0xFF00));
> +}
> +

Matter of taste, but I prefer ipv6_addr_multicast() to align
with ipv6_addr_any().

> diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
> index e94992a..709037f 100644
> --- a/net/ipv6/icmp.c
> +++ b/net/ipv6/icmp.c
> @@ -312,7 +312,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, 
> __u32 info,
>   struct flowi fl;
>   struct icmpv6_msg msg;
>   int iif = 0;
> - int addr_type = 0;
>   int len;
>   int hlimit, tclass;
>   int err = 0;
> @@ -327,8 +326,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, 
> __u32 info,
>*  Rule (e.1) is enforced by not using icmpv6_send
>*  in any code that processes icmp errors.
>*/
> - addr_type = ipv6_addr_type(&hdr->daddr);
> -
>   if (ipv6_chk_addr(&hdr->daddr, skb->dev, 0))
>   saddr = &hdr->daddr;
> 
> @@ -336,7 +333,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, 
> __u32 info,
>*  Dest addr check
>*/
> 
> - if ((addr_type & IPV6_ADDR_MULTICAST || skb->pkt_type != PACKET_HOST)) {
> + if (ipv6_addr_type_multicast(&hdr->daddr) || skb->pkt_type != 
> PACKET_HOST) {
>   if (type != ICMPV6_PKT_TOOBIG &&
>   !(type == ICMPV6_PARAMPROB &&
> code == ICMPV6_UNK_OPTION &&

I think this is okay.

> @@ -346,13 +343,11 @@ void icmpv6_send(struct sk_buff *skb, int type, int 
> code, __u32 info,
>   saddr = NULL;
>   }
> 
> - addr_type = ipv6_addr_type(&hdr->saddr);
> -
>   /*
>*  Source addr check
>*/
> 
> - if (addr_type & IPV6_ADDR_LINKLOCAL)
> + if (ipv6_addr_scope_linklocal(&hdr->saddr))
>   iif = skb->dev->ifindex;
> 
>   /*

No, this is not identical.

> @@ -361,7 +356,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, 
> __u32 info,
>*  We check unspecified / multicast addresses here,
>*  and anycast addresses will be checked later.
>*/
> - if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) {
> + if (ipv6_addr_any(&hdr->saddr) ||
> + ipv6_addr_type_multicast(&hdr->saddr)) {
>   LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: addr_any/mcast 
> source\n");
>   return;
>   }

I guess ipv6_addr_multicast() || ipv6_addr_any() is better.

> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index a0902fb..0dd1f63 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -,8 +,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
>   dev->iflink = p->link;
> 
>   if (p->flags & IP6_TNL_F_CAP_XMIT) {
> - int strict = (ipv6_addr_type(&p->raddr) &
> -   (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL));
> + int strict = ipv6_addr_type_multicast(&p->raddr) ||
> +  ipv6_addr_scope_linklocal(&p->raddr);
> 
>   struct rt6_info *rt = rt6_lookup(&p->raddr, &p->laddr,
>p->link, strict);

Different logic, but seems sane.

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 53d79ac..32c6398 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -227,8 +227,8 @@ static __inline__ int rt6_check_expired(const struct 
> rt6_info *rt)
> 
>   static inline int rt6_need_strict(struct in6_addr *daddr)
>   {
> - return (ipv6_addr_type(daddr) &
> - (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
> + return (ipv6_addr_is_multicast(daddr) ||
> + ipv6_addr_scope_linklocal(daddr));
>   }
> 

ditto.

--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 3/4] Add mapped address type inline

2007-04-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 05 Apr 2007 23:21:25 -0400), Brian 
Haley <[EMAIL PROTECTED]> says:

> Add mapped address type inline to avoid calls to ipv6_addr_type().
> 
> Signed-off-by: Brian Haley <[EMAIL PROTECTED]>
> ---
>   include/net/ipv6.h   |6 ++
>   net/ipv6/ip6_flowlabel.c |6 ++
>   net/ipv6/ipv6_sockglue.c |2 +-
>   net/ipv6/tcp_ipv6.c  |   13 +
>   net/ipv6/udp.c   |2 +-
>   net/sctp/ipv6.c  |4 ++--
>   6 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index a888b0e..f3e13db 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -444,6 +444,12 @@ static inline int ipv6_addr_type_multicast(const struct 
> in6_addr *a)
>   return ((a->s6_addr32[0] & htonl(0xFF00)) == htonl(0xFF00));
>   }
> 
> +static inline int ipv6_addr_type_mapped(const struct in6_addr *a)
> +{
> + return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 &&
> +  a->s6_addr32[2] == htonl(0x));
> +}
> +
>   /*
>*  Prototypes exported by ipv6
>*/

I prefer ipv6_addr_v4mapped() to align with ipv6_addr_any()
(and IN6_IS_ADDR_V4MAPPED() macro in RFC3493).

> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 537978c..a47d23d 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -132,7 +132,6 @@ static int tcp_v6_connect(struct sock *sk, struct 
> sockaddr *uaddr,
>   struct in6_addr *saddr = NULL, *final_p = NULL, final;
>   struct flowi fl;
>   struct dst_entry *dst;
> - int addr_type;
>   int err;
> 
>   if (addr_len < SIN6_LEN_RFC2133)
> @@ -163,12 +162,10 @@ static int tcp_v6_connect(struct sock *sk, struct 
> sockaddr *uaddr,
>   if(ipv6_addr_any(&usin->sin6_addr))
>   usin->sin6_addr.s6_addr[15] = 0x1;
> 
> - addr_type = ipv6_addr_type(&usin->sin6_addr);
> -
> - if(addr_type & IPV6_ADDR_MULTICAST)
> + if (ipv6_addr_type_multicast(&usin->sin6_addr))
>   return -ENETUNREACH;
> 
> - if (addr_type&IPV6_ADDR_LINKLOCAL) {
> + if (ipv6_addr_scope_linklocal(&usin->sin6_addr)) {
>   if (addr_len >= sizeof(struct sockaddr_in6) &&
>   usin->sin6_scope_id) {
>   /* If interface is set while binding, indices
> @@ -200,7 +197,7 @@ static int tcp_v6_connect(struct sock *sk, struct 
> sockaddr *uaddr,
>*  TCP over IPv4
>*/

different commit?

--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 4/4] Add loopback address type inline

2007-04-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 05 Apr 2007 23:21:33 -0400), Brian 
Haley <[EMAIL PROTECTED]> says:

> Add loopback address type inline to avoid calls to ipv6_addr_type().

> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index f6aa338..7f1aabe 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -455,8 +455,9 @@ int ip6_forward(struct sk_buff *skb)
>*/
>   if (xrlim_allow(dst, 1*HZ))
>   ndisc_send_redirect(skb, n, target);
> - } else if 
> (ipv6_addr_type(&hdr->saddr)&(IPV6_ADDR_MULTICAST|IPV6_ADDR_LOOPBACK
> - |IPV6_ADDR_LINKLOCAL)) {
> + } else if (ipv6_addr_type_multicast(&hdr->saddr) ||
> +ipv6_addr_loopback(&hdr->saddr) ||
> +ipv6_addr_scope_linklocal(&hdr->saddr)) {
>   /* This check is security critical. */
>   goto error;
>   }
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 32c6398..06ee92d 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1067,7 +1067,6 @@ int ip6_route_add(struct fib6_config *cfg)
>   struct net_device *dev = NULL;
>   struct inet6_dev *idev = NULL;
>   struct fib6_table *table;
> - int addr_type;
> 
>   if (cfg->fc_dst_len > 128 || cfg->fc_src_len > 128)
>   return -EINVAL;
> @@ -1108,9 +1107,7 @@ int ip6_route_add(struct fib6_config *cfg)
>   cfg->fc_protocol = RTPROT_BOOT;
>   rt->rt6i_protocol = cfg->fc_protocol;
> 
> - addr_type = ipv6_addr_type(&cfg->fc_dst);
> -
> - if (addr_type & IPV6_ADDR_MULTICAST)
> + if (ipv6_addr_type_multicast(&cfg->fc_dst))
>   rt->u.dst.input = ip6_mc_input;
>   else
>   rt->u.dst.input = ip6_forward;

different commit...

--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 1/4] [IPv6] Add link and site-local scope inline

2007-04-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 06 Apr 2007 02:37:52 -0400), Brian 
Haley <[EMAIL PROTECTED]> says:

> static inline int ipv6_addr_scope_linklocal(const struct in6_addr *a)
> {
> return ((a->s6_addr32[0] & htonl(0xFFC0)) == htonl(0xFE80) ||
>  ((a->s6_addr32[0] & htonl(0xFF00)) == htonl(0xFF00) &&
>   ((a)->s6_addr[1] & 0x0f) == IPV6_ADDR_SCOPE_LINKLOCAL)))
> }
> 
> That's not that clean an inline anymore, but still doable...

I would prefer to have ipv6_addr_linklocal() and
ipv6_addr_mc_linklocal() aligning with RFC3493.

--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: ping6 to own link-local address

2007-04-06 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Wed, 28 Mar 2007 01:45:33 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> > > > [IPV6] ROUTE: Do not route packets to link-local address on other 
> > > > device.
> > > > 
> > > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a0d78ebf3a0e33a1aeacf2fc518ad9273d6a1c2f
> > > 
> > > Right.  Hmm...
> > 
> > Well, 2.6.21 is coming.  I think it is better to revert it for now.
> > Current situation is more critical than the original.
> > 
> > Dave?
> 
> I will look into this and make some kind of decision on how
> to proceed tomorrow.

Dave?

I do think this is a regression in 2.6.21-rcs, and it is much
better to revert it.

Thank you.

--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 net-2.6.22 TAKE 2] [IPV6] FIB6RULE: Find source address during looking up route.

2007-04-06 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 28 Mar 2007 13:08:08 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> When looking up route for destination with rules with
> source address restrictions, we may need to find a source
> address for the traffic if not given.
> 
> Based on patch from Noriaki TAKAMIYA <[EMAIL PROTECTED]>.
> 
> Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

Dave? How about this?

--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 0/2] [iputils] MTU discovery changes

2007-04-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 23 Mar 2007 20:46:25 -0400), John 
Heffner <[EMAIL PROTECTED]> says:

> These add some changes that make tracepath a little more useful for 
> diagnosing MTU issues.  The length flag helps distinguish between MTU 
> black holes and other types of black holes by allowing you to vary the 
> probe packet lengths.  Using PMTUDISC_PROBE gives you the same results 
> on each run without having to flush the route cache, so you can see 
> where MTU changes in the path actually occur.
> 
> The PMTUDISC_PROBE patch goes in should be conditional on whether the 
> corresponding kernel patch (just sent) goes in.

Applied, thanks.

--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] [iputils] Add documentation for the -l flag.

2007-04-08 Thread YOSHIFUJI Hideaki /
Applied two documentation patches.  Thanks.

In article <[EMAIL PROTECTED]> (at Tue,  3 Apr 2007 13:51:07 -0400), John 
Heffner <[EMAIL PROTECTED]> says:

> ---
>  doc/tracepath.sgml |   13 +
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/doc/tracepath.sgml b/doc/tracepath.sgml
> index 71eaa8d..c0f308b 100644
> --- a/doc/tracepath.sgml
> +++ b/doc/tracepath.sgml
> @@ -15,6 +15,7 @@ traces path to a network host discovering MTU along this 
> path
>  
>  
>  tracepath
> +-l 
>  
>  
>  
> @@ -39,6 +40,18 @@ of UDP ports to maintain trace history.
>  
>  
>  
> +OPTIONS
> +
> + 
> +  
> +  
> +Sets the initial packet length to  +65536 for  +  
> + 
> +
> +
> +
>  OUTPUT
>  
>  
> -- 
> 1.5.0.2.gc260-dirty
> 
> -
> 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 1/2] [iputils] Fix asymm messages.

2007-04-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue,  3 Apr 2007 14:20:34 -0400), John 
Heffner <[EMAIL PROTECTED]> says:

> We should only print the asymm messages in tracepath/6 when you receive a
> TTL expired message, because this is the only time when we'd expect the
> same number of hops back as our TTL was set to for a symmetric path.

applied. thanks.

--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 2/2] [iputils] Re-probe at same TTL after MTU reduction.

2007-04-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue,  3 Apr 2007 14:20:35 -0400), John 
Heffner <[EMAIL PROTECTED]> says:

> This fixes a bug that would miss a hop after an ICMP packet too big message,
> since it would continue increase the TTL without probing again.

Applied, thanks.

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


[PATCH] [IPV6] SNMP: Fix {In,Out}NoRoutes statistics.

2007-04-13 Thread YOSHIFUJI Hideaki /
A packet which is being discarded because of no routes in the
forwarding path should not be counted as OutNoRoutes but as
InNoRoutes.
Additionally, on this occasion, a packet whose destinaion is
not valid should be counted as InAddrErrors separately.

Based on patch from Mitsuru Chinen <[EMAIL PROTECTED]>.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/route.c |   31 ---
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3931b33..ad058a9 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1775,13 +1775,22 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
  * Drop the packet on the floor
  */
 
-static inline int ip6_pkt_drop(struct sk_buff *skb, int code)
-{
-   int type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
-   if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED)
-   IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
-
-   IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTNOROUTES);
+static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
+  int ipstats_mib_noroutes)
+{
+   int type;
+   switch (ipstats_mib_noroutes) {
+   case IPSTATS_MIB_INNOROUTES:
+   type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
+   if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
+   IP6_INC_STATS(ip6_dst_idev(skb->dst), 
IPSTATS_MIB_INADDRERRORS);
+   break;
+   }
+   /* FALLTHROUGH */
+   case IPSTATS_MIB_OUTNOROUTES:
+   IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes);
+   break;
+   }
icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
kfree_skb(skb);
return 0;
@@ -1789,26 +1798,26 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int 
code)
 
 static int ip6_pkt_discard(struct sk_buff *skb)
 {
-   return ip6_pkt_drop(skb, ICMPV6_NOROUTE);
+   return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES);
 }
 
 static int ip6_pkt_discard_out(struct sk_buff *skb)
 {
skb->dev = skb->dst->dev;
-   return ip6_pkt_discard(skb);
+   return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
 }
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
 
 static int ip6_pkt_prohibit(struct sk_buff *skb)
 {
-   return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED);
+   return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
 }
 
 static int ip6_pkt_prohibit_out(struct sk_buff *skb)
 {
skb->dev = skb->dst->dev;
-   return ip6_pkt_prohibit(skb);
+   return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, 
IPSTATS_MIB_OUTNOROUTES);
 }
 
 static int ip6_pkt_blk_hole(struct sk_buff *skb)
-- 
1.5.1


-
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] KEY: Fix conversion between IPSEC_MODE_xxx and XFRM_MODE_xxx.

2007-04-17 Thread YOSHIFUJI Hideaki /
From: Kazunori MIYAZAWA <[EMAIL PROTECTED]>
Subject: [PATCH] KEY: Fix conversion between IPSEC_MODE_xxx and XFRM_MODE_xxx.

We should not blindly convert between IPSEC_MODE_xxx and XFRM_MODE_xxx just
by incrementing / decrementing because the assumption is not true any longer.

Signed-off-by: Kazunori MIYAZAWA <[EMAIL PROTECTED]>
Singed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 90deefe..a61e6f6 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -630,6 +630,35 @@ #endif
/* NOTREACHED */
 }
 
+static inline int pfkey_mode_from_xfrm(int mode)
+{
+   switch(mode) {
+   case XFRM_MODE_TRANSPORT:
+   return IPSEC_MODE_TRANSPORT;
+   case XFRM_MODE_TUNNEL:
+   return IPSEC_MODE_TUNNEL;
+   case XFRM_MODE_BEET:
+   return IPSEC_MODE_BEET;
+   default:
+   return -1;
+   }
+}
+
+static inline int pfkey_mode_to_xfrm(int mode)
+{
+   switch(mode) {
+   case IPSEC_MODE_ANY:/*XXX*/
+   case IPSEC_MODE_TRANSPORT:
+   return XFRM_MODE_TRANSPORT;
+   case IPSEC_MODE_TUNNEL:
+   return XFRM_MODE_TUNNEL;
+   case IPSEC_MODE_BEET:
+   return XFRM_MODE_BEET;
+   default:
+   return -1;
+   }
+}
+
 static struct sk_buff * pfkey_xfrm_state2msg(struct xfrm_state *x, int 
add_keys, int hsc)
 {
struct sk_buff *skb;
@@ -651,6 +680,7 @@ #endif
int encrypt_key_size = 0;
int sockaddr_size;
struct xfrm_encap_tmpl *natt = NULL;
+   int mode;
 
/* address family check */
sockaddr_size = pfkey_sockaddr_size(x->props.family);
@@ -928,7 +958,11 @@ #endif
sa2 = (struct sadb_x_sa2 *)  skb_put(skb, sizeof(struct sadb_x_sa2));
sa2->sadb_x_sa2_len = sizeof(struct sadb_x_sa2)/sizeof(uint64_t);
sa2->sadb_x_sa2_exttype = SADB_X_EXT_SA2;
-   sa2->sadb_x_sa2_mode = x->props.mode + 1;
+   if ((mode = pfkey_mode_from_xfrm(x->props.mode)) < 0) {
+   kfree_skb(skb);
+   return ERR_PTR(-EINVAL);
+   }
+   sa2->sadb_x_sa2_mode = mode;
sa2->sadb_x_sa2_reserved1 = 0;
sa2->sadb_x_sa2_reserved2 = 0;
sa2->sadb_x_sa2_sequence = 0;
@@ -1155,9 +1189,12 @@ static struct xfrm_state * pfkey_msg2xfr
 
if (ext_hdrs[SADB_X_EXT_SA2-1]) {
struct sadb_x_sa2 *sa2 = (void*)ext_hdrs[SADB_X_EXT_SA2-1];
-   x->props.mode = sa2->sadb_x_sa2_mode;
-   if (x->props.mode)
-   x->props.mode--;
+   int mode = pfkey_mode_to_xfrm(sa2->sadb_x_sa2_mode);
+   if (mode < 0) {
+   err = -EINVAL;
+   goto out;
+   }
+   x->props.mode = mode;
x->props.reqid = sa2->sadb_x_sa2_reqid;
}
 
@@ -1218,7 +1255,7 @@ static int pfkey_getspi(struct sock *sk,
struct sadb_address *saddr, *daddr;
struct sadb_msg *out_hdr;
struct xfrm_state *x = NULL;
-   u8 mode;
+   int mode;
u32 reqid;
u8 proto;
unsigned short family;
@@ -1233,7 +1270,9 @@ static int pfkey_getspi(struct sock *sk,
return -EINVAL;
 
if ((sa2 = ext_hdrs[SADB_X_EXT_SA2-1]) != NULL) {
-   mode = sa2->sadb_x_sa2_mode - 1;
+   mode = pfkey_mode_to_xfrm(sa2->sadb_x_sa2_mode);
+   if (mode < 0)
+   return -EINVAL;
reqid = sa2->sadb_x_sa2_reqid;
} else {
mode = 0;
@@ -1756,6 +1795,7 @@ parse_ipsecrequest(struct xfrm_policy *x
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
struct sockaddr_in6 *sin6;
 #endif
+   int mode;
 
if (xp->xfrm_nr >= XFRM_MAX_DEPTH)
return -ELOOP;
@@ -1764,7 +1804,9 @@ #endif
return -EINVAL;
 
t->id.proto = rq->sadb_x_ipsecrequest_proto; /* XXX check proto */
-   t->mode = rq->sadb_x_ipsecrequest_mode-1;
+   if ((mode = pfkey_mode_to_xfrm(rq->sadb_x_ipsecrequest_mode)) < 0)
+   return -EINVAL;
+   t->mode = mode;
if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_USE)
t->optional = 1;
else if (rq->sadb_x_ipsecrequest_level == IPSEC_LEVEL_UNIQUE) {
@@ -1877,7 +1919,7 @@ static struct sk_buff * pfkey_xfrm_polic
return skb;
 }
 
-static void pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, 
int dir)
+static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, 
int dir)
 {
struct sadb_msg *hdr;
struct sadb_address *addr;
@@ -2014,6 +2056,7 @@ #endif
struct sadb_x_ipsecrequest *rq;
struct xfrm_tmpl *t = xp->xfrm_vec + i;
int req_size;
+   int mode;
 
req_size = sizeof(struct sadb_x_ipsecrequest);
if (t->mode == XFRM_MODE_TUNNEL)
@@ -2027,7 +2070,9 @@ #

[GIT PATCH]

2007-04-18 Thread YOSHIFUJI Hideaki /
Hello.

Please consider pulling following changesets for supporting exporting
stats information via netlink, on top of net-2.6.22.

Statistics values are exported as u64.  Correspoinding draft patch
for iproute2 can be found at



3rd patch is preparation for preparation for future support for
IPv4 per-interface statistics and netlink interface, so we may want
to drop it for now.

All changeset are available on branch
net-2.6.22-20070417-stats-20070417
at
.

Regards,

---

HEADLINES
-

[IPV6] SNMP: Netlink interface.
[IPV6] SNMP: Move some statistic bits to net/ipv6/proc.c.
[IPV4] SNMP: Move some statistic bits to net/ipv4/proc.c.

DIFFSTAT


 include/linux/if_link.h |1 +
 include/net/ip.h|3 ++
 include/net/ipv6.h  |1 +
 net/ipv4/af_inet.c  |   59 ++---
 net/ipv4/proc.c |   25 +++
 net/ipv6/addrconf.c |   22 +
 net/ipv6/af_inet6.c |   33 -
 net/ipv6/proc.c |   62 +++
 8 files changed, 148 insertions(+), 58 deletions(-)

CHANGESETS
--

commit 4fa0b46927813ad4d70c82e0049d419345ddb7de
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 18:21:31 2007 +0900

[IPV6] SNMP: Netlink interface.

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

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5..604c243 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
IFLA_INET6_STATS,   /* statistics   */
IFLA_INET6_MCAST,   /* MC things. What of them? */
IFLA_INET6_CACHEINFO,   /* time values and max reasm size */
+   IFLA_INET6_ICMP6STATS,  /* statistics (icmpv6)  */
__IFLA_INET6_MAX
 };
 
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 00328b7..4408def 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -172,6 +172,7 @@ int snmp6_alloc_dev(struct inet6_dev *idev);
 int snmp6_free_dev(struct inet6_dev *idev);
 int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
 void snmp6_mib_free(void *ptr[2]);
+void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int 
bytes);
 
 struct ip6_ra_chain
 {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 47d3adf..d80ca98 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3429,6 +3429,8 @@ static inline size_t inet6_if_nlmsg_size(void)
nla_total_size(4) /* IFLA_INET6_FLAGS */
+ nla_total_size(sizeof(struct ifla_cacheinfo))
+ nla_total_size(DEVCONF_MAX * 4) /* IFLA_INET6_CONF */
+   + nla_total_size(IPSTATS_MIB_MAX * 8) /* 
IFLA_INET6_STATS */
+   + nla_total_size(ICMP6_MIB_MAX * 8) /* 
IFLA_INET6_ICMP6STATS */
 );
 }
 
@@ -3436,7 +3438,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct 
inet6_dev *idev,
 u32 pid, u32 seq, int event, unsigned int flags)
 {
struct net_device *dev = idev->dev;
-   struct nlattr *conf;
+   struct nlattr *nla;
struct ifinfomsg *hdr;
struct nlmsghdr *nlh;
void *protoinfo;
@@ -3476,12 +3478,22 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, 
struct inet6_dev *idev,
ci.retrans_time = idev->nd_parms->retrans_time;
NLA_PUT(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci);
 
-   conf = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
-   if (conf == NULL)
+   nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
+   if (nla == NULL)
goto nla_put_failure;
-   ipv6_store_devconf(&idev->cnf, nla_data(conf), nla_len(conf));
+   ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
 
-   /* XXX - Statistics/MC not implemented */
+   /* XXX - MC not implemented */
+
+   nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
+   if (nla == NULL)
+   goto nla_put_failure;
+   snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
+
+   nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * 
sizeof(u64));
+   if (nla == NULL)
+   goto nla_put_failure;
+   snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, 
nla_len(nla));
 
nla_nest_end(skb, protoinfo);
return nlmsg_end(skb, nlh);
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index fa3fb50..0dc5515 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -207,6 +207,31 @@ static const struct file_operations snmp6_seq_fops = {
.release = single_release,
 };
 
+static inline void
+__snmp6_fill_stats(u64 *stats,

[GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-18 Thread YOSHIFUJI Hideaki /
Hello.

(Sorry for resending..., I failed to put an appropriate subject line...)

Please consider pulling following changesets for supporting exporting
stats information via netlink, on top of net-2.6.22.

Statistics values are exported as u64.  Correspoinding draft patch
for iproute2 can be found at



3rd patch is preparation for preparation for future support for
IPv4 per-interface statistics and netlink interface, so we may want
to drop it for now.

All changeset are available on branch
net-2.6.22-20070417-stats-20070417
at
.

Regards,

---

HEADLINES
-

[IPV6] SNMP: Netlink interface.
[IPV6] SNMP: Move some statistic bits to net/ipv6/proc.c.
[IPV4] SNMP: Move some statistic bits to net/ipv4/proc.c.

DIFFSTAT


 include/linux/if_link.h |1 +
 include/net/ip.h|3 ++
 include/net/ipv6.h  |1 +
 net/ipv4/af_inet.c  |   59 ++---
 net/ipv4/proc.c |   25 +++
 net/ipv6/addrconf.c |   22 +
 net/ipv6/af_inet6.c |   33 -
 net/ipv6/proc.c |   62 +++
 8 files changed, 148 insertions(+), 58 deletions(-)

CHANGESETS
--

commit 4fa0b46927813ad4d70c82e0049d419345ddb7de
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 18:21:31 2007 +0900

[IPV6] SNMP: Netlink interface.

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

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5..604c243 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
IFLA_INET6_STATS,   /* statistics   */
IFLA_INET6_MCAST,   /* MC things. What of them? */
IFLA_INET6_CACHEINFO,   /* time values and max reasm size */
+   IFLA_INET6_ICMP6STATS,  /* statistics (icmpv6)  */
__IFLA_INET6_MAX
 };
 
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 00328b7..4408def 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -172,6 +172,7 @@ int snmp6_alloc_dev(struct inet6_dev *idev);
 int snmp6_free_dev(struct inet6_dev *idev);
 int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
 void snmp6_mib_free(void *ptr[2]);
+void snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int 
bytes);
 
 struct ip6_ra_chain
 {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 47d3adf..d80ca98 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3429,6 +3429,8 @@ static inline size_t inet6_if_nlmsg_size(void)
nla_total_size(4) /* IFLA_INET6_FLAGS */
+ nla_total_size(sizeof(struct ifla_cacheinfo))
+ nla_total_size(DEVCONF_MAX * 4) /* IFLA_INET6_CONF */
+   + nla_total_size(IPSTATS_MIB_MAX * 8) /* 
IFLA_INET6_STATS */
+   + nla_total_size(ICMP6_MIB_MAX * 8) /* 
IFLA_INET6_ICMP6STATS */
 );
 }
 
@@ -3436,7 +3438,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct 
inet6_dev *idev,
 u32 pid, u32 seq, int event, unsigned int flags)
 {
struct net_device *dev = idev->dev;
-   struct nlattr *conf;
+   struct nlattr *nla;
struct ifinfomsg *hdr;
struct nlmsghdr *nlh;
void *protoinfo;
@@ -3476,12 +3478,22 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, 
struct inet6_dev *idev,
ci.retrans_time = idev->nd_parms->retrans_time;
NLA_PUT(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci);
 
-   conf = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
-   if (conf == NULL)
+   nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
+   if (nla == NULL)
goto nla_put_failure;
-   ipv6_store_devconf(&idev->cnf, nla_data(conf), nla_len(conf));
+   ipv6_store_devconf(&idev->cnf, nla_data(nla), nla_len(nla));
 
-   /* XXX - Statistics/MC not implemented */
+   /* XXX - MC not implemented */
+
+   nla = nla_reserve(skb, IFLA_INET6_STATS, IPSTATS_MIB_MAX * sizeof(u64));
+   if (nla == NULL)
+   goto nla_put_failure;
+   snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_STATS, nla_len(nla));
+
+   nla = nla_reserve(skb, IFLA_INET6_ICMP6STATS, ICMP6_MIB_MAX * 
sizeof(u64));
+   if (nla == NULL)
+   goto nla_put_failure;
+   snmp6_fill_stats(nla_data(nla), idev, IFLA_INET6_ICMP6STATS, 
nla_len(nla));
 
nla_nest_end(skb, protoinfo);
return nlmsg_end(skb, nlh);
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index fa3fb50..0dc5515 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -207,6 +207,31 @@ static const struct file_operations snmp6_seq_fops = {
.release =

[RFC] [GIT PATCH net-2.6.23] IPV6: Configurable IPv6 address selection policy table (RFC3484)

2007-04-19 Thread YOSHIFUJI Hideaki /
Hello.

This is RFC(*) for supporting configurable IPv6 address selection policy
table, which is described in RFC3484.

Corresponding userspace tool is available at

.


We store labels only in kernel, and leave precedence in userspace
(/etc/gai.conf), so far.  The name resolution library (getaddrinfo(3))
is required to be changed to try reading label information from kernel.
On the other hand, on BSDs or on Solaris, full policy table including
precedence seems to be stored in kernel, and the name resolution
libary (getaddrinfo(3)) seems to use that information.
We could choose this approach.

Note: Solaris uses string (up to 15 characters excluding NUL) labels.

At this moment, glibc does not reload /etc/gai.conf promptly by default.
According to getaddrinfo(3) manpage, getaddrinfo(3) does not seem
thread safe if we put "reload yes" in the configuration file (/etc/gai.conf).
We probably need to fix that.

Problems in current approach:

Currently when the getaddrinfo(3) tries to reload /etc/gai.conf,
it performs fstat to check if the file is updated.  However, procfs
always reports current time as modification time, so getaddrinfo(3)
will always need to reload procfs.  To further optimization we should
touch procfs subsystem.

Another issue in procfs is it is not atomic.
To solve this issue, we probably need to support netlink
interface.  However, I am not sure how we can optimize reading 
policy from kernel with this approach.


Another problem.  I put several new ioctls in include/linux/ipv6.h, but
I guess it is very hard to include that file from userspace... sigh...

TODOs: Probably we should use RCUs.


Comments / optimions welcome.


*: We do not expect this will be included in net-2.6.22,
but 2.6.23 or so.

Regrads,

-

HEADLINES
-

[IPV6] ADDRCONF: define and export constant for ::.
[IPV6] ADDRCONF: Prepare supporting source address selection policy with 
ifindex.
[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy 
table.

DIFFSTAT


 include/linux/in6.h|2 
 include/linux/ipv6.h   |   16 ++
 include/net/addrconf.h |4 
 include/net/ipv6.h |5 +
 net/ipv6/Makefile  |1 
 net/ipv6/addrconf.c|   50 ++---
 net/ipv6/addrlabel.c   |  454 
 net/ipv6/af_inet6.c|3 
 8 files changed, 498 insertions(+), 37 deletions(-)

CHANGESETS
--

commit 27bafd017775cffa86d60eea179b68c4b90c4ae7
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 00:12:49 2007 +0900

[IPV6] ADDRCONF: define and export constant for ::.

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

diff --git a/include/linux/in6.h b/include/linux/in6.h
index d559fac..2a61c82 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
  * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
  * in network byte order, not in host byte order as are the IPv4 equivalents
  */
-#if 0
 extern const struct in6_addr in6addr_any;
 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
-#endif
 extern const struct in6_addr in6addr_loopback;
 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 47d3adf..371ee2f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -206,9 +206,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly 
= {
 };
 
 /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
-#if 0
 const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
-#endif
 const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
 
 static void addrconf_del_timer(struct inet6_ifaddr *ifp)

---
commit ce50931887ad6bdf951f1b165bd76e1cda9adf97
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 3 00:21:23 2007 +0900

[IPV6] ADDRCONF: Prepare supporting source address selection policy with 
ifindex.

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

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 371ee2f..c61fb62 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -831,7 +831,8 @@ static inline int ipv6_saddr_preferred(int type)
 }
 
 /* static matching label */
-static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
+static inline int ipv6_saddr_label(const struct in6_addr *addr, int type,
+  int ifindex)
 {
  /*
   *prefix (longest match)  label
@@ -866,7 +867,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
struct inet6_ifaddr *ifa_result = NULL;
int daddr_type = __ipv6_addr_type(daddr);
int daddr_scope = __ipv6_addr_src_scope(daddr_type);
-   u32 daddr_label = ipv6_saddr_label(daddr, daddr_type);
+   int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;
+   u32 daddr_label = ipv

Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 10:44:12 +0200), Thomas 
Graf <[EMAIL PROTECTED]> says:

> * YOSHIFUJI Hideaki <[EMAIL PROTECTED]> 2007-04-19 15:42
> > 
> > Please consider pulling following changesets for supporting exporting
> > stats information via netlink, on top of net-2.6.22.
> 
> The netlink bits are perfectly fine, why the dependency on proc fs?

I'll follow up to eliminate such dependency afterwards.

--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: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 17:58:55 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 10:44:12 +0200), Thomas 
> Graf <[EMAIL PROTECTED]> says:
> 
> > * YOSHIFUJI Hideaki <[EMAIL PROTECTED]> 2007-04-19 15:42
> > > 
> > > Please consider pulling following changesets for supporting exporting
> > > stats information via netlink, on top of net-2.6.22.
> > 
> > The netlink bits are perfectly fine, why the dependency on proc fs?
> 
> I'll follow up to eliminate such dependency afterwards.

Here it is.

All changesets are available on the
net-2.6.22-20070417-stats-20070419
branch at
.

---
[IPV6] SNMP: Export statistics via netlink without CONFIG_PROC_FS.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/proc.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 5c3ce1c..c847cef 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -141,6 +141,7 @@ static struct snmp_mib snmp6_udplite6_list[] = {
SNMP_MIB_ITEM("UdpLite6OutDatagrams", UDP_MIB_OUTDATAGRAMS),
SNMP_MIB_SENTINEL
 };
+#endif /* CONFIG_PROC_FS */
 
 static unsigned long
 fold_field(void *mib[], int offt)
@@ -155,6 +156,7 @@ fold_field(void *mib[], int offt)
return res;
 }
 
+#ifdef CONFIG_PROC_FS
 static inline void
 snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib 
*itemlist)
 {
@@ -206,6 +208,7 @@ static const struct file_operations snmp6_seq_fops = {
.llseek  = seq_lseek,
.release = single_release,
 };
+#endif /* CONFIG_PROC_FS */
 
 static inline void
 __snmp6_fill_stats(u64 *stats, void **mib, int items, int bytes)
@@ -232,6 +235,7 @@ snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int 
attrtype, int bytes)
}
 }
 
+#ifdef CONFIG_PROC_FS
 int snmp6_register_dev(struct inet6_dev *idev)
 {
struct proc_dir_entry *p;
@@ -309,12 +313,6 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
return 0;
 }
 
-void
-snmp6_fill_stats(u64 *stats, struct inet6_dev *idev, int attrtype, int bytes)
-{
-   memset(stats, 0, sizeof(bytes));
-}
-
 #endif /* CONFIG_PROC_FS */
 
 int snmp6_alloc_dev(struct inet6_dev *idev)
-- 
1.5.1

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


Re: [GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 19 Apr 2007 13:24:12 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> From: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
> Date: Thu, 19 Apr 2007 21:04:54 +0900 (JST)
> 
> > net-2.6.22-20070417-stats-20070419
> 
> I tried to pull this but I killed it before it tried to merge
> because it looked very large:
> 
> remote: Generating pack...
> remote: Done counting 5200 objects.
> remote: Result has 4227 objects.
> 
> such a small set of changes should not need so many objects
> :-)
:
> I'm going to rebase my tree today, so please resubmit this work
> after I sent a notification here that I have done so.

Hmm, strange; something was wrong.
Any way, of course, I will do so.

Regards,

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


[net-2.6.22] [TCP]: Fix linkage errors.

2007-04-24 Thread YOSHIFUJI Hideaki /
Recent ktime_t changes had introduced linkage errors.

| WARNING: "__divdi3" [net/ipv4/tcp_veno.ko] undefined!
| WARNING: "__divdi3" [net/ipv4/tcp_vegas.ko] undefined!
| WARNING: "__divdi3" [net/ipv4/tcp_lp.ko] undefined!
| WARNING: "__divdi3" [net/ipv4/tcp_illinois.ko] undefined!

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

---
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 8e31659..0cec615 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -87,10 +87,12 @@ static void tcp_illinois_acked(struct sock *sk, u32 
pkts_acked, ktime_t last)
 {
struct illinois *ca = inet_csk_ca(sk);
u32 rtt;
+   struct timeval tv;
 
ca->acked = pkts_acked;
 
-   rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
+   tv = ktime_to_timeval(net_timedelta(last));
+   rtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
 
/* ignore bogus values, this prevents wraparound in alpha math */
if (rtt > RTT_MAX)
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index b4e062a..0b990ea 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -265,8 +265,10 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 
num_acked, ktime_t last)
 {
struct tcp_sock *tp = tcp_sk(sk);
struct lp *lp = inet_csk_ca(sk);
+   struct timeval tv;
 
-   tcp_lp_rtt_sample(sk,  ktime_to_ns(net_timedelta(last)) / 
NSEC_PER_USEC);
+   tv = ktime_to_timeval(net_timedelta(last));
+   tcp_lp_rtt_sample(sk, tv.tv_sec * USEC_PER_SEC + tv.tv_usec);
 
/* calc inference */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 0f0ee7f..c13dc16 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -116,9 +116,11 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
 {
struct vegas *vegas = inet_csk_ca(sk);
u32 vrtt;
+   struct timeval tv;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   tv = ktime_to_timeval(net_timedelta(last));
+   vrtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
 
/* Filter to find propagation delay: */
if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 0b50d06..a439c49 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -73,9 +73,11 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
 {
struct veno *veno = inet_csk_ca(sk);
u32 vrtt;
+   struct timeval tv;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   tv = ktime_to_timeval(net_timedelta(last));
+   vrtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
 
/* Filter to find propagation delay: */
if (vrtt < veno->basertt)

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


[net-2.6.22] [IPV4]: Fix build without procfs.

2007-04-24 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv4/Makefile |4 ++--
 net/ipv4/proc.c   |2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 4ff6c15..3bd25f5 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -10,11 +10,11 @@ obj-y := route.o inetpeer.o protocol.o \
 tcp_minisocks.o tcp_cong.o \
 datagram.o raw.o udp.o udplite.o \
 arp.o icmp.o devinet.o af_inet.o  igmp.o \
-sysctl_net_ipv4.o fib_frontend.o fib_semantics.o
+sysctl_net_ipv4.o fib_frontend.o fib_semantics.o \
+proc.o
 
 obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o
 obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
-obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
 obj-$(CONFIG_IP_MROUTE) += ipmr.o
 obj-$(CONFIG_NET_IPIP) += ipip.o
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 97952d5..a236154 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -45,6 +45,7 @@
 #include 
 #include 
 
+#ifdef CONFIG_PROC_FS
 static int fold_prot_inuse(struct proto *proto)
 {
int res = 0;
@@ -390,6 +391,7 @@ out_netstat:
rc = -ENOMEM;
goto out;
 }
+#endif
 
 int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign)
 {
-- 
1.5.1

-
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: [net-2.6.22] [TCP]: Fix linkage errors.

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 17:53:24 +0200), Adrian 
Bunk <[EMAIL PROTECTED]> says:

> On Wed, Apr 25, 2007 at 12:17:43AM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> > Recent ktime_t changes had introduced linkage errors.
> > 
> > | WARNING: "__divdi3" [net/ipv4/tcp_veno.ko] undefined!
> > | WARNING: "__divdi3" [net/ipv4/tcp_vegas.ko] undefined!
> > | WARNING: "__divdi3" [net/ipv4/tcp_lp.ko] undefined!
> > | WARNING: "__divdi3" [net/ipv4/tcp_illinois.ko] undefined!
> > 
> > Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
> > 
> > ---
> > diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
> > index 8e31659..0cec615 100644
> > --- a/net/ipv4/tcp_illinois.c
> > +++ b/net/ipv4/tcp_illinois.c
> > @@ -87,10 +87,12 @@ static void tcp_illinois_acked(struct sock *sk, u32 
> > pkts_acked, ktime_t last)
> >  {
> > struct illinois *ca = inet_csk_ca(sk);
> > u32 rtt;
> > +   struct timeval tv;
> >  
> > ca->acked = pkts_acked;
> >  
> > -   rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
> > +   tv = ktime_to_timeval(net_timedelta(last));
> > +   rtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
> >  
> > /* ignore bogus values, this prevents wraparound in alpha math */
> > if (rtt > RTT_MAX)
> >...
> 
> Couldn't this be better solved by adding something like the following 
> to include/linux/ktime.h ?
> 
> static inline s64 ktime_to_us(const ktime_t kt)
> {
>return (s64) kt.tv.sec * USEC_PER_SEC + kt.tv.nsec / NSEC_PER_USEC;
> }
> 

That will introduce same error, won't it?

--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: [net-2.6.22] [TCP]: Fix linkage errors.

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 00:58:45 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 17:53:24 +0200), Adrian 
> Bunk <[EMAIL PROTECTED]> says:
> 
> > On Wed, Apr 25, 2007 at 12:17:43AM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> > > Recent ktime_t changes had introduced linkage errors.
> > > 
> > > | WARNING: "__divdi3" [net/ipv4/tcp_veno.ko] undefined!
> > > | WARNING: "__divdi3" [net/ipv4/tcp_vegas.ko] undefined!
> > > | WARNING: "__divdi3" [net/ipv4/tcp_lp.ko] undefined!
> > > | WARNING: "__divdi3" [net/ipv4/tcp_illinois.ko] undefined!
> > > 
> > > Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
> > > 
> > > ---
> > > diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
> > > index 8e31659..0cec615 100644
> > > --- a/net/ipv4/tcp_illinois.c
> > > +++ b/net/ipv4/tcp_illinois.c
> > > @@ -87,10 +87,12 @@ static void tcp_illinois_acked(struct sock *sk, u32 
> > > pkts_acked, ktime_t last)
> > >  {
> > >   struct illinois *ca = inet_csk_ca(sk);
> > >   u32 rtt;
> > > + struct timeval tv;
> > >  
> > >   ca->acked = pkts_acked;
> > >  
> > > - rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
> > > + tv = ktime_to_timeval(net_timedelta(last));
> > > + rtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
> > >  
> > >   /* ignore bogus values, this prevents wraparound in alpha math */
> > >   if (rtt > RTT_MAX)
> > >...
> > 
> > Couldn't this be better solved by adding something like the following 
> > to include/linux/ktime.h ?
> > 
> > static inline s64 ktime_to_us(const ktime_t kt)
> > {
> >return (s64) kt.tv.sec * USEC_PER_SEC + kt.tv.nsec / NSEC_PER_USEC;
> > }
> > 
> 
> That will introduce same error, won't it?

How about this?

Singed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305b..601a74e 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
 
 #endif
 
+static inline s64 ktime_to_us(const ktime_t kt)
+{
+   struct timeval tv = ktime_to_timeval(kt);
+   return tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * the clock_getres() system call to give application programmers an
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 8e31659..4adc47c 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -90,7 +90,7 @@ static void tcp_illinois_acked(struct sock *sk, u32 
pkts_acked, ktime_t last)
 
ca->acked = pkts_acked;
 
-   rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
+   rtt = ktime_to_us(net_timedelta(last));
 
/* ignore bogus values, this prevents wraparound in alpha math */
if (rtt > RTT_MAX)
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index b4e062a..43294ad 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -266,7 +266,7 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 
num_acked, ktime_t last)
struct tcp_sock *tp = tcp_sk(sk);
struct lp *lp = inet_csk_ca(sk);
 
-   tcp_lp_rtt_sample(sk,  ktime_to_ns(net_timedelta(last)) / 
NSEC_PER_USEC);
+   tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
 
/* calc inference */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 0f0ee7f..73e19cf 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -118,7 +118,7 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t 
last)
u32 vrtt;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
/* Filter to find propagation delay: */
if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 0b50d06..9edb340 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -75,7 +75,7 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
u32 vrtt;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
/* Filter to find propagation delay: */
if (vrtt < veno->basertt)

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


Re: [PATCH] Fix build errors on 32bit platforms with new ktime

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 10:04:20 -0700), Stephen 
Hemminger <[EMAIL PROTECTED]> says:

> Yoshifuji-san had the right idea, but ktime_to_us needs to be defined
> in a way that works on both 64 and 32bit platforms.

No, this does not cure.
>  
> +#define ktime_to_us(kt)  ((kt).tv64 / NSEC_PER_SEC)
> +

NSEC_PER_USEC?

> +static inline s64 ktime_to_us(const ktime_t kt)
> +{
> + return (s64) kt.tv_sec * USEC_PER_SEC + kt.tv_nsec / NSEC_PER_USEC;
> +}
> +

Please do NOT use division here, which was the source of the
linkage error, and the reason why I posted a patch to use
ktime_to_timeval().

--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] Fix build errors on 32bit platforms with new ktime

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 00:15:15 +0200), Thomas 
Gleixner <[EMAIL PROTECTED]> says:

> On Tue, 2007-04-24 at 14:57 -0700, Stephen Hemminger wrote:
> > On Wed, 25 Apr 2007 06:55:39 +0900 (JST)
> > YOSHIFUJI Hideaki / 吉藤英明  <[EMAIL PROTECTED]> wrote:
> > 
> > > In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 10:04:20 -0700), 
> > > Stephen Hemminger <[EMAIL PROTECTED]> says:
> > > 
> > > > Yoshifuji-san had the right idea, but ktime_to_us needs to be defined
> > > > in a way that works on both 64 and 32bit platforms.
> > > 
> > > No, this does not cure.
> > > >  
> > > > +#define ktime_to_us(kt)((kt).tv64 / 
> > > > NSEC_PER_SEC)
> > > > +
> > > 
> > > NSEC_PER_USEC?
> > 
> > On 64 bit platforms, ktime stores nano-seconds in a 64 bit value, so
> > this is correct.
> 
> Err, nsec_value / NSEC_PER_SEC results in seconds AFAICS
> 
> nsec_value / NSEC_PER_USEC gives you microseconds
> 
> > > 
> > > > +static inline s64 ktime_to_us(const ktime_t kt)
> > > > +{
> > > > +   return (s64) kt.tv_sec * USEC_PER_SEC + kt.tv_nsec / 
> > > > NSEC_PER_USEC;
> > > > +}
> > > > +
> > > 
> > > Please do NOT use division here, which was the source of the
> > > linkage error, and the reason why I posted a patch to use
> > > ktime_to_timeval().
> > 
> > On 32 bit platforms, ktime stores as two 32 bit values. Therefore the
> > division is only 32bit and therefore okay.
> 
> Nope.
> 
> #if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
> 
> 
> and on i386
> 
> config KTIME_SCALAR
> bool
> default y
> 
> so you take the 
> 
> ktime_to_timeval is probably the right way for it.


[TCP]: Fix linkage errors on i386.

To avoid raw division, use ktime_to_timeval() to get usec.

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

-- 
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305b..81bb9c7 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
 
 #endif
 
+static inline s64 ktime_to_us(const ktime_t kt)
+{
+   struct timeval tv = ktime_to_timeval(kt);
+   return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * the clock_getres() system call to give application programmers an
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 8e31659..4adc47c 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -90,7 +90,7 @@ static void tcp_illinois_acked(struct sock *sk, u32 
pkts_acked, ktime_t last)
 
ca->acked = pkts_acked;
 
-   rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
+   rtt = ktime_to_us(net_timedelta(last));
 
/* ignore bogus values, this prevents wraparound in alpha math */
if (rtt > RTT_MAX)
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index b4e062a..43294ad 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -266,7 +266,7 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 
num_acked, ktime_t last)
struct tcp_sock *tp = tcp_sk(sk);
struct lp *lp = inet_csk_ca(sk);
 
-   tcp_lp_rtt_sample(sk,  ktime_to_ns(net_timedelta(last)) / 
NSEC_PER_USEC);
+   tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
 
/* calc inference */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 0f0ee7f..73e19cf 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -118,7 +118,7 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t 
last)
u32 vrtt;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
/* Filter to find propagation delay: */
if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 0b50d06..9edb340 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -75,7 +75,7 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
u32 vrtt;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   vrtt = ktime_to_us(net_timedelta(last)) + 1;
 
/* Filter to find propagation delay: */
if (vrtt < veno->basertt)

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


Re: [net-2.6.22] [IPV4]: Fix build without procfs.

2007-04-24 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 12:35:49 +1000), Herbert Xu 
<[EMAIL PROTECTED]> says:

> This makes no sense.  Why should we include all these proc operations
> when PROC_FS is turned off? How about this as a fix (on top of the
> above patch):
> 
> [IPV4]: Move snmp_mib_init out of proc.c
> 
> The function snmp_mib_init has nothing to do with proc so this patch
> moves it out of proc.c and to the only place that uses it.  Right now
> there is only one user so I'ved made it static too.

Herbert, as I said before, we could defer that.
It was preparation for future development (per-interface statistics
and netlink interface.
(I would say, proc.c should be snmp.c.)

Regards,

--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: [1/2] [IPV4]: Consolidate common SNMP code

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 14:04:09 +1000), Herbert Xu 
<[EMAIL PROTECTED]> says:

> [IPV4]: Consolidate common SNMP code

> Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
Acked-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--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: [2/2] [IPV6]: Consolidate common SNMP code

2007-04-24 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 14:06:37 +1000), Herbert Xu 
<[EMAIL PROTECTED]> says:

> Hi:
> 
> [IPV6]: Consolidate common SNMP code
> 
> This patch moves the non-proc SNMP code into addrconf.c and reuses
> IPv4 SNMP code where applicable.
:
> Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>


Acked-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

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


[GIT PATCH] [net-2.6.22] IPv6, IPv4 Updates

2007-04-25 Thread YOSHIFUJI Hideaki /
Dave,

Please consider pulling following commits available on
net-2.6.22-20070425a-inet6-cleanup-20070425
branch at
.

HEADLINES
-

[IPV6] SIT: Unify code path to get hash array index.
[IPV4] IPIP: Unify code path to get hash array index.
[IPV4] IP_GRE: Unify code path to get hash array index.
[IPV6]: Export in6addr_any for future use.
[IPV6] XFRM: Use ip6addr_any where applicable.
[IPV6] NDISC: Unify main process of sending ND messages.

DIFFSTAT


 include/linux/in6.h|2 
 net/ipv4/ip_gre.c  |   23 ++--
 net/ipv4/ipip.c|   22 +---
 net/ipv6/addrconf.c|2 
 net/ipv6/ndisc.c   |  283 ++--
 net/ipv6/sit.c |   23 ++--
 net/ipv6/xfrm6_input.c |4 -
 7 files changed, 112 insertions(+), 247 deletions(-)

CHANGESETS
--

commit ed808452811f1b5b55727ab6c5336a488d5689b4
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 24 20:44:47 2007 +0900

[IPV6] SIT: Unify code path to get hash array index.

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

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 27fe10f..1efa95a 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -99,10 +99,10 @@ static struct ip_tunnel * ipip6_tunnel_lookup(__be32 
remote, __be32 local)
return NULL;
 }
 
-static struct ip_tunnel ** ipip6_bucket(struct ip_tunnel *t)
+static struct ip_tunnel **__ipip6_bucket(struct ip_tunnel_parm *parms)
 {
-   __be32 remote = t->parms.iph.daddr;
-   __be32 local = t->parms.iph.saddr;
+   __be32 remote = parms->iph.daddr;
+   __be32 local = parms->iph.saddr;
unsigned h = 0;
int prio = 0;
 
@@ -117,6 +117,11 @@ static struct ip_tunnel ** ipip6_bucket(struct ip_tunnel 
*t)
return &tunnels[prio][h];
 }
 
+static inline struct ip_tunnel **ipip6_bucket(struct ip_tunnel *t)
+{
+   return __ipip6_bucket(&t->parms);
+}
+
 static void ipip6_tunnel_unlink(struct ip_tunnel *t)
 {
struct ip_tunnel **tp;
@@ -147,19 +152,9 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct 
ip_tunnel_parm *parms, int
__be32 local = parms->iph.saddr;
struct ip_tunnel *t, **tp, *nt;
struct net_device *dev;
-   unsigned h = 0;
-   int prio = 0;
char name[IFNAMSIZ];
 
-   if (remote) {
-   prio |= 2;
-   h ^= HASH(remote);
-   }
-   if (local) {
-   prio |= 1;
-   h ^= HASH(local);
-   }
-   for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
+   for (tp = __ipip6_bucket(parms); (t = *tp) != NULL; tp = &t->next) {
if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
return t;
}

---
commit 2f66586f53dd6319323c7d0c6ac0d4a4fb522865
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 24 20:44:47 2007 +0900

[IPV4] IPIP: Unify code path to get hash array index.

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

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 37ab391..ebd2f2d 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -157,10 +157,10 @@ static struct ip_tunnel * ipip_tunnel_lookup(__be32 
remote, __be32 local)
return NULL;
 }
 
-static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
+static struct ip_tunnel **__ipip_bucket(struct ip_tunnel_parm *parms)
 {
-   __be32 remote = t->parms.iph.daddr;
-   __be32 local = t->parms.iph.saddr;
+   __be32 remote = parms->iph.daddr;
+   __be32 local = parms->iph.saddr;
unsigned h = 0;
int prio = 0;
 
@@ -175,6 +175,10 @@ static struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
return &tunnels[prio][h];
 }
 
+static inline struct ip_tunnel **ipip_bucket(struct ip_tunnel *t)
+{
+   return __ipip_bucket(&t->parms);
+}
 
 static void ipip_tunnel_unlink(struct ip_tunnel *t)
 {
@@ -206,19 +210,9 @@ static struct ip_tunnel * ipip_tunnel_locate(struct 
ip_tunnel_parm *parms, int c
__be32 local = parms->iph.saddr;
struct ip_tunnel *t, **tp, *nt;
struct net_device *dev;
-   unsigned h = 0;
-   int prio = 0;
char name[IFNAMSIZ];
 
-   if (remote) {
-   prio |= 2;
-   h ^= HASH(remote);
-   }
-   if (local) {
-   prio |= 1;
-   h ^= HASH(local);
-   }
-   for (tp = &tunnels[prio][h]; (t = *tp) != NULL; tp = &t->next) {
+   for (tp = __ipip_bucket(parms); (t = *tp) != NULL; tp = &t->next) {
if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr)
return t;
}

---
commit e8b22bea08420e24a09e32972f455c21206fe102
Author: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Date:   Tue Apr 24 20:44:48 2007 +0900

[IPV4] IP_GRE: Unify code path to get hash array index.

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

diff --git a/net/ipv4/ip_gre.c b/ne

Re: IPV6 source routing patch is still broken?

2007-04-26 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 26 Apr 2007 19:10:56 -0400), Chuck 
Ebbert <[EMAIL PROTECTED]> says:

> Another question: is it a good idea to even be shipping release
> kernels with Mobile IPV6 enabled? Unfortunately, "experimental"
> isn't enough to go by...

Well, we have still 2 missing pieces in 2.6.21, and we are trying to
push them (source address selection, which is already in net-2.6 and
xfrm subpolicy, which is still on dave's backlog?) to 2.6.22.
After 2.6.23, we would say yes.

--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: IPV6 source routing patch is still broken?

2007-04-27 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 27 Apr 2007 02:08:05 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> then the function proceeds to use the largest of
> 'accept_source_route' and 'idev->cnf.accept_source_route'
> for further checks.

Smallest:
if (accept_source_route > idev->cnf.accept_source_route)
accept_source_route = idev->cnf.accept_source_route;

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


e100 and eepro100

2007-04-27 Thread YOSHIFUJI Hideaki /
Hello.

I heard that there is a plan to remove eepro100 driver from kernel,
but from the IPv6 point of view, there are still some issues with
e100 driver, which does not exist in eepro100.

We are using some e100/eepro100 devices, and we have found that
we cannot pass the Conformance Test with e100 but with eepro100.

We have been having no chance to debug this issue so far, but
I guess there are some bugs in link detection code in e100.

Regards,

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


Re: many sockets, slow sendto

2007-04-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 30 Apr 2007 00:26:43 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:

> > Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
> 
> Eric, I've applied this, thanks again.
> 
> Could I trouble you to cook up an ipv6 version of this patch?

Here's my tentative version.  Not tested.
Dave, Eric, could you double-check this, please?

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

---
diff --git a/include/net/udp.h b/include/net/udp.h
index 98755eb..2c06017 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -120,8 +120,12 @@ static inline void udp_lib_close(struct sock *sk, long 
timeout)
 
 
 /* net/ipv4/udp.c */
+extern unsigned int udp_hash_port_and_rcvaddr(__u16 port,
+ const struct sock *sk);
 extern int udp_get_port(struct sock *sk, unsigned short snum,
-int (*saddr_cmp)(const struct sock *, const struct 
sock *));
+int (*saddr_cmp)(const struct sock *, const struct 
sock *),
+unsigned int (*hash_port_rcvaddr)(__u16 port,
+  const struct 
sock *sk));
 extern voidudp_err(struct sk_buff *, u32);
 
 extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1449707..9d4293d 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -125,6 +125,12 @@ static inline unsigned int hash_port_and_addr(__u16 port, 
__be32 addr)
return port ^ addr;
 }
 
+unsigned int udp4_hash_port_and_rcvaddr(__u16 port,
+   const struct sock *sk)
+{
+   return hash_port_and_addr(port, inet_sk(sk)->rcv_saddr);
+}
+
 static inline int __udp_lib_port_inuse(unsigned int hash, int port,
__be32 daddr, struct hlist_head udptable[])
 {
@@ -156,7 +162,9 @@ static inline int __udp_lib_port_inuse(unsigned int hash, 
int port,
 int __udp_lib_get_port(struct sock *sk, unsigned short snum,
   struct hlist_head udptable[], int *port_rover,
   int (*saddr_comp)(const struct sock *sk1,
-const struct sock *sk2 ))
+const struct sock *sk2),
+  unsigned int (*hash_port_rcvaddr)(__u16 port,
+const struct sock *sk))
 {
struct hlist_node *node;
struct hlist_head *head;
@@ -176,8 +184,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
for (i = 0; i < UDP_HTABLE_SIZE; i++, result++) {
int size;
 
-   hash = hash_port_and_addr(result,
-   inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(result, sk);
head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
if (hlist_empty(head)) {
if (result > sysctl_local_port_range[1])
@@ -203,8 +210,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
result = sysctl_local_port_range[0]
+ ((result - 
sysctl_local_port_range[0]) &
   (UDP_HTABLE_SIZE - 1));
-   hash = hash_port_and_addr(result,
-   inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(result, sk);
if (! __udp_lib_port_inuse(hash, result,
inet_sk(sk)->rcv_saddr, udptable))
break;
@@ -214,7 +220,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
 gotit:
*port_rover = snum = result;
} else {
-   hash = hash_port_and_addr(snum, inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(snum, sk);
head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
 
sk_for_each(sk2, node, head)
@@ -241,9 +247,11 @@ fail:
 }
 
 int udp_get_port(struct sock *sk, unsigned short snum,
-   int (*scmp)(const struct sock *, const struct sock *))
+   int (*scmp)(const struct sock *, const struct sock *),
+   unsigned int (*uhash)(u16 port, const struct sock *))
 {
-   return  __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover, scmp);
+   return  __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover,
+  scmp, uhash);
 }
 
 int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
@@ -257,7 +265,8 @@ int ipv4_rcv_saddr_equal(const struct sock *sk1, const 
struct sock *sk2)
 
 static inline int udp_v4_get_port(struct sock *sk, unsigned short snum)
 {
-   return udp_get_port(sk, snum, ipv4_rcv_saddr_equal);
+   return udp_get_port(sk

Re: [RFC, PATCH] IPV6 : add 64 bits components in struct in6_addr to speedup ipv6_addr_equal() & ipv6_addr_any()

2007-04-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 30 Apr 2007 16:28:51 +0200), Eric 
Dumazet <[EMAIL PROTECTED]> says:

> On 64bit arches, we can speedup some IPV6 addresses compares, using 64 bits 
> fields in struct in6_addr.
> 
> I am not sure if this patch wont break some user ABI, maybe we should use 
> some ifdef(KERNEL) ?

AFAIK, it did and I guess it will.  So, please do not do this even though
it is enclosed with ifdef(__KERNEL__), so far, at least, for 2.6.22.

--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: many sockets, slow sendto

2007-04-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 30 Apr 2007 14:47:15 +0200), Eric 
Dumazet <[EMAIL PROTECTED]> says:

> Also, I am not sure we need to use all 128 bits of IPV6 address, maybe the 64 
> low order bits are enough ?

Well, maybe, but in IPv6, auto-configured addresses on an interface have
the same 64-bit LSBs.  So, I'd keep as-is so far.

Here's the take 2, mainly for fixing UDP-Lite side.

Regards,


[IPV6]: Convert UDP(-Lite} to new 2-pass algos.

Some inputs from Eric Dumazet <[EMAIL PROTECTED]>.

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

--- 
diff --git a/include/net/udp.h b/include/net/udp.h
index 98755eb..2c06017 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -120,8 +120,12 @@ static inline void udp_lib_close(struct sock *sk, long 
timeout)
 
 
 /* net/ipv4/udp.c */
+extern unsigned int udp_hash_port_and_rcvaddr(__u16 port,
+ const struct sock *sk);
 extern int udp_get_port(struct sock *sk, unsigned short snum,
-int (*saddr_cmp)(const struct sock *, const struct 
sock *));
+int (*saddr_cmp)(const struct sock *, const struct 
sock *),
+unsigned int (*hash_port_rcvaddr)(__u16 port,
+  const struct 
sock *sk));
 extern voidudp_err(struct sk_buff *, u32);
 
 extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 635b0ea..6da0d41 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -120,5 +120,6 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, 
struct sk_buff *skb)
 
 extern voidudplite4_register(void);
 extern int udplite_get_port(struct sock *sk, unsigned short snum,
-   int (*scmp)(const struct sock *, const struct sock *));
+   int (*scmp)(const struct sock *, const struct sock *),
+   unsigned int (*uhash)(__u16, const struct sock *));
 #endif /* _UDPLITE_H */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1449707..9d4293d 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -125,6 +125,12 @@ static inline unsigned int hash_port_and_addr(__u16 port, 
__be32 addr)
return port ^ addr;
 }
 
+unsigned int udp4_hash_port_and_rcvaddr(__u16 port,
+   const struct sock *sk)
+{
+   return hash_port_and_addr(port, inet_sk(sk)->rcv_saddr);
+}
+
 static inline int __udp_lib_port_inuse(unsigned int hash, int port,
__be32 daddr, struct hlist_head udptable[])
 {
@@ -156,7 +162,9 @@ static inline int __udp_lib_port_inuse(unsigned int hash, 
int port,
 int __udp_lib_get_port(struct sock *sk, unsigned short snum,
   struct hlist_head udptable[], int *port_rover,
   int (*saddr_comp)(const struct sock *sk1,
-const struct sock *sk2 ))
+const struct sock *sk2),
+  unsigned int (*hash_port_rcvaddr)(__u16 port,
+const struct sock *sk))
 {
struct hlist_node *node;
struct hlist_head *head;
@@ -176,8 +184,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
for (i = 0; i < UDP_HTABLE_SIZE; i++, result++) {
int size;
 
-   hash = hash_port_and_addr(result,
-   inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(result, sk);
head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
if (hlist_empty(head)) {
if (result > sysctl_local_port_range[1])
@@ -203,8 +210,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
result = sysctl_local_port_range[0]
+ ((result - 
sysctl_local_port_range[0]) &
   (UDP_HTABLE_SIZE - 1));
-   hash = hash_port_and_addr(result,
-   inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(result, sk);
if (! __udp_lib_port_inuse(hash, result,
inet_sk(sk)->rcv_saddr, udptable))
break;
@@ -214,7 +220,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
 gotit:
*port_rover = snum = result;
} else {
-   hash = hash_port_and_addr(snum, inet_sk(sk)->rcv_saddr);
+   hash = hash_port_rcvaddr(snum, sk);
head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
 
sk_for_each(sk2, node, head)
@@ -241,9 +247,11 @@ fail:
 }
 
 int udp_get_port(struct sock *sk, unsigned short snum,
-   

udp hash change and ipv6

2007-04-30 Thread YOSHIFUJI Hideaki /
Dave,

Because I do not have enough time before depature to Lima
via LAX, I cannot send a full fix for this, but anyway...

In net-2.6, __udp_lib_get_port() touches inet_sk(sk)->rcv_saddr,
which will break ipv6, I think.  We probably need to add a
extra function pointer to check is sk has wildcard rcv_saddr
for the protocol.

static udp4_is_rcvaddr_any(const struct sock *sk)
{
return (!inet_sk(sk)->rcv_saddr);
}

static udp6_is_rcvaddr_any(const struct sock *sk)
{
return (ipv6_addr_any(inet_sk(sk)->rcv_saddr));
}

Or something.  We may need to think about ipv6only socket
option.

Regards,

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


Re: [PATCH 0/12] L2 network namespace (v3)

2007-01-18 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 17 Jan 2007 18:51:14 +0300), Dmitry 
Mishin <[EMAIL PROTECTED]> says:

> ===
> L2 network namespaces
> 
> The most straightforward concept of network virtualization is complete
> separation of namespaces, covering device list, routing tables, netfilter
> tables, socket hashes, and everything else.
> 
> On input path, each packet is tagged with namespace right from the
> place where it appears from a device, and is processed by each layer
> in the context of this namespace.
> Non-root namespaces communicate with the outside world in two ways: by
> owning hardware devices, or receiving packets forwarded them by their parent
> namespace via pass-through device.

Can you handle multicast / broadcast and IPv6, which are very important?

--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] [IPV6] fixed the size of the netlink message notified by inet6_rt_notify().

2007-01-18 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 19 Jan 2007 01:31:08 +0900 (JST)), 
Noriaki TAKAMIYA <[EMAIL PROTECTED]> says:

> >> Wed, 17 Jan 2007 13:33:22 +0100
> >> [Subject: Re: [PATCH] [IPV6] fixed the size of the netlink message 
> >> notified by inet6_rt_notify().]
> >> Patrick McHardy <[EMAIL PROTECTED]> wrote...
> 
> > Somewhat related: I have this patch for 2.6.21 to get rid of the
> > BUG_ON()s.
> 
>   I think the problem is the return value of inet6_rt_notify() is less
>   than expected.

I guess Patrick meant that using "BUG_ON()" would be an overkill.

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-19 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Fri, 19 Jan 2007 16:23:14 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> Patch to Implement IPv6 RFC 4429 (Optimistic Duplicate Address Detection).  In

Good work.  We will see if this would break core and basic ipv6 code.
Dave, please hold on.

Some quick comments.

> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -110,6 +110,7 @@ struct frag_hdr {
>  /* sysctls */
>  extern int sysctl_ipv6_bindv6only;
>  extern int sysctl_mld_max_msf;
> +extern int sysctl_optimistic_dad;
>  
:
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 2a7e461..f7afb2a 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -206,6 +206,8 @@ static struct ipv6_devconf ipv6_devconf_dflt 
> __read_mostly = {
>   .proxy_ndp  = 0,
>  };
>  
> +int sysctl_optimistic_dad = 1;
> +

Please put this into ipv6_devconf{} and make it per-interface variable.
And I think default should be kept off (0).

>  /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
>  #if 0
>  const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
> @@ -830,7 +832,8 @@ retry:
>   ift = !max_addresses ||
> ipv6_count_addresses(idev) < max_addresses ? 
>   ipv6_add_addr(idev, &addr, tmp_plen,
> -   ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 
> IFA_F_TEMPORARY) : NULL;
> +   ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 
> + IFA_F_TEMPORARY|IFA_F_OPTIMISTIC) : NULL;
>   if (!ift || IS_ERR(ift)) {
>   in6_ifa_put(ifp);
>   in6_dev_put(idev);

Please align ipv6_addr_type and IFA_F_TEMPORARY

> @@ -1174,7 +1177,8 @@ int ipv6_get_saddr(struct dst_entry *dst,
>  }
>  
>  
> -int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr)
> +int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, 
> + unsigned char banned_flags)
>  {
>   struct inet6_dev *idev;
>   int err = -EADDRNOTAVAIL;

Please align "struct net_device" and "unsigned char".

> @@ -1185,7 +1189,7 @@ int ipv6_get_lladdr(struct net_device *dev, struct 
> in6_addr *addr)
>  
>   read_lock_bh(&idev->lock);
>   for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) {
> - if (ifp->scope == IFA_LINK && 
> !(ifp->flags&IFA_F_TENTATIVE)) {
> + if (ifp->scope == IFA_LINK && 
> !(ifp->flags&banned_flags)) {
>   ipv6_addr_copy(addr, &ifp->addr);
>   err = 0;
>   break;
> @@ -1742,7 +1746,7 @@ ok:

It is not your fault, but please put a space around "&".

>   if (!max_addresses ||
>   ipv6_count_addresses(in6_dev) < max_addresses)
>   ifp = ipv6_add_addr(in6_dev, &addr, 
> pinfo->prefix_len,
> - 
> addr_type&IPV6_ADDR_SCOPE_MASK, 0);
> + 
> addr_type&IPV6_ADDR_SCOPE_MASK,0);
>  
>   if (!ifp || IS_ERR(ifp)) {
>   in6_dev_put(in6_dev);

Please do no kill space after ",".

> @@ -2123,7 +2132,8 @@ static void addrconf_add_linklocal(struct inet6_dev 
> *idev, struct in6_addr *addr
>  {
>   struct inet6_ifaddr * ifp;
>  
> - ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT);
> + ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, 
> + IFA_F_PERMANENT|IFA_F_OPTIMISTIC);
>   if (!IS_ERR(ifp)) {
>   addrconf_dad_start(ifp, 0);
>   in6_ifa_put(ifp);

Please align idev and IFA_F_PERMANENT.

> @@ -542,7 +556,8 @@ void ndisc_send_ns(struct net_device *dev, struct 
> neighbour *neigh,
>   int send_llinfo;
>  
>   if (saddr == NULL) {
> - if (ipv6_get_lladdr(dev, &addr_buf))
> + if (ipv6_get_lladdr(dev, &addr_buf,
> + (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
>   return;
>   saddr = &addr_buf;
>   }

ditto... ("dev" and "(")

> +and optimistic) are false then we can just fail
> +dad now.
> + */
> + type = ipv6_addr_type(saddr);   
> + if (!((ifp->flags & IFA_F_OPTIMISTIC) && 
> + (type & IPV6_ADDR_UNICAST))) {
> + addrconf_dad_failure(ifp); 
> + return;
> + }
>   }
>  
>   idev = ifp->idev;

hmm? Here, is saddr always unicast, isn't it?!

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-22 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Mon, 22 Jan 2007 13:15:28 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> Reposted patch, with your suggestions/corrections incorporated.  The only 
> thing
> I left alone was your last comment regarding the checking of saddr for being a
> unicast address.  According to the RFC as I read it, its possible to receive
> valid neighbor soliciations with a source address that is the unspecified
> address, which I didn't think ipv6_addr_type flagged as being unicast.  Now it
> may be that such NS messages are discarded before arriving at that recieve
> routine, but I was figuring better safe than sorry.  If you're sufficiently
> confident that we won't see non-unicast saddrs there, let me know and I'll
> happily remove that as well.

Okay, right, we can see unspecified source address.
However, we have "dad" variable.

More comments.

> +++ b/include/linux/ipv6.h
> @@ -176,6 +176,7 @@ struct ipv6_devconf {
>   __s32   accept_ra_rt_info_max_plen;
>  #endif
>  #endif
> + __s32   use_optimistic_dad;
>   __s32   proxy_ndp;
>   void*sysctl;
>  };

Please do not insert between variables but add to the right before the
"sysctl" member.

> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 81480e6..972a33a 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -570,6 +570,7 @@ enum {
>   NET_IPV6_RTR_PROBE_INTERVAL=21,
>   NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
>   NET_IPV6_PROXY_NDP=23,
> + NET_IPV6_OPTIMISTIC_DAD=24,
>   __NET_IPV6_MAX
>  };
>  
:
> @@ -3918,6 +3948,15 @@ static struct addrconf_sysctl_table
>   .proc_handler   =   &proc_dointvec,
>   },
>   {
> + .ctl_name   =   NET_IPV6_OPTIMISTIC_DAD,
> + .procname   =   "use_optimistic_dad",
> + .data   =   
> &ipv6_devconf.use_optimistic_dad,
> + .maxlen =   sizeof(int),
> + .mode   =   0644,
> + .proc_handler   =   &proc_dointvec,
> +
> + },
> + {
>   .ctl_name   =   0,  /* sentinel */
>   }
>   },

Please use similar names (sysctl enum, member name and sysctl name(s)); e.g.
NET_IPV6_OPTIMISTIC_DAD, optimistic_dad, "optimistic_dad".

You forgot adding DEVCONF_OPTIMISTIC_DAD in include/linux/ipv6.h
and net/ipv6/addrconf.c:ipv6_store_devconf().

:
> @@ -746,6 +772,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>   int dad = ipv6_addr_any(saddr);
>   int inc;
>   int is_router;
> + int type;
>  
>   if (ipv6_addr_is_multicast(&msg->target)) {
>   ND_PRINTK2(KERN_WARNING 

Here, "dad" is true if the source is unspecified address.  So,

> @@ -816,8 +845,20 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>   goto out;
>   }
>   }
> - addrconf_dad_failure(ifp); 
> - return;
> +
> + /* The one exception to the above rule about 
> +optimistic addresses is that we need to always 
> +respond to an NS from a unicast address if we are
> +optimistic. RFC 4429 Sec 3.3.  If (unicast
> +and optimistic) are false then we can just fail
> +dad now.
> + */
> + type = ipv6_addr_type(saddr);   
> + if (!((ifp->flags & IFA_F_OPTIMISTIC) && 
> + (type & IPV6_ADDR_UNICAST))) {
> + addrconf_dad_failure(ifp); 
> + return;
> + }
>   }
>  
>   idev = ifp->idev;

You can say,
if (dad || !(ifp->flags & IFA_F_OPTIMISTIC)) {
addrconf_dad_failure(ifp);
return;
}

Regards,

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


Re: [PATCH 2.6.20-rc5] IPV6: skb is unexpectedly freed.

2007-01-23 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 24 Jan 2007 15:31:47 +1100), Herbert Xu 
<[EMAIL PROTECTED]> says:

> Masayuki Nakagawa <[EMAIL PROTECTED]> wrote:
> > 
> > I suggest to use kfree_skb() instead of __kfree_skb().
> 
> I agree.  In fact please do it for all paths in that function, i.e.,
> just change __kfree_skb to kfree_skb rather than adding a special case
> for this path.

I do think so, too.

--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: [IPV6] RAW: Add checksum default defines for MH.

2007-01-23 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 24 Jan 2007 17:56:23 +1100), Herbert Xu 
<[EMAIL PROTECTED]> says:

> David Miller <[EMAIL PROTECTED]> wrote:
> >
> > Did a complete agreement occur that this patch is ok?
> 
> My only concern is that we're putting an arbitrary list of
> protocols in the generic raw.c.  What's the justification
> for including these protocols in particular but not others?
> 
> Is there any reason why the application can't just use the
> existing IPV6_CHECKSUM socket option to set the same fields?

Yes, it can.

The only reason they (not myself :-)) want to put this in is
because the RFC says that MIP6 implementation MUST compute
checksum by default when it passes the MH to userspace.  On
the other hand, it also states that user space application SHOULD
set IPV6_CHECKSUM to 4.

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-25 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 25 Jan 2007 14:45:00 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 2a7e461..46f91ee 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -830,7 +830,8 @@ retry:
>   ift = !max_addresses ||
> ipv6_count_addresses(idev) < max_addresses ? 
>   ipv6_add_addr(idev, &addr, tmp_plen,
> -   ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 
> IFA_F_TEMPORARY) : NULL;
> +   ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, 
> +   IFA_F_TEMPORARY|IFA_F_OPTIMISTIC) : NULL;
>   if (!ift || IS_ERR(ift)) {
>   in6_ifa_put(ifp);
>   in6_dev_put(idev);

If optimistic_dad is disabled, flags should be IFA_F_TEMPORARY,
not IFA_F_TEMPORARY|IFA_F_OPTIMISTIC.

Another idea is to use IFA_F_OPTIMISTIC not
IFA_F_OPTIMISTIC|IFA_F_TENTATIVE until the DAD has been finished.

> @@ -1027,15 +1029,17 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
:
> + /* Rule 3: Avoid deprecated and optimistic address */
>   if (hiscore.rule < 3) {
>   if (ipv6_saddr_preferred(hiscore.addr_type) ||
> - !(ifa_result->flags & IFA_F_DEPRECATED))
> + ((!(ifa_result->flags & IFA_F_DEPRECATED)) 
> && 
> + (!(ifa_result->flags & IFA_F_OPTIMISTIC
>   hiscore.attrs |= 
> IPV6_SADDR_SCORE_PREFERRED;
>   hiscore.rule++;

((ifa_result->flags & 
(IFA_F_DEPRECATED|IFA_F_OPTIMISTIC)) == 0)

>   }
>   if (ipv6_saddr_preferred(score.addr_type) ||
> - !(ifa->flags & IFA_F_DEPRECATED)) {
> + ((!(ifa->flags & IFA_F_DEPRECATED)) &&
> + (!(ifa_result->flags & IFA_F_OPTIMISTIC {
>   score.attrs |= IPV6_SADDR_SCORE_PREFERRED;
>   if (!(hiscore.attrs & 
> IPV6_SADDR_SCORE_PREFERRED)) {
>   score.rule = 3;

ditto.

> @@ -2123,7 +2133,8 @@ static void addrconf_add_linklocal(struct inet6_dev 
> *idev, struct in6_addr *addr
>  {
>   struct inet6_ifaddr * ifp;
>  
> - ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT);
> + ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, 
> + IFA_F_PERMANENT|IFA_F_OPTIMISTIC);
>   if (!IS_ERR(ifp)) {
>   addrconf_dad_start(ifp, 0);
>   in6_ifa_put(ifp);

Please do not always put IFA_F_OPTIMISTIC.

>  
> + /*
> +  * Optimistic nodes need to joing the anycast address
> +  * right away
> +  */
> + if (ifp->flags & IFA_F_OPTIMISTIC)
> + addrconf_join_anycast(ifp);
> +
>   if (ifp->prefix_len != 128 && (ifp->flags&IFA_F_PERMANENT))
>   addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 0,
>   flags);

Should we join anycast even if the node is a host (not a router)?!

When you add a call to "addrconf_join_anycast()", 
you must consider when to leave this.


> @@ -2573,6 +2594,18 @@ static void addrconf_dad_start(struct inet6_ifaddr 
> *ifp, u32 flags)
>   addrconf_dad_stop(ifp);
>   return;
>   }
> +
> + /*
> +  * Forwarding devices (routers) should not use
> +  * optimistic addresses
> +  * Nor should interfaces that don't know the 
> +  * Source address for their default gateway
> +  * RFC 4429 Sec 3.3
> +  */
> + if ((ipv6_devconf.forwarding) ||
> +(ifp->rt == NULL))
> + ifp->flags &= ~IFA_F_OPTIMISTIC;
> +
>   addrconf_dad_kick(ifp);
>   spin_unlock_bh(&ifp->lock);
>  out:

Please test this condition when you are adding the
address.

BTW, you have not implemented the later condition,
right?   Sefault gatewa is not tested.

> index 6a9f616..fcd22e3 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -498,7 +498,21 @@ static void ndisc_send_na(struct net_device *dev, struct 
> neighbour *neigh,
>  msg->icmph.icmp6_unused = 0;
>  msg->icmph.icmp6_router= router;
>  msg->icmph.icmp6_solicited = solicited;
> -msg->icmph.icmp6_override  = override;
> + if (!ifp || !(ifp->flags & IFA_F_OPTIMISTIC))
> + msg->icmph.icmp6_override  = override;
> + else {
> + /*
> +  * We must clear the override flag on all
> +  * neighbor advertisements from source 
> +  * addresses that are OPTIMISTIC - RFC 4429
> +  * section 2.2
> +  */
> + if (override)
> + printk(KERN_WARNING
> + "Disallowing override flag for OPTIMISTIC 

[USBNET] ASIX: Add IO-DATA ETG-US2 Support.

2007-01-26 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 drivers/usb/net/asix.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index 896449f..4206df2 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -1449,6 +1449,10 @@ static const struct usb_device_idproducts [] = {
// Linksys USB1000
USB_DEVICE (0x1737, 0x0039),
.driver_info = (unsigned long) &ax88178_info,
+}, {
+   // IO-DATA ETG-US2
+   USB_DEVICE (0x04bb, 0x0930),
+   .driver_info = (unsigned long) &ax88178_info,
 },
{ },// END
 };
-- 
1.4.4.1.g562ce

-
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


[USBNET] PEGASUS: Fix typo in Corega products.

2007-01-26 Thread YOSHIFUJI Hideaki /
s/FEter/FEther/.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 drivers/usb/net/pegasus.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
index 98f6898..c746782 100644
--- a/drivers/usb/net/pegasus.h
+++ b/drivers/usb/net/pegasus.h
@@ -214,9 +214,9 @@ PEGASUS_DEV( "Billionton USBEL-100", VENDOR_BILLIONTON, 
0x0988,
DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
DEFAULT_GPIO_RESET | PEGASUS_II )
-PEGASUS_DEV( "Corega FEter USB-TX", VENDOR_COREGA, 0x0004,
+PEGASUS_DEV( "Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
DEFAULT_GPIO_RESET )
-PEGASUS_DEV( "Corega FEter USB-TXS", VENDOR_COREGA, 0x000d,
+PEGASUS_DEV( "Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
DEFAULT_GPIO_RESET | PEGASUS_II )
 PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
DEFAULT_GPIO_RESET )
-- 
1.4.4.1.g562ce

-
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: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-26 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 26 Jan 2007 09:27:30 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> I'm looking for it at the moment, but I too had assumed that redirecting the
> outgoing packet to the default router would happen automatically within the
> routing code as a result of not having a completed neighbor entry available.
> Since I've modified ndisc_send_ns such that we will never send Neighbor
> solicitations from an optimistic address, as per section 3.2, we'll never get 
> a
> completed neightbor entry while the address is optimistic.  If thats not the
> case, I'd welcome some suggestions on how to implement this (given that I'm 
> not
> overly familiar with the code right now).  From what I see, I think the 
> routing
> code will select the default route when rti6_nexthop is null during route
> selection, which it will be if the neighbor entry doesn't get resolved.  Not
> 100% sure though.  Let me know what you think.

(Now I remember that I hit similar issue before when I once
tried to implement this)

Well... no, you cannot assume that routing code solves this issue.
This is not so trivial, and I am not aware clean solution yet...

On reason of this issue is because the source address may not be
probided by user, and the source address selection will be done
after looking up routing table.

One possibiliy is to solve by rt->rt6i_nexthop->output(),
but I guess we will hit some race condition.

Hmm...

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-29 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 29 Jan 2007 16:30:13 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> Quick reality check here.  In thinking about how best to go about this
> redirection of frames to the default router, based on Dave M.s input, I think
> that the best solution would be in ndisc_send_ns.  What I was thinking was 
> that
> in ndisc_send_ns, we already detect if a source address is optimistic and 
> squash
> the transmission of the frame there.  What if in addition to that supression, 
> we
:

Well...I think it is okay if sending NS is deferred (or omit) in
ndisc_send_ns() (or in ndisc_solicit(), probably) if the source is
optimistic address, but... I'm not sure so far if it is appropriate
from design POV. The ndisc_send_ns() nor ndisc_solicit() is not about
our current neigh state machine, at all.

I do not think we should copy neighbor information from (one of)
default routers, but use temporary neigh entry (or neigh in new state)
for such datagrams in stead.  We should aware that:

 1) default router's link-layer address may change.
 2) we may have more than one default routers.
 3) the default router's link-layer may be invalidated.

Anyway, I'm start thinking about CONFIG_IPV6_OPTIMISTIC_DAD to 
make sure the new code path will not break anything else...

--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][IPv6] Fix wrong routing mechanism for Link Local IPv6 packets

2007-01-29 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Wed, 21 Feb 2007 02:24:26 -0500), weidong 
<[EMAIL PROTECTED]> says:

>  eth0: fe80::20c:29ff:fe24:fa0a
> | eth1: fe80::20c:29ff:fe24:fa14 
> |  |
> 
> |  |
> |  |
> | LAN1 |LAN2
> |  |
>   -
> ^
> |  
>  Send Echo Request(src addr = fe80::200:ff:fe00:100)

Sorry, I could not understand this figure
Would you elaborate this?

--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][IPv6] Fix wrong routing mechanism for Link Local IPv6 packets

2007-01-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 30 Jan 2007 16:55:12 +0900), "Wei Dong" 
<[EMAIL PROTECTED]> says:

> Hello, Mr yoshfuji
> Take ping6 for example. Asumming there is a router which has 2 NICs. 
> eth0 on router has ipv6 addr fe80::20c:29ff:fe24:fa0a, eth1 on router has 
> ipv6 addr fe80::20c:29ff:fe24:fa14. Also there is a host connected to 
> router's eth0, and the host's ipv6 addr is fe80::200:ff:fe00:100. We ping6 
:

I still need more precise figure.

Please draw complete box for the 2-3 boxes (pinger, router (and the
destination)), link(s) and interfaces.

+-+
|Router   |
+---+-+---+
eth0| |eth1
| |
eth0|
+---+-+
|Host1|
+-+

Host1  eth0: fe80:
Router eth0: fe80:
Router eth1: fe80:...

Or, something like that

I think you may use other tool such as tgif etc.

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-01-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Tue, 30 Jan 2007 08:02:08 -0500), Neil 
Horman <[EMAIL PROTECTED]> says:

> > I do not think we should copy neighbor information from (one of)
> > default routers, but use temporary neigh entry (or neigh in new state)
> > for such datagrams in stead.  We should aware that:
> > 
> Not sure how that is different from what I'm proposing.  a neighbor entry that
> maps a given host on the current subnet to the MAC of the default router, that
> then gets flushed when DAD completes is temporary, as far as I can see.
> 
> >  1) default router's link-layer address may change.
> True, but if this changes, all our network connectivity is lost, until the
> normal neighbor solicitation process completes anyway.

No, router may update its link-layer address by NA with Override flag set.
In that case, we must use new link-layer for subsequent packets from
our opportunistic address duing DAD.

> >  2) we may have more than one default routers.
> True, but I would think we could select any of them and this would work.
> Granted, we wouldn't use all the default routers in the table as we would with
> routed frames, but I'm not sure how we avoid that.

I mean, if the status of the selected default router has changed or 
has been deleted, we should try other router, at least.

> >  3) the default router's link-layer may be invalidated.
> > 
> yes, but this would be bad for the same reason as (1)

We MUST 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][IPv6] Fix wrong routing mechanism for Link Local IPv6 packets

2007-01-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 21 Feb 2007 09:57:12 -0500), weidong 
<[EMAIL PROTECTED]> says:

> The following is the figure.
:
> Host eth0: fe80::200:ff:fe00:100
> Router eth0: fe80::20c:29ff:fe24:fa0a
> Router eth1: fe80::20c:29ff:fe24:fa14

 Other network
  |
  | eth1
 +++
 | Router  |
 +++
  | eth0
  |
  | eth0
 +++
 |  Host   |
 +-+

> We ping6 from host's eth0 to Router's eth1. Echo Request's src addr =
> fe80::200:ff:fe00:100, dst addr = fe80::20c:29ff:fe24:fa14. And Kernel
> just send ICMPv6 redirect packet and then forward the Echo Request to
> router's eth0. If we run tcpdump on Host eth0, we can receive the ICMPv6
> Redirect packet. And if we send NA which advertises

This is correct, and intended behavior.

> fe80::20c:29ff:fe24:fa14 MAC address(this is very easy for v6eval tool),
> we also can receive the forwarded Echo Request(src:fe80::200:ff:fe00:100
> dst is fe80::20c:29ff:fe24:fa14). 

Well, this is known issue, actually.

While this cannot happen in normal operation, we should NOT accept
such traffic. :-)

Here is the (untested) fix.

-
[IPV6] ROUTE: Do not accept traffic for link-local address on different 
interface.

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

--- 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5f0043c..a7468e0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -311,12 +311,19 @@ static inline void rt6_probe(struct rt6_info *rt)
 static int inline rt6_check_dev(struct rt6_info *rt, int oif)
 {
struct net_device *dev = rt->rt6i_dev;
+   int ret = 0;
+
+   if (dev->flags & IFF_LOOPBACK) {
+   if (!WARN_ON(rt->rt6i_idev == NULL) &&
+   rt->rt6i_idev->dev->ifindex == oif)
+   ret = 1;
+   else
+   return 0;
+   }
if (!oif || dev->ifindex == oif)
return 2;
-   if ((dev->flags & IFF_LOOPBACK) &&
-   rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif)
-   return 1;
-   return 0;
+
+   return ret;
 }
 
 static int inline rt6_check_neigh(struct rt6_info *rt)

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


Re: [Patch][IPv6] Fix wrong routing mechanism for Link Local IPv6 packets

2007-01-30 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 21 Feb 2007 23:51:45 -0500), weidong 
<[EMAIL PROTECTED]> says:

>   Thanks for your patch. I think maybe we checking oif first is better,
> and WARN_ON in function rt6_score_route().

Please remove WARN_ON.  Otherwise, I'm fine with it.

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-05 Thread YOSHIFUJI Hideaki /
Hello.

In article <[EMAIL PROTECTED]> (at Mon, 5 Feb 2007 15:56:51 -0500), Neil Horman 
<[EMAIL PROTECTED]> says:


>   if (ifp == NULL && valid_lft) {
>   int max_addresses = in6_dev->cnf.max_addresses;
> + u32 addr_flags = 0;
> +
> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
> + if (in6_dev->cnf.optimistic_dad &&
> + !ipv6_devconf.forwarding)
> + addr_flags = IFA_F_OPTIMISTIC;
> +#endif
>  
>   /* Do not allow to create too much of autoconfigured
>* addresses; this would be too easy way to crash 
> kernel.
> @@ -1742,7 +1762,8 @@ ok:
>   if (!max_addresses ||
>   ipv6_count_addresses(in6_dev) < max_addresses)
>   ifp = ipv6_add_addr(in6_dev, &addr, 
> pinfo->prefix_len,
> - 
> addr_type&IPV6_ADDR_SCOPE_MASK, 0);
> + 
> addr_type&IPV6_ADDR_SCOPE_MASK,
> + addr_flags);
>  
>   if (!ifp || IS_ERR(ifp)) {
>   in6_dev_put(in6_dev);
> @@ -1945,7 +1966,11 @@ static int inet6_addr_add(int ifindex, struct in6_addr 
> *pfx, int plen,
>   ifp->prefered_lft = prefered_lft;
>   ifp->tstamp = jiffies;
>   spin_unlock_bh(&ifp->lock);
> -
> + /*
> +  * Note that section 3.1 of RFC 4429 indicates
> +  * That the Optimistic flag should not be set for
> +  * manually configured addresses
> +  */
>   addrconf_dad_start(ifp, 0);
>   in6_ifa_put(ifp);
>   addrconf_verify(0);
> @@ -2122,8 +2147,16 @@ static void init_loopback(struct net_device *dev)
>  static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr 
> *addr)
>  {
>   struct inet6_ifaddr * ifp;
> + u32 addr_flags = IFA_F_PERMANENT;
> +
> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
> + if (idev->cnf.optimistic_dad &&
> + !ipv6_devconf.forwarding)
> + addr_flags |= IFA_F_OPTIMISTIC;
> +#endif
> +
>  
> - ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT);
> + ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags);
>   if (!IS_ERR(ifp)) {
>   addrconf_dad_start(ifp, 0);
>   in6_ifa_put(ifp);
> @@ -2190,7 +2223,7 @@ ipv6_inherit_linklocal(struct inet6_dev *idev, struct 
> net_device *link_dev)
>  {
>   struct in6_addr lladdr;
>  
> - if (!ipv6_get_lladdr(link_dev, &lladdr)) {
> + if (!ipv6_get_lladdr(link_dev, &lladdr, IFA_F_TENTATIVE)) {
>   addrconf_add_linklocal(idev, &lladdr);
>   return 0;
>   }
> @@ -2527,7 +2560,11 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
>   unsigned long rand_num;
>   struct inet6_dev *idev = ifp->idev;
>  
> - rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
> + if (ifp->flags & IFA_F_OPTIMISTIC)
> + rand_num = 0;
> + else
> + rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
> +
>   ifp->probes = idev->cnf.dad_transmits;
>   addrconf_mod_timer(ifp, AC_DAD, rand_num);
>  }
> @@ -2553,7 +2590,7 @@ static void addrconf_dad_start(struct inet6_ifaddr 
> *ifp, u32 flags)
>   if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) ||
>   !(ifp->flags&IFA_F_TENTATIVE) ||
>   ifp->flags & IFA_F_NODAD) {
> - ifp->flags &= ~IFA_F_TENTATIVE;
> + ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC);
>   spin_unlock_bh(&ifp->lock);
>   read_unlock_bh(&idev->lock);
>  
> @@ -2573,6 +2610,14 @@ static void addrconf_dad_start(struct inet6_ifaddr 
> *ifp, u32 flags)
>   addrconf_dad_stop(ifp);
>   return;
>   }
> +
> + /*
> +  * Optimistic nodes need to join the anycast address
> +  * right away
> +  */
> + if (ifp->flags & IFA_F_OPTIMISTIC)
> + addrconf_join_anycast(ifp);
> +
>   addrconf_dad_kick(ifp);
>   spin_unlock_bh(&ifp->lock);
>  out:
> @@ -2597,7 +2642,7 @@ static void addrconf_dad_timer(unsigned long data)
>* DAD was successful
>*/
>  
> - ifp->flags &= ~IFA_F_TENTATIVE;
> + ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC);
>   spin_unlock_bh(&ifp->lock);
>   read_unlock_bh(&idev->lock);
>  
> @@ -2627,6 +2672,9 @@ static void addrconf_dad_completed(struct inet6_ifaddr 
> *ifp)
>*  Configure the address for reception. Now it is valid.
>*/
>  
> + if (ifp->flags & IFA_F_OPTIMISTIC)
> + addrconf_leave_anycast(ifp);
> +
>   ipv6_ifa_notify(RTM_NEWADDR, ifp);
>  
>   /* If added prefix is link local and forwarding is off,
> @@ -3398,6 +3446,9 @@ st

Re: [PATCH] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-05 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Mon, 05 Feb 2007 17:32:58 -0800 (PST)), 
David Miller <[EMAIL PROTECTED]> says:

> From: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
> Date: Tue, 06 Feb 2007 10:24:05 +0900 (JST)
> 
> > > @@ -498,7 +500,8 @@ static void ndisc_send_na(struct net_device *dev, 
> > > struct neighbour *neigh,
> > >  msg->icmph.icmp6_unused = 0;
> > >  msg->icmph.icmp6_router= router;
> > >  msg->icmph.icmp6_solicited = solicited;
> > > -msg->icmph.icmp6_override  = override;
> > > + msg->icmph.icmp6_override  = override;
> > > +
> > >  
> > >  /* Set the target address. */
> > >   ipv6_addr_copy(&msg->target, solicited_addr);
> > 
> > Why do you "change" this?
> 
> He edited it, but then reverted his change but in the
> process added proper tab characters :-)  It is easy
> to miss things like this.

I know, you know. :-)

> This whole file has a lot of lines lacking proper tab
> characters.

Yes, I agree, but I think it is different issue, and
maybe, we should check and change other places as well,
in separate patch(es).

--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: [IPV6] RAW: Add checksum default defines for MH.

2007-02-06 Thread YOSHIFUJI Hideaki /
Dave,

AFAIK, we have not heard objectsions and I finally agree on this.
Please apply.

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

--yoshfuji

In article <[EMAIL PROTECTED]> (at Wed,  3 Jan 2007 18:57:48 +0900), Masahide 
NAKAMURA <[EMAIL PROTECTED]> says:

> Add checksum default defines for mobility header(MH) which
> goes through raw socket. As the result kernel's behavior is
> to handle MH checksum as default.
> 
> This patch also removes verifying inbound MH checksum at
> mip6_mh_filter() since it did not consider user specified
> checksum offset and was redundant check with raw socket code.
> 
> Signed-off-by: Masahide NAKAMURA <[EMAIL PROTECTED]>
> ---
>  net/ipv6/mip6.c |   26 --
>  net/ipv6/raw.c  |   13 +++--
>  2 files changed, 11 insertions(+), 28 deletions(-)
> 
> diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
> index be7dd7d..681bb07 100644
> --- a/net/ipv6/mip6.c
> +++ b/net/ipv6/mip6.c
> @@ -89,7 +89,6 @@ static int mip6_mh_len(int type)
>  int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
>  {
>   struct ip6_mh *mh;
> - int mhlen;
>  
>   if (!pskb_may_pull(skb, (skb->h.raw - skb->data) + 8) ||
>   !pskb_may_pull(skb, (skb->h.raw - skb->data) + ((skb->h.raw[1] + 1) 
> << 3)))
> @@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, stru
>   mip6_param_prob(skb, 0, (&mh->ip6mh_hdrlen) - skb->nh.raw);
>   return -1;
>   }
> - mhlen = (mh->ip6mh_hdrlen + 1) << 3;
> -
> - if (skb->ip_summed == CHECKSUM_COMPLETE) {
> - skb->ip_summed = CHECKSUM_UNNECESSARY;
> - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
> - &skb->nh.ipv6h->daddr,
> - mhlen, IPPROTO_MH,
> - skb->csum)) {
> - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH hw checksum 
> failed\n");
> - skb->ip_summed = CHECKSUM_NONE;
> - }
> - }
> - if (skb->ip_summed == CHECKSUM_NONE) {
> - if (csum_ipv6_magic(&skb->nh.ipv6h->saddr,
> - &skb->nh.ipv6h->daddr,
> - mhlen, IPPROTO_MH,
> - skb_checksum(skb, 0, mhlen, 0))) {
> - LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH checksum failed "
> -"[" NIP6_FMT " > " NIP6_FMT "]\n",
> -NIP6(skb->nh.ipv6h->saddr),
> -NIP6(skb->nh.ipv6h->daddr));
> - return -1;
> - }
> - skb->ip_summed = CHECKSUM_UNNECESSARY;
> - }
>  
>   if (mh->ip6mh_proto != IPPROTO_NONE) {
>   LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = 
> %d\n",
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index 4ae1b19..4b83e69 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk,
>  
>  static int rawv6_init_sk(struct sock *sk)
>  {
> - if (inet_sk(sk)->num == IPPROTO_ICMPV6) {
> - struct raw6_sock *rp = raw6_sk(sk);
> + struct raw6_sock *rp = raw6_sk(sk);
> +
> + switch (inet_sk(sk)->num) {
> + case IPPROTO_ICMPV6:
>   rp->checksum = 1;
>   rp->offset   = 2;
> + break;
> + case IPPROTO_MH:
> + rp->checksum = 1;
> + rp->offset   = 4;
> + break;
> + default:
> + break;
>   }
>   return(0);
>  }
> -- 
> 1.4.2
> 
> -
> 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


[IPROUTE2] tc build failure and netfilter headers.

2007-02-06 Thread YOSHIFUJI Hideaki /
Stephen,

I think we should include include/linux/netfilter/{x_tables.h,xt_tcpudp.h}
in iproute2 distribution to avoid compilation failure of tc.

Regards,

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-07 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 7 Feb 2007 15:55:03 -0500), Neil Horman 
<[EMAIL PROTECTED]> says:

> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 7b7bd44..8a1ea96 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -859,6 +859,34 @@ static int ip6_dst_lookup_tail(struct sock *sk,
>   err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src);
>   if (err)
>   goto out_err_release;
> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
> + /*
> +  * Here if the dst entry we've looked up 
> +  * has a neighbour entry that is in the INCOMPLETE
> +  * state and the src address from the flow is 
> +  * marked as OPTIMISTIC, we release the found 
> +  * dst entry and replace it instead with the 
> +  * dst entry of the nexthop router
> +  */
> + if (!((*dst)->neighbour->nud_state & NUD_VALID)) {
> + struct inet6_ifaddr *ifp;
> + struct flowi fl_gw;
> + ifp = ipv6_get_ifaddr(&fl->fl6_src, (*dst)->dev, 1);
> +
> + if (ifp && ifp->flags & IFA_F_OPTIMISTIC) {
> + /*
> +  * We need to get the dst entry for the 
> +  * default router instead
> +  */
> + dst_release(*dst);
> + memcpy(&fl_gw, fl, sizeof(struct flowi));
> + memset(&fl_gw.fl6_dst, 0, sizeof(struct 
> in6_addr));
> + *dst = ip6_route_output(sk, &fl_gw);
> + if ((err = (*dst)->error))
> + goto out_err_release;   
> 
> + }
> + }
> +#endif
>   }
>  
>   return 0;

Sorry, this is still not correct if the source address is already
specified.  I think they should be placed just betwee laste "}" and
"return 0;", no?


I still have a question.  Now, who will install the kernel route for
the incoming packet?  Can we get packet for our unicast address during
optimistic DAD period?

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-07 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Wed, 7 Feb 2007 15:55:03 -0500), Neil Horman 
<[EMAIL PROTECTED]> says:

> @@ -559,7 +562,7 @@ void ndisc_send_ns(struct net_device *dev, struct 
> neighbour *neigh,
>   return;
>  
>   len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
> - send_llinfo = dev->addr_len && !ipv6_addr_any(saddr);
> + send_llinfo = dev->addr_len && !ipv6_addr_any(saddr); 
>   if (send_llinfo)
>   len += ndisc_opt_addr_space(dev);
>  

trailing space

> @@ -637,7 +660,7 @@ void ndisc_send_rs(struct net_device *dev, struct 
> in6_addr *saddr,
>   return;
>  
>   len = sizeof(struct icmp6hdr);
> - if (dev->addr_len)
> + if (dev->addr_len && send_sllao)
>   len += ndisc_opt_addr_space(dev);
>  
>  skb = sock_alloc_send_skb(sk,

if (send_sllao)

> @@ -664,7 +687,7 @@ void ndisc_send_rs(struct net_device *dev, struct 
> in6_addr *saddr,
>  
>   opt = (u8*) (hdr + 1);
>  
> - if (dev->addr_len)
> + if (dev->addr_len && send_sllao)
>   ndisc_fill_addr_option(opt, ND_OPT_SOURCE_LL_ADDR, 
> dev->dev_addr,
>  dev->addr_len, dev->type);
>  

ditto.

--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][IPSEC][0/6] fix conflict of device tunnels with the ipsec tunnel

2007-02-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 8 Feb 2007 17:03:24 +0900), Kazunori 
MIYAZAWA <[EMAIL PROTECTED]> says:

> We need this to use ipcomp with inter address family tunnel.
> 
> [1/6] extending xfrm4_tunnel utility to support inter address family for "sit"
> [2/6] extending xfrm6_tunnel utility to support inter address family
> [3/6] fix to refer encap_family when comparing the kernel generated xfrm_state
> [4/6] changing "ipip tunnel" and xfrm4_tunnel to the API
> [5/6] changing "ip6_tunnel" and xfrm6_tunnel to the API
> [6/6] make "sit tunnel" use xfrm4_tunnel_register 

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

--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 0/5] [RFC] AF_RXRPC socket family implementation

2007-02-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 08 Feb 2007 16:32:11 +), David 
Howells <[EMAIL PROTECTED]> says:

>  (2) A local address can optionally be bound:
> 
>   struct sockaddr_rxrpc srx = {
>   .srx_family = AF_RXRPC,
>   .srx_service= 0,  /* we're a client */
>   .transport_type = SOCK_DGRAM,   /* type of transport socket */
>   .transport.sin_family   = AF_INET,
>   .transport.sin_port = htons(7000), /* AFS callback */
>   .transport.sin_address  = 0,  /* all local interfaces */
>   };

This sockaddr_rxrpc{} should NOT include sockaddr_in{} directly.
Please use sockaddr_storage{} (or sockaddr{}, maybe), and make it
sure to align on 64-bit word.

--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] IPv6: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-08 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Thu, 8 Feb 2007 11:41:52 -0500), Neil Horman 
<[EMAIL PROTECTED]> says:

> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index 7b7bd44..07a5f4d 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -859,6 +859,40 @@ static int ip6_dst_lookup_tail(struct sock *sk,
>   err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src);
>   if (err)
>   goto out_err_release;
> +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
> + /*
> +  * Here if the dst entry we've looked up 
> +  * has a neighbour entry that is in the INCOMPLETE
> +  * state and the src address from the flow is 
> +  * marked as OPTIMISTIC, we release the found 
> +  * dst entry and replace it instead with the 
> +  * dst entry of the nexthop router
> +  */
> + if (!((*dst)->neighbour->nud_state & NUD_VALID)) {
> + struct inet6_ifaddr *ifp;
> + struct flowi fl_gw;
> + int redirect;
> +
> + ifp = ipv6_get_ifaddr(&fl->fl6_src, (*dst)->dev, 1);
> +
> + redirect = (ifp && ifp->flags & IFA_F_OPTIMISTIC);
> + if (ifp)
> + in6_ifa_put(ifp);
> +
> + if (redirect) {
> + /*
> +  * We need to get the dst entry for the 
> +  * default router instead
> +  */
> + dst_release(*dst);
> + memcpy(&fl_gw, fl, sizeof(struct flowi));
> + memset(&fl_gw.fl6_dst, 0, sizeof(struct 
> in6_addr));
> + *dst = ip6_route_output(sk, &fl_gw);
> + if ((err = (*dst)->error))
> + goto out_err_release;   
> 
> + }
> + }
> +#endif

These should be placed

>   }

here. No?


> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 39bb658..9656018 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -622,9 +625,29 @@ void ndisc_send_rs(struct net_device *dev, struct 
> in6_addr *saddr,
>  struct sk_buff *skb;
>  struct icmp6hdr *hdr;
>   __u8 * opt;
> + struct inet6_ifaddr *ifp;
> + int send_sllao = 1;
>  int len;
>   int err;
>  
> + /*
> +  * Check the source address.  If its OPTIMISTIC
> +  * and addr_len is non-zero (implying the sllao option)
> +  * then don't send the RS (RFC 4429, section 2.2)
> +  */
> + ifp = ipv6_get_ifaddr(saddr, dev, 1);
> +
> + /*
> +  * According to section 2.2 of RFC 4429, we must not 
> +  * send router solicitations with a sllao from 
> +  * optimistic addresses, but we may send the solicitation
> +  * if we don't include the sllao.  So here we check
> +  * if our address is optimistic, and if so, we
> +  * supress the inclusion of the sllao.
> +  */ 
> + if (!dev->addr_len || !ifp || (ifp->flags & IFA_F_OPTIMISTIC))
> + send_sllao=0;
> +
>   ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr,
>   dev->ifindex);
>  

Still leaking ifp.  Something like this?

int send_sllao = dev->addr_len;

#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
if (send_sllao) {
  struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1);
  if (ifp) {
 if (ifp->flags & IFA_F_OPTIMISTIC)
   send_sllao = 0;
 in6_ifa_put(ifp);
  } else
 send_sllao = 0;
}
#endif

--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 0/5] [RFC] AF_RXRPC socket family implementation

2007-02-09 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 09 Feb 2007 10:31:34 +), David 
Howells <[EMAIL PROTECTED]> says:

> YOSHIFUJI Hideaki <[EMAIL PROTECTED]> wrote:
> 
> > This sockaddr_rxrpc{} should NOT include sockaddr_in{} directly.
> > Please use sockaddr_storage{} (or sockaddr{}, maybe), and make it
> > sure to align on 64-bit word.
> 
> That won't work.  That would then make the address larger than the maximum
> size (ie: sizeof(struct sockaddr_storage)).

sockaddr{}, then...

--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 0/5] [RFC] AF_RXRPC socket family implementation

2007-02-09 Thread YOSHIFUJI Hideaki /
In article <[EMAIL PROTECTED]> (at Fri, 09 Feb 2007 12:31:23 +), David 
Howells <[EMAIL PROTECTED]> says:

> YOSHIFUJI Hideaki <[EMAIL PROTECTED]> wrote:
> 
> > and make it sure to align on 64-bit word.
> 
> The first part of sockaddr_rxrpc is exactly 64 bits; then comes the transport
> address, so that's okay.
> 
> > This sockaddr_rxrpc{} should NOT include sockaddr_in{} directly.
> > Please use sockaddr_storage{} (or sockaddr{}, maybe),
> 
> Why can't I include sockaddr_in and sockaddr_in6 in sockaddr_rxrpc, btw?

Because it is protocol (such as ipv4 or ipv6) dependent.
You cannot use different sturcture for one address family.
You could use union, maybe.

> > > That won't work.  That would then make the address larger than the maximum
> > > size (ie: sizeof(struct sockaddr_storage)).
> > 
> > sockaddr{}, then...
> 
> But that's not big enough to hold a sockaddr_in6...

struct sockaddr_rxrpc {
 ...
 union {
   struct sockaddr rxrpc_sa;
   struct sockaddr_in rxrpc_sin;
   struct sockaddr_in6 rxrpc_sin6;
 } __attribute__((__aligned(8)__));
};

Another option would be to introduce new transport protocol such as
dccp or sctp, no?

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


[NET]: Fix whitespace errors

2007-02-09 Thread YOSHIFUJI Hideaki /
Hello.

Please pull "2.6.20-net-2.6-20070209-whitespace" branch
at 
to fix trivial whitespace errors:
 - convert leading sequences of whitespace with tab(s).
 - remove whitespace at the end of line.
under net.

Tree is on top of current net-2.6 tree.

Here is the diffstat.

---
 net/802/fc.c   |   24 -
 net/802/fddi.c |   26 +
 net/802/hippi.c|   20 -
 net/802/psnap.c|2 
 net/802/tr.c   |  136 +++--
 net/8021q/vlan.c   |   52 +-
 net/8021q/vlan.h   |   12 
 net/8021q/vlan_dev.c   |   42 +-
 net/8021q/vlanproc.c   |   36 +
 net/appletalk/aarp.c   |   14 -
 net/appletalk/atalk_proc.c |2 
 net/appletalk/ddp.c|  218 
 net/appletalk/dev.c|8 
 net/atm/atm_sysfs.c|   14 -
 net/atm/br2684.c   |4 
 net/atm/common.c   |   34 +
 net/atm/common.h   |2 
 net/atm/ioctl.c|2 
 net/atm/lec.c  |   20 -
 net/atm/lec.h  |4 
 net/atm/mpc.c  |  130 +++--
 net/atm/mpc.h  |   44 +-
 net/atm/mpoa_caches.c  |4 
 net/atm/mpoa_caches.h  |   98 ++--
 net/atm/mpoa_proc.c|   88 ++-
 net/atm/proc.c |   58 +-
 net/atm/pvc.c  |4 
 net/atm/raw.c  |6 
 net/atm/resources.c|   16 -
 net/atm/signaling.h|4 
 net/atm/svc.c  |   48 +-
 net/ax25/af_ax25.c |  114 ++--
 net/ax25/ax25_addr.c   |6 
 net/ax25/ax25_ip.c |   94 ++--
 net/ax25/ax25_route.c  |8 
 net/ax25/ax25_std_timer.c  |2 
 net/ax25/ax25_subr.c   |4 
 net/ax25/ax25_uid.c|2 
 net/bluetooth/af_bluetooth.c   |   16 -
 net/bluetooth/bnep/bnep.h  |   18 -
 net/bluetooth/bnep/core.c  |   52 +-
 net/bluetooth/bnep/netdev.c|   34 +
 net/bluetooth/bnep/sock.c  |   26 +
 net/bluetooth/cmtp/capi.c  |   14 -
 net/bluetooth/cmtp/cmtp.h  |   12 
 net/bluetooth/cmtp/core.c  |   14 -
 net/bluetooth/cmtp/sock.c  |   14 -
 net/bluetooth/hci_conn.c   |   20 -
 net/bluetooth/hci_core.c   |   36 +
 net/bluetooth/hci_event.c  |   26 +
 net/bluetooth/hci_sock.c   |   28 +
 net/bluetooth/hidp/core.c  |   14 -
 net/bluetooth/hidp/hidp.h  |   12 
 net/bluetooth/hidp/sock.c  |   14 -
 net/bluetooth/l2cap.c  |   26 +
 net/bluetooth/lib.c|   12 
 net/bluetooth/rfcomm/core.c|   56 +-
 net/bluetooth/rfcomm/sock.c|   20 -
 net/bluetooth/rfcomm/tty.c |   46 +-
 net/bluetooth/sco.c|   30 +
 net/bridge/br_device.c |8 
 net/bridge/br_fdb.c|   34 +
 net/bridge/br_forward.c|4 
 net/bridge/br_if.c |   26 +
 net/bridge/br_input.c  |4 
 net/bridge/br_ioctl.c  |   18 -
 net/bridge/br_netfilter.c  |   14 -
 net/bridge/br_notify.c |   10 
 net/bridge/br_private.h|4 
 net/bridge/br_stp.c|   24 -
 net/bridge/br_stp_bpdu.c   |2 
 net/bridge/br_stp_if.c |4 
 net/bridge/br_stp_timer.c  |   20 -
 net/bridge/br_sysfs_br.c   |8 
 net/bridge/netfilter/ebt_802_3.c   |6 
 net/bridge/netfilter/ebt_among.c   |6 
 net/bridge/netfilter/ebt_arpreply.c|2 
 net/bridge/netfilte

<    1   2   3   4   5   >