Re: [PATCH 11/12] [IPSEC]: Reinject packet instead of calling netfilter directly on input

2007-10-16 Thread YOSHIFUJI Hideaki /
Herbert,

I think with this change, we parse extension headers, twice.
We really do not want to do this.

--yoshfuji

In article [EMAIL PROTECTED] (at Tue, 16 Oct 2007 22:33:19 +0800), Herbert Xu 
[EMAIL PROTECTED] says:

 [IPSEC]: Reinject packet instead of calling netfilter directly on input
 
 Currently we call netfilter directly on input after a series of transport
 mode transforms (and BEET but that's a separate bug).  This is inconsistent
 because other parts of the stack such AF_PACKET cannot see the decapsulated
 packet.  In fact this is a common complaint about the Linux IPsec stack.
 
 Another problem is that there is a potential for stack overflow if we
 encounter a DNAT rule which turns a foreign packet into a local one that
 contains another transport mode SA.
 
 This patch introduces a major behavioural change by reinjecting the
 packet instead of calling netfilter directly.
 
 This solves both of the aformentioned problems.
 
 It is still inconsistent with how we do things on output since we don't
 pass things through AF_PACKET there either but the same inconsistency
 exists for tunnel mode too so it's not a new problem.
 
 To make things easier I've added a new function called netif_rerx which
 resets netfilter and the dst before reinjecting the packet using netif_rx.
 This can be used by other tunnel code as well.
 
 I haven't added a reinject function for RO mode since it can never be
 called on that path and if it does we want to know about it through an
 OOPS.
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]
 ---
 
  include/linux/netdevice.h   |1 +
  include/net/xfrm.h  |8 
  net/core/dev.c  |   12 
  net/ipv4/xfrm4_input.c  |   24 ++--
  net/ipv4/xfrm4_mode_beet.c  |7 +++
  net/ipv4/xfrm4_mode_transport.c |   11 +++
  net/ipv4/xfrm4_mode_tunnel.c|7 +++
  net/ipv6/xfrm6_input.c  |   23 ++-
  net/ipv6/xfrm6_mode_beet.c  |7 +++
  net/ipv6/xfrm6_mode_transport.c |   10 ++
  net/ipv6/xfrm6_mode_tunnel.c|7 +++
  11 files changed, 74 insertions(+), 43 deletions(-)
 
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
 index 39dd83b..097f911 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
 @@ -1039,6 +1039,7 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
  #define HAVE_NETIF_RX 1
  extern int   netif_rx(struct sk_buff *skb);
  extern int   netif_rx_ni(struct sk_buff *skb);
 +extern int   netif_rerx(struct sk_buff *skb);
  #define HAVE_NETIF_RECEIVE_SKB 1
  extern int   netif_receive_skb(struct sk_buff *skb);
  extern int   dev_valid_name(const char *name);
 diff --git a/include/net/xfrm.h b/include/net/xfrm.h
 index a9e8247..e5ae5fa 100644
 --- a/include/net/xfrm.h
 +++ b/include/net/xfrm.h
 @@ -311,6 +311,14 @@ struct xfrm_mode {
*/
   int (*output)(struct xfrm_state *x,struct sk_buff *skb);
  
 + /*
 +  * Reinject packet into stack.
 +  *
 +  * On entry, the packet is in the state as on exit from the
 +  * input function above.
 +  */
 + int (*reinject)(struct xfrm_state *x,struct sk_buff *skb);
 +
   struct xfrm_state_afinfo *afinfo;
   struct module *owner;
   unsigned int encap;
 diff --git a/net/core/dev.c b/net/core/dev.c
 index 38b03da..b753ec8 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 @@ -1808,6 +1808,18 @@ int netif_rx_ni(struct sk_buff *skb)
  
  EXPORT_SYMBOL(netif_rx_ni);
  
 +/* Reinject a packet that has previously been processed, e.g., by tunneling. 
 */
 +int netif_rerx(struct sk_buff *skb)
 +{
 + nf_reset(skb);
 +
 + dst_release(skb-dst);
 + skb-dst = NULL;
 +
 + return netif_rx(skb);
 +}
 +EXPORT_SYMBOL(netif_rerx);
 +
  static inline struct net_device *skb_bond(struct sk_buff *skb)
  {
   struct net_device *dev = skb-dev;
 diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
 index 5cb0b59..f5576d5 100644
 --- a/net/ipv4/xfrm4_input.c
 +++ b/net/ipv4/xfrm4_input.c
 @@ -41,7 +41,6 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, 
 __be32 spi,
   struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
   struct xfrm_state *x;
   int xfrm_nr = 0;
 - int decaps = 0;
   unsigned int nhoff = offsetof(struct iphdr, protocol);
  
   seq = 0;
 @@ -95,7 +94,6 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, 
 __be32 spi,
   goto drop;
  
   if (x-props.mode == XFRM_MODE_TUNNEL) {
 - decaps = 1;
   break;
   }
  
 @@ -122,26 +120,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, 
 __be32 spi,
  xfrm_nr * sizeof(xfrm_vec[0]));
   skb-sp-len += xfrm_nr;
  
 - nf_reset(skb);
 -
 - if (decaps) {
 - dst_release(skb-dst);
 - skb-dst = NULL;
 - netif_rx(skb);
 

Re: [PATCH 3/3] [IPV6]: Replace sk_buff ** with sk_buff * in input handlers

2007-10-14 Thread YOSHIFUJI Hideaki /
Herbert,

I really appreciate this work.
Thank you!

--yoshfuji

In article [EMAIL PROTECTED] (at Sun, 14 Oct 2007 22:49:05 +0800), Herbert Xu 
[EMAIL PROTECTED] says:

 [IPV6]: Replace sk_buff ** with sk_buff * in input handlers
 
 With all the users of the double pointers removed from the IPv6 input path,
 this patch converts all occurances of sk_buff ** to sk_buff * in IPv6 input
 handlers.
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]
 ---
 
  include/net/ipv6.h |2 +-
  include/net/protocol.h |2 +-
  include/net/xfrm.h |2 +-
  net/dccp/ipv6.c|3 +--
  net/ipv6/exthdrs.c |   41 ++---
  net/ipv6/icmp.c|5 ++---
  net/ipv6/ip6_input.c   |4 ++--
  net/ipv6/reassembly.c  |3 +--
  net/ipv6/tcp_ipv6.c|3 +--
  net/ipv6/tunnel6.c |6 ++
  net/ipv6/udp.c |7 +++
  net/ipv6/udp_impl.h|2 +-
  net/ipv6/udplite.c |4 ++--
  net/ipv6/xfrm6_input.c |4 ++--
  net/sctp/ipv6.c|4 ++--
  15 files changed, 36 insertions(+), 56 deletions(-)
 
 diff --git a/include/net/ipv6.h b/include/net/ipv6.h
 index 31b3f1b..abd8584 100644
 --- a/include/net/ipv6.h
 +++ b/include/net/ipv6.h
 @@ -240,7 +240,7 @@ extern intip6_ra_control(struct 
 sock *sk, int sel,
  void (*destructor)(struct sock 
 *));
  
  
 -extern int   ipv6_parse_hopopts(struct sk_buff **skbp);
 +extern int   ipv6_parse_hopopts(struct sk_buff *skb);
  
  extern struct ipv6_txoptions *  ipv6_dup_options(struct sock *sk, struct 
 ipv6_txoptions *opt);
  extern struct ipv6_txoptions *   ipv6_renew_options(struct sock *sk, 
 struct ipv6_txoptions *opt,
 diff --git a/include/net/protocol.h b/include/net/protocol.h
 index 105bf12..1166ffb 100644
 --- a/include/net/protocol.h
 +++ b/include/net/protocol.h
 @@ -45,7 +45,7 @@ struct net_protocol {
  #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
  struct inet6_protocol 
  {
 - int (*handler)(struct sk_buff **skb);
 + int (*handler)(struct sk_buff *skb);
  
   void(*err_handler)(struct sk_buff *skb,
  struct inet6_skb_parm *opt,
 diff --git a/include/net/xfrm.h b/include/net/xfrm.h
 index 77be396..0e84484 100644
 --- a/include/net/xfrm.h
 +++ b/include/net/xfrm.h
 @@ -1051,7 +1051,7 @@ extern int xfrm4_output(struct sk_buff *skb);
  extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short 
 family);
  extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned 
 short family);
  extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
 -extern int xfrm6_rcv(struct sk_buff **pskb);
 +extern int xfrm6_rcv(struct sk_buff *skb);
  extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
   xfrm_address_t *saddr, u8 proto);
  extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned 
 short family);
 diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
 index 006a383..cac5354 100644
 --- a/net/dccp/ipv6.c
 +++ b/net/dccp/ipv6.c
 @@ -767,10 +767,9 @@ discard:
   return 0;
  }
  
 -static int dccp_v6_rcv(struct sk_buff **pskb)
 +static int dccp_v6_rcv(struct sk_buff *skb)
  {
   const struct dccp_hdr *dh;
 - struct sk_buff *skb = *pskb;
   struct sock *sk;
   int min_cov;
  
 diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
 index 0ff2bf1..1e89efd 100644
 --- a/net/ipv6/exthdrs.c
 +++ b/net/ipv6/exthdrs.c
 @@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(ipv6_find_tlv);
  
  struct tlvtype_proc {
   int type;
 - int (*func)(struct sk_buff **skbp, int offset);
 + int (*func)(struct sk_buff *skb, int offset);
  };
  
  /*
 @@ -111,10 +111,8 @@ struct tlvtype_proc {
  
  /* An unknown option is detected, decide what to do */
  
 -static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
 +static int ip6_tlvopt_unknown(struct sk_buff *skb, int optoff)
  {
 - struct sk_buff *skb = *skbp;
 -
   switch ((skb_network_header(skb)[optoff]  0xC0)  6) {
   case 0: /* ignore */
   return 1;
 @@ -139,9 +137,8 @@ static int ip6_tlvopt_unknown(struct sk_buff **skbp, int 
 optoff)
  
  /* Parse tlv encoded option header (hop-by-hop or destination) */
  
 -static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff **skbp)
 +static int ip6_parse_tlv(struct tlvtype_proc *procs, struct sk_buff *skb)
  {
 - struct sk_buff *skb = *skbp;
   struct tlvtype_proc *curr;
   const unsigned char *nh = skb_network_header(skb);
   int off = skb_network_header_len(skb);
 @@ -172,13 +169,13 @@ static int ip6_parse_tlv(struct tlvtype_proc *procs, 
 struct sk_buff **skbp)
   /* type specific length/alignment
  checks will be performed in the
  

[PATCH] IPROUTE2: Support IPv4/IPv6 Tunnel

2007-10-12 Thread YOSHIFUJI Hideaki /
Based on patch from Yasuyuki KOZAKAI [EMAIL PROTECTED].

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

--- 
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index 6468d99..cbbdf9d 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -52,6 +52,7 @@ static void usage(void) __attribute__((noreturn));
 static void usage(void)
 {
fprintf(stderr, Usage: ip -f inet6 tunnel { add | change | del | show 
} [ NAME ]\n);
+   fprintf(stderr,   [ mode { ip6ip6 | ipip6 | any } ]\n);
fprintf(stderr,   [ remote ADDR local ADDR ] [ dev PHYS_DEV 
]\n);
fprintf(stderr,   [ encaplimit ELIM ]\n);
fprintf(stderr ,  [ hoplimit HLIM ] [ tc TC ] [ fl FL ]\n);
@@ -116,7 +117,24 @@ static int parse_args(int argc, char **argv, struct 
ip6_tnl_parm *p)
memset(medium, 0, sizeof(medium));
 
while (argc  0) {
-   if (strcmp(*argv, remote) == 0) {
+   if (strcmp(*argv, mode) == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, ipv6/ipv6) == 0 ||
+   strcmp(*argv, ip6ip6) == 0)
+   p-proto = IPPROTO_IPV6;
+   else if (strcmp(*argv, ip/ipv6) == 0 ||
+strcmp(*argv, ipv4/ipv6) == 0 ||
+strcmp(*argv, ipip6) == 0 ||
+strcmp(*argv, ip4ip6) == 0)
+   p-proto = IPPROTO_IPIP;
+   else if (strcmp(*argv, any/ipv6) == 0 ||
+strcmp(*argv, any) == 0)
+   p-proto = 0;
+   else {
+fprintf(stderr,Cannot guess tunnel mode.\n);
+exit(-1);
+}
+} else if (strcmp(*argv, remote) == 0) {
inet_prefix raddr;
NEXT_ARG();
get_prefix(raddr, *argv, preferred_family);
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 5fede2c..104340d 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -51,6 +51,9 @@ const char *tnl_strproto(__u8 proto)
case IPPROTO_IPV6:
strcpy(buf, ipv6);
break;
+   case 0:
+   strcpy(buf, any);
+   break;
default:
strcpy(buf, unknown);
break;

-- 
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: IPUtils and uClibc

2007-10-12 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 30 Jul 2007 00:50:39 +0200), Rafał 
Bilski [EMAIL PROTECTED] says:

 Today I was trying to update my router based on Gentoo and uClibc. 
 Unfortunatly build fails because of b* functions. Linker can't 
 find them later. At first gcc is complaining that b* functions 
 are impilicity declared. Acording to man pages these functions 
 are deprecated anyway.
 Patch is for Gentoo's iputils-20070202.
:

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: [IPv6] Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493

2007-10-10 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Wed, 10 Oct 2007 16:42:56 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 From: David Stevens [EMAIL PROTECTED]
 Date: Wed, 10 Oct 2007 14:48:38 -0700
 
  But anyway, I made the comment; I think some form of it
  should go in. :-) If you like the original better, that's
  ok with me, too.
 
 Brian, please submit a new patch or resubmit the original
 one, the choice is your's :-)

I agree, 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: [PATCH] [IPV6] Defer IPv6 device initialization until a valid qdisc is specified

2007-10-09 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Wed, 10 Oct 2007 09:32:35 +0800), Herbert Xu 
[EMAIL PROTECTED] says:

 Mitsuru Chinen [EMAIL PROTECTED] wrote:
  To judge the timing for DAD, netif_carrier_ok() is used. However,
  there is a possibility that dev-qdisc stays noop_qdisc even if
  netif_carrier_ok() returns true. In that case, DAD NS is not sent out.
  We need to defer the IPv6 device initialization until a valid qdisc
  is specified.
 
 Is this really necessary?
 
 What if this is plugged into a switch that has nothing else
 connected? Should you also wait for something to be connected
 to the switch?

While MLD, DAD (and RS) packets must be observed on the wire
outside the box, we've been observing random failures with
our test system due to this bug.
The bug results in failures of detecting duplicate address (our side and
the other side afterwards), and of having valid global address(es).

Even in practical system, a box sometimes fail to have valid global
address for 10 minutes or so, which is not good.  if MLD snooping is
supported and enabled on the switch, we may fail to insist our address
is already in-use against DAD from other node.

We'd really like to do our best to avoid such random failures
even if it may/can not be perfect.

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: [RFC][IPv6] Export userland ND options through netlink (RDNSS support)

2007-10-01 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Sat, 29 Sep 2007 19:47:20 +0200), Pierre 
Ynard [EMAIL PROTECTED] says:

 As discussed before, this patch provides userland with a way to access
 relevant options in Router Advertisements, after they are processed and
 validated by the kernel. Extra options are processed in a generic way;
 this patch only exports RDNSS options described in RFC5006, but support
 to control which options are exported could be easily added.

I basically like this approach at first sight.

 which implies that a userland daemon processing RDNSS options needs a
 way to associate the option to the router that sent it, and fetch its
 lifetime. This kind of information could be included in a header in the
 rtnetlink message (in this version of the patch there is none).

 diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
 index dff3192..f69d415 100644
 --- a/include/linux/rtnetlink.h
 +++ b/include/linux/rtnetlink.h
 @@ -97,6 +97,9 @@ enum {
   RTM_SETNEIGHTBL,
  #define RTM_SETNEIGHTBL  RTM_SETNEIGHTBL
  
 + RTM_NEWNDUSEROPT = 68,
 +#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
 +
   __RTM_MAX,

Does this imply that we could extend (or reuse) this for all of
NS/NA/RS/RA/Redirect messages?  I think you need to include the
code, type and basic semantics of the message.

If this is only for RA, we should say RTM_NEWRAUSEROPT or something.

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: Removing DAD in IPv6

2007-10-01 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 01 Oct 2007 11:53:27 +0800), Xia Yang 
[EMAIL PROTECTED] says:

 I would like to ask for help on how to remove or disable the DAD process
 properly, as long as the node can send, receive and forward packets
 immediately after a new IPv6 address is generated. Any pointer is
 appreciated. Thanks a lot in advance!

IFA_F_NODAD address flag might help 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: [IPV6] Fix ICMPv6 redirect handling with target multicast address

2007-10-01 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Sat, 29 Sep 2007 10:04:48 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED] says:

 In article [EMAIL PROTECTED] (at Fri, 28 Sep 2007 17:50:38 -0700), David 
 Stevens [EMAIL PROTECTED] says:
 
  Brian,
  A multicast address should never be the target of a neighbor
  discovery request; the sender should use the mapping function for all
  multicasts. So, I'm not sure that your example can ever happen, and it
  certainly is ok to send ICMPv6 errors to multicast addresses in general.
  But I don't see that it hurts anything. either (since it should never 
  happen :-)),
  so I don't particularly object, either.
  I think it'd also be better if you add the check to be:
  
  if (ipv6_addr_type(target)  
  (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST))
  
  or something along those lines, rather than reproducing ipv6_addr_type() 
  code
  separately in a new ipv6_addr_linklocal() function.

I'm fine with the idea of the fix itself.

Please use ipv6_addr_type() so far and convert other users as well
to ipv6_addr_linklocal() in another patch.

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] Fix ICMPv6 redirect handling with target multicast address

2007-09-28 Thread YOSHIFUJI Hideaki /
Dave, Brian,

Let me double check this patch.

Regards,

--yoshfuji

In article [EMAIL PROTECTED] (at Fri, 28 Sep 2007 17:50:38 -0700), David 
Stevens [EMAIL PROTECTED] says:

 Brian,
 A multicast address should never be the target of a neighbor
 discovery request; the sender should use the mapping function for all
 multicasts. So, I'm not sure that your example can ever happen, and it
 certainly is ok to send ICMPv6 errors to multicast addresses in general.
 But I don't see that it hurts anything. either (since it should never 
 happen :-)),
 so I don't particularly object, either.
 I think it'd also be better if you add the check to be:
 
 if (ipv6_addr_type(target)  
 (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST))
 
 or something along those lines, rather than reproducing ipv6_addr_type() 
 code
 separately in a new ipv6_addr_linklocal() function.
 
 +-DLS
 
 
-
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: [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


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


[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 err0?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


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


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: [IPv6] Add v4mapped address inline

2007-08-24 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Thu, 23 Aug 2007 14:14:35 -0400), Brian 
Haley [EMAIL PROTECTED] says:

 YOSHIFUJI Hideaki /  wrote:
  Please put this just after ipv6_addr_any(), not after
  ipv6_addr_diff().
 
 Ok, updated patch attached.
 
 -Brian
 
 
 Add v4mapped address inline to avoid calls to ipv6_addr_type().
 
 Signed-off-by: Brian Haley [EMAIL PROTECTED]
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: [IPv6] Add v4mapped address inline

2007-08-23 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Thu, 23 Aug 2007 12:40:54 -0400), Brian 
Haley [EMAIL PROTECTED] says:

 diff --git a/include/net/ipv6.h b/include/net/ipv6.h
 index 9059e0e..c2b6c11 100644
 --- a/include/net/ipv6.h
 +++ b/include/net/ipv6.h
 @@ -418,6 +418,12 @@ static inline int ipv6_addr_diff(const struct in6_addr 
 *a1, const struct in6_add
   return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
  }
  
 +static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
 +{
 + return ((a-s6_addr32[0] | a-s6_addr32[1]) == 0  
 +  a-s6_addr32[2] == htonl(0x)); 
 +}
 +

Please put this just after ipv6_addr_any(), not after
ipv6_addr_diff().

--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 kernel panic while send SCTP data with IP fragments

2007-08-19 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 20 Aug 2007 09:28:27 +0800), Wei 
Yongjun [EMAIL PROTECTED] says:

 If ICMP6 message with Packet Too Big is received after send SCTP DATA,
 kernel panic will occur when SCTP DATA is send again.
 
 This is because of a bad dest address when call to skb_copy_bits().
:
 Signed-off-by: Wei Yongjun [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 04/10] sysctl: Fix neighbour table sysctls.

2007-08-09 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Thu, 09 Aug 2007 18:56:09 -0600), [EMAIL 
PROTECTED] (Eric W. Biederman) says:

 
 - In ipv6 ndisc_ifinfo_syctl_change so it doesn't depend on binary
   sysctl names for a function that works with proc.
 
 - In neighbour.c reorder the table to put the possibly unused entries
   at the end so we can remove them by terminating the table early.
 
 - In neighbour.c kill the entries with questionable binary sysctl
   handling behavior.
 
 - In neighbour.c if we don't have a strategy routine remove the
   binary path.  So we don't the default sysctl strategy routine
   on data that is not ready for it.
 

I disagree.  It is bad to remove existing interface.
Ditto for other patches.

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 04/10] sysctl: Fix neighbour table sysctls.

2007-08-09 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Thu, 09 Aug 2007 18:49:21 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 From: YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED]
 Date: Fri, 10 Aug 2007 10:47:10 +0900 (JST)
 
  I disagree.  It is bad to remove existing interface.
  Ditto for other patches.
 
 I think perhaps you misunderstand what Eric is doing.
 
 sys_sysctl() isn't working properly for these cases and it is both a
 deprecated interface and not worth the pain of adding support
 in these cases.

Would you explain why it does not work properly
for those cases?

--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 04/10] sysctl: Fix neighbour table sysctls.

2007-08-09 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Thu, 09 Aug 2007 18:56:09 -0600), [EMAIL 
PROTECTED] (Eric W. Biederman) says:

 
 - In ipv6 ndisc_ifinfo_syctl_change so it doesn't depend on binary
   sysctl names for a function that works with proc.
:

Well, retrans_time_ms and base_reachable_time_ms supercedes
retrans_time and base_reachable_time, we've warned for long
time for its deprecation.  So, maybe, it is time to remove
the old interfaces (retrans_time and base_reachable_time)
and simplify ndisc_ifinfo_syctl_change().

--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 04/10] sysctl: Fix neighbour table sysctls.

2007-08-09 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Thu, 09 Aug 2007 20:23:16 -0600), [EMAIL 
PROTECTED] (Eric W. Biederman) says:

 YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED] writes:
 
  Would you explain why it does not work properly
  for those cases?
 
 Mostly no appropriate strategy routine was setup to 
 report the data to the caller of sys_sysctl.

I assume that default strategy have been existing for it, no?!
Maybe, I do miss something...

--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: ipv6_addr_type() doesn't know about RFC4193 addresses

2007-07-26 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Wed, 25 Jul 2007 17:12:03 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 Contrarily, there may be ipv6_addr_type() call sites that really
 do want to reject rfc4193 addresses.

I do not think we have such users.

--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: ipv6_addr_type() doesn't know about RFC4193 addresses

2007-07-26 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Wed, 25 Jul 2007 19:49:09 -0400), Dave 
Johnson [EMAIL PROTECTED] says:

 ipv6_addr_type() doesn't check for 'Unique Local IPv6 Unicast
 Addresses' (RFC4193) and returns IPV6_ADDR_RESERVED for that range.

Acked-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

I would say, it would be better to add IPV6_ADDR_UNICAST as well
for reserved addresses unless we have good reason not to do it,
anyway.

-- 
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][RFC] network splice receive v3

2007-07-19 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Wed, 11 Jul 2007 11:19:27 +0200), Jens Axboe 
[EMAIL PROTECTED] says:

 @@ -835,6 +835,7 @@ const struct proto_ops inet_stream_ops = {
   .recvmsg   = sock_common_recvmsg,
   .mmap  = sock_no_mmap,
   .sendpage  = tcp_sendpage,
 + .splice_read   = tcp_splice_read,
  #ifdef CONFIG_COMPAT
   .compat_setsockopt = compat_sock_common_setsockopt,
   .compat_getsockopt = compat_sock_common_getsockopt,

Please add similar bits in net/ipv6/af_inet6.c
unless there are any dependency on IPv4.
(And if there are, it is not good.)

--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 PULL] [NET]: Whitespace fixes

2007-07-18 Thread YOSHIFUJI Hideaki /
Dave,

Please consider pulling the following commits from
net-2.6-20070719-whitespace-20070719
branch at
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git.

Thanks.

HEADLINES
-

[NET] AX25: Fix whitespace errors.
[NET] BLUETOOTH: Fix whitespace errors.
[NET] CORE: Fix whitespace errors.
[NET] DCCP: Fix whitespace errors.
[NET] IPV4: Fix whitespace errors.
[NET] NETFILTER: Fix whitespace errors.
[NET] NETROM: Fix whitespace errors.
[NET] PACKET: Fix whitespace errors.
[NET] RFKILL: Fix whitespace errors.
[NET] ROSE: Fix whitespace errors.
[NET] RXRPC: Fix whitespace errors.
[NET] SCTP: Fix whitespace errors.
[NET] SUNRPC: Fix whitespace errors.
[NET] TIPC: Fix whitespace errors.
[NET] XFRM: Fix whitespace errors.

DIFFSTAT


 net/ax25/af_ax25.c  |2 +-
 net/bluetooth/hci_core.c|2 +-
 net/core/dev.c  |2 +-
 net/core/rtnetlink.c|2 +-
 net/core/sock.c |2 +-
 net/dccp/ccids/lib/loss_interval.c  |2 +-
 net/ipv4/fib_frontend.c |2 +-
 net/ipv4/ip_forward.c   |2 +-
 net/ipv4/tcp_output.c   |2 +-
 net/netfilter/nf_conntrack_standalone.c |2 +-
 net/netfilter/nf_log.c  |2 +-
 net/netrom/af_netrom.c  |2 +-
 net/packet/af_packet.c  |2 +-
 net/rfkill/rfkill-input.c   |2 +-
 net/rose/af_rose.c  |2 +-
 net/rxrpc/af_rxrpc.c|   10 +-
 net/sctp/sm_statefuns.c |2 +-
 net/sctp/socket.c   |4 ++--
 net/sunrpc/auth_gss/gss_krb5_crypto.c   |2 +-
 net/tipc/socket.c   |   12 ++--
 net/xfrm/xfrm_policy.c  |2 +-
 net/xfrm/xfrm_state.c   |2 +-
 22 files changed, 32 insertions(+), 32 deletions(-)

CHANGESETS
--

commit bd3b071b91a8acfe93b01567f556c879db049f99
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date:   Thu Jul 19 10:43:13 2007 +0900

[NET] AX25: Fix whitespace errors.

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

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c83cf84..dae2a42 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1262,7 +1262,7 @@ static int __must_check ax25_connect(struct socket *sock,
 
for (;;) {
prepare_to_wait(sk-sk_sleep, wait,
-   TASK_INTERRUPTIBLE);
+   TASK_INTERRUPTIBLE);
if (sk-sk_state != TCP_SYN_SENT)
break;
if (!signal_pending(current)) {

---
commit 00ae02f31519e8d6e374424bbdf0c7381489e416
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date:   Thu Jul 19 10:43:16 2007 +0900

[NET] BLUETOOTH: Fix whitespace errors.

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

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f6d867e..63caa41 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -982,7 +982,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void 
*data, int count)
 
skb-dev = (void *) hdev;
bt_cb(skb)-pkt_type = type;
-   
+
__reassembly(hdev, type) = skb;
 
scb = (void *) skb-cb;

---
commit 40b77c943468236c6dfad3e7b94348fe70c70331
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date:   Thu Jul 19 10:43:23 2007 +0900

[NET] CORE: Fix whitespace errors.

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

diff --git a/net/core/dev.c b/net/core/dev.c
index 6357f54..38212c3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2629,7 +2629,7 @@ void __dev_set_rx_mode(struct net_device *dev)
return;
 
if (!netif_device_present(dev))
-   return;
+   return;
 
if (dev-set_rx_mode)
dev-set_rx_mode(dev);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 864cbdf..06eccca 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -98,7 +98,7 @@ int rtattr_parse(struct rtattr *tb[], int maxattr, struct 
rtattr *rta, int len)
 }
 
 int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
-struct rtattr *rta, int len)
+struct rtattr *rta, int len)
 {
if (RTA_PAYLOAD(rta)  len)
return -1;
diff --git a/net/core/sock.c b/net/core/sock.c
index 091032a..1d55fbd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -217,7 +217,7 @@ static int sock_set_timeout(long *timeo_p, char __user 
*optval, int optlen)
warned++;
printk(KERN_INFO sock_set_timeout: 

Re: [PATCH]: Can not set the IPV6_PKTINFO option

2007-07-16 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 13:41:23 +0100), Gerrit 
Renker [EMAIL PROTECTED] says:

 [IPv6]: Can not set the IPV6_PKTINFO option
 
 The Linux manpage of ipv6(7) mentions the IPV6_PKTINFO option (and it is 
 defined in header
 files), but there is no setsockopt support for it. Aliasing to 
 IPV6_RECVPKTINFO fixes this,
 and checking datagram_recv_ctl() in net/ipv6/datagram.c confirms that this 
 works as 
 expected from the API.
 
 Signed-off-by: Gerrit Renker [EMAIL PROTECTED]

NAK.  It is obsolete.

--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]: Can not set the IPV6_PKTINFO option

2007-07-16 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 21:56:05 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED] says:

 In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 13:41:23 +0100), Gerrit 
 Renker [EMAIL PROTECTED] says:
 
  [IPv6]: Can not set the IPV6_PKTINFO option
  
  The Linux manpage of ipv6(7) mentions the IPV6_PKTINFO option (and it is 
  defined in header
  files), but there is no setsockopt support for it. Aliasing to 
  IPV6_RECVPKTINFO fixes this,
  and checking datagram_recv_ctl() in net/ipv6/datagram.c confirms that this 
  works as 
  expected from the API.
  
  Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
 
 NAK.  It is obsolete.

I meant, the manpage is outdated.

Current IPV6_PKTINFO is not equal to IPV6_RECVPKTINFO
but a sticky option to set source address / interface
for outgoing packet.

--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]: Can not set the IPV6_PKTINFO option

2007-07-16 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 22:02:29 +0800), Herbert Xu 
[EMAIL PROTECTED] says:

 Gerrit Renker [EMAIL PROTECTED] wrote:
  
  Manpage date says 1999-06-29 but in fact manpages are from up-to-date 
  lenny/sid.
 
 I think Yoshifuji-san's point is not that your manpages package
 is out-of-date, but that the manpage itself is out-of-date.
 That is, someone needs to send a patch to the upstream manpages
 maintainer and fix the documentation to actually describe what the
 code does.

Exactly.  The ipv6(7) manpage is one of the TODOs.
Contributions, expecially from native speakers, are really welcome.

--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]: Can not set the IPV6_PKTINFO option

2007-07-16 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 15:14:06 +0100), Gerrit 
Renker [EMAIL PROTECTED] says:

 |  That is, someone needs to send a patch to the upstream manpages
 |  maintainer and fix the documentation to actually describe what the
 |  code does.
 |  
 If it is simply replacing IPV6_PKTINFO with IPV6_RECVPKTINFO then I'd be 
 happy to do this.
 Anything more complicated than that - it would be good to have some of the 
 developers taking
 a look. 
 
 Here is the text of the manpage (ipv6 in section 7):
 
 IPV6_PKTINFO
   Set delivery of the IPV6_PKTINFO control message on incoming datagrams.  
   Only allowed for SOCK_DGRAM  or  SOCK_RAW sockets.  Argument is a pointer 
 to a 
   boolean value in an integer.

Description is outdated (RFC2292).
Current Linux basically follows RFC3542.

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


[**RFC**] [IPV6]: Support RFC3542 IPV6_PKTINFO socket option.

2007-07-16 Thread YOSHIFUJI Hideaki /
Hello.

This patch is just a tentative implementation of RFC3542 IPV6_PKTINFO
sticky option, and is NOT intended to be applied so far.

We need to check if this is okay in RFC POV, anyway.

---
[RFC] [IPV6]: Support RFC3542 IPV6_PKTINFO socket option.

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

---
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 46b9dce..1ff4059 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -542,6 +542,10 @@ extern void
ipv6_packet_cleanup(void);
 extern int ip6_datagram_connect(struct sock *sk, 
 struct sockaddr *addr, int 
addr_len);
 
+extern int ip6_datagram_set_pktinfo(struct in6_pktinfo 
*src_info,
+struct in6_addr *saddr,
+struct flowi *fl);
+
 extern int ipv6_recv_error(struct sock *sk, struct msghdr 
*msg, int len);
 extern voidipv6_icmp_error(struct sock *sk, struct sk_buff 
*skb, int err, __be16 port,
u32 info, u8 *payload);
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 409da3a..752a2c0 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -36,7 +36,8 @@ extern intdatagram_recv_ctl(struct sock 
*sk,
  struct msghdr *msg,
  struct sk_buff *skb);
 
-extern int datagram_send_ctl(struct msghdr *msg,
+extern int datagram_send_ctl(struct sock *sk,
+ struct msghdr *msg,
  struct flowi *fl,
  struct ipv6_txoptions *opt,
  int *hlimit, int *tclass);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index fe0f490..cc6e480 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -496,7 +496,55 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, 
struct sk_buff *skb)
return 0;
 }
 
-int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
+int ip6_datagram_set_pktinfo(struct in6_pktinfo *src_info,
+struct in6_addr *saddr,
+struct flowi *fl)
+{
+   struct net_device *dev = NULL;
+   int addr_type;
+
+   if (src_info-ipi6_ifindex) {
+   if (fl-oif  src_info-ipi6_ifindex != fl-oif)
+   return -EINVAL;
+   fl-oif = src_info-ipi6_ifindex;
+   }
+
+   addr_type = ipv6_addr_type(src_info-ipi6_addr);
+
+   if (addr_type == IPV6_ADDR_ANY)
+   return 0;
+
+   if (saddr) {
+   if (!ipv6_addr_any(saddr))
+   return -EINVAL;
+   if (!ipv6_addr_equal(src_info-ipi6_addr, saddr))
+   return -EINVAL;
+   }
+
+   if (addr_type  IPV6_ADDR_LINKLOCAL) {
+   if (!src_info-ipi6_ifindex)
+   return -EINVAL;
+   else {
+   dev = dev_get_by_index(src_info-ipi6_ifindex);
+   if (!dev)
+   return -ENODEV;
+   }
+   }
+   if (!ipv6_chk_addr(src_info-ipi6_addr, dev, 0)) {
+   if (dev)
+   dev_put(dev);
+   return -EINVAL;
+   }
+   if (dev)
+   dev_put(dev);
+
+   ipv6_addr_copy(fl-fl6_src, src_info-ipi6_addr);
+
+   return 0;
+}
+
+int datagram_send_ctl(struct sock *sk,
+ struct msghdr *msg, struct flowi *fl,
  struct ipv6_txoptions *opt,
  int *hlimit, int *tclass)
 {
@@ -508,8 +556,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
int err = 0;
 
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
-   int addr_type;
-   struct net_device *dev = NULL;
 
if (!CMSG_OK(msg, cmsg)) {
err = -EINVAL;
@@ -526,39 +572,13 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi 
*fl,
err = -EINVAL;
goto exit_f;
}
-
src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
 
-   if (src_info-ipi6_ifindex) {
-   if (fl-oif  src_info-ipi6_ifindex != 
fl-oif)
-   return -EINVAL;
-   fl-oif = src_info-ipi6_ifindex;
-   }
-
-   addr_type = ipv6_addr_type(src_info-ipi6_addr);
-
-   if (addr_type == IPV6_ADDR_ANY)
- 

Re: [**RFC**] [IPV6]: Support RFC3542 IPV6_PKTINFO socket option.

2007-07-16 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 16 Jul 2007 11:31:28 -0400), Vlad 
Yasevich [EMAIL PROTECTED] says:

 YOSHIFUJI Hideaki / 吉藤英明 wrote:
  Hello.
  
  This patch is just a tentative implementation of RFC3542 IPV6_PKTINFO
  sticky option, and is NOT intended to be applied so far.
  
  We need to check if this is okay in RFC POV, anyway.
 
 ok.  comments from just the RFC pov.

Thank you.  Here's take 2.

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 78a0d06..cdc4846 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -546,6 +546,10 @@ extern void
ipv6_packet_cleanup(void);
 extern int ip6_datagram_connect(struct sock *sk, 
 struct sockaddr *addr, int 
addr_len);
 
+extern int ip6_datagram_set_pktinfo(struct sock *sk,
+struct in6_pktinfo 
*src_info,
+struct flowi *fl);
+
 extern int ipv6_recv_error(struct sock *sk, struct msghdr 
*msg, int len);
 extern voidipv6_icmp_error(struct sock *sk, struct sk_buff 
*skb, int err, __be16 port,
u32 info, u8 *payload);
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 409da3a..752a2c0 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -36,7 +36,8 @@ extern intdatagram_recv_ctl(struct sock 
*sk,
  struct msghdr *msg,
  struct sk_buff *skb);
 
-extern int datagram_send_ctl(struct msghdr *msg,
+extern int datagram_send_ctl(struct sock *sk,
+ struct msghdr *msg,
  struct flowi *fl,
  struct ipv6_txoptions *opt,
  int *hlimit, int *tclass);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index b1fe7ac..119363a 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -496,7 +496,58 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, 
struct sk_buff *skb)
return 0;
 }
 
-int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
+int ip6_datagram_set_pktinfo(struct sock *sk,
+struct in6_pktinfo *src_info,
+struct flowi *fl)
+{
+   struct net_device *dev = NULL;
+   int addr_type;
+   int err = 0;
+   struct in6_addr *saddr = sk ? inet6_sk(sk)-saddr : NULL;
+
+   if (src_info-ipi6_ifindex) {
+   dev = dev_get_by_index(src_info-ipi6_ifindex);
+   if (!dev)
+   return -ENODEV;
+   }
+
+   fl-oif = src_info-ipi6_ifindex;
+
+   addr_type = ipv6_addr_type(src_info-ipi6_addr);
+   if (addr_type == IPV6_ADDR_ANY)
+   goto out;
+
+   err = -EINVAL;
+
+   if (sk  inet_sk(sk)-is_icsk)
+   goto out;
+
+   if (saddr) {
+   if (!ipv6_addr_any(saddr))
+   goto out;
+   if (!ipv6_addr_equal(src_info-ipi6_addr, saddr))
+   goto out;
+   }
+
+   if (addr_type  IPV6_ADDR_LINKLOCAL) {
+   if (!src_info-ipi6_ifindex)
+   goto out;
+   }
+   if (!ipv6_chk_addr(src_info-ipi6_addr, dev, 0)) {
+   err = -EADDRNOTAVAIL;
+   goto out;
+   }
+   err = 0;
+   ipv6_addr_copy(fl-fl6_src, src_info-ipi6_addr);
+out:
+   if (dev)
+   dev_put(dev);
+
+   return err;
+}
+
+int datagram_send_ctl(struct sock *sk,
+ struct msghdr *msg, struct flowi *fl,
  struct ipv6_txoptions *opt,
  int *hlimit, int *tclass)
 {
@@ -508,8 +559,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
int err = 0;
 
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
-   int addr_type;
-   struct net_device *dev = NULL;
 
if (!CMSG_OK(msg, cmsg)) {
err = -EINVAL;
@@ -526,39 +575,11 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi 
*fl,
err = -EINVAL;
goto exit_f;
}
-
src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
 
-   if (src_info-ipi6_ifindex) {
-   if (fl-oif  src_info-ipi6_ifindex != 
fl-oif)
-   return -EINVAL;
-   fl-oif = src_info-ipi6_ifindex;
-   }
-
-   addr_type = ipv6_addr_type(src_info-ipi6_addr

Re: [PATCH try#5] Blackfin ethernet driver: on chip ethernet MAC controller driver

2007-07-16 Thread YOSHIFUJI Hideaki /
Hello.

In article [EMAIL PROTECTED] (at Tue, 17 Jul 2007 00:49:02 +0800), Bryan Wu 
[EMAIL PROTECTED] says:

 +static void bf537mac_set_multicast_list(struct net_device *dev)
 +{
 + u32 sysctl;
 +
 + if (dev-flags  IFF_PROMISC) {
 + printk(KERN_INFO %s: set to promisc mode\n, dev-name);
 + sysctl = bfin_read_EMAC_OPMODE();
 + sysctl |= RAF;
 + bfin_write_EMAC_OPMODE(sysctl);
 + } else if (dev-flags  IFF_ALLMULTI || dev-mc_count  16) {
 + /* accept all multicast */
 + sysctl = bfin_read_EMAC_OPMODE();
 + sysctl |= PAM;
 + bfin_write_EMAC_OPMODE(sysctl);
 + } else if (dev-mc_count) {
 + /* set multicast */
 + } else {
 + /* clear promisc or multicast mode */
 + sysctl = bfin_read_EMAC_OPMODE();
 + sysctl = ~(RAF | PAM);
 + bfin_write_EMAC_OPMODE(sysctl);
 + }
 +}
 +

Is this function really correct?

Please make sure to set up multicast list on device, or
set all multi on device if you do not know what to do; e.g.

static void bf537mac_set_multicast_list(struct net_device *dev)
{
 u32 sysctl;

 if (dev-flags  IFF_PROMISC) {
 printk(KERN_INFO %s: set to promisc mode\n, dev-name);
 sysctl = bfin_read_EMAC_OPMODE();
 sysctl |= RAF;
 bfin_write_EMAC_OPMODE(sysctl);
 } else if (dev-flags  IFF_ALLMULTI || dev-mc_count) {
 /* accept all multicast */
 sysctl = bfin_read_EMAC_OPMODE();
 sysctl |= PAM;
 bfin_write_EMAC_OPMODE(sysctl);
 } else {
 /* clear promisc or multicast mode */
 sysctl = bfin_read_EMAC_OPMODE();
 sysctl = ~(RAF | PAM);
 bfin_write_EMAC_OPMODE(sysctl);
 }
}
--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] ARM/ETHER3: Handle multicast frames.

2007-07-16 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index da71350..a7cac69 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -464,7 +464,7 @@ static void ether3_setmulticastlist(struct net_device *dev)
if (dev-flags  IFF_PROMISC) {
/* promiscuous mode */
priv(dev)-regs.config1 |= CFG1_RECVPROMISC;
-   } else if (dev-flags  IFF_ALLMULTI) {
+   } else if (dev-flags  IFF_ALLMULTI || dev-mc_count) {
priv(dev)-regs.config1 |= CFG1_RECVSPECBRMULTI;
} else
priv(dev)-regs.config1 |= CFG1_RECVSPECBROAD;

-- 
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] NI5010: Handle multicast frames.

2007-07-16 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index 3d5b423..22a3b3d 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -670,14 +670,10 @@ static void ni5010_set_multicast_list(struct net_device 
*dev)
 
PRINTK2((KERN_DEBUG %s: entering set_multicast_list\n, dev-name));
 
-   if (dev-flagsIFF_PROMISC || dev-flagsIFF_ALLMULTI) {
+   if (dev-flagsIFF_PROMISC || dev-flagsIFF_ALLMULTI || dev-mc_list) {
dev-flags |= IFF_PROMISC;
outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */
PRINTK((KERN_DEBUG %s: Entering promiscuous mode\n, 
dev-name));
-   } else if (dev-mc_list) {
-   /* Sorry, multicast not supported */
-   PRINTK((KERN_DEBUG %s: No multicast, entering broadcast 
mode\n, dev-name));
-   outb(RMD_BROADCAST, EDLC_RMODE);
} else {
PRINTK((KERN_DEBUG %s: Entering broadcast mode\n, dev-name));
outb(RMD_BROADCAST, EDLC_RMODE);  /* Disable promiscuous mode, 
use normal mode */

-- 
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] NS83820: Handle multicast frames.

2007-07-16 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 104aab3..ea80e6c 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1582,7 +1582,7 @@ static void ns83820_set_multicast(struct net_device *ndev)
else
and_mask = ~(RFCR_AAU | RFCR_AAM);
 
-   if (ndev-flags  IFF_ALLMULTI)
+   if (ndev-flags  IFF_ALLMULTI || ndev-mc_count)
or_mask |= RFCR_AAM;
else
and_mask = ~RFCR_AAM;

-- 
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] SAA9730: Handle multicast frames.

2007-07-16 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c
index 451486b..7dae4d4 100644
--- a/drivers/net/saa9730.c
+++ b/drivers/net/saa9730.c
@@ -940,15 +940,14 @@ static void lan_saa9730_set_multicast(struct net_device 
*dev)
   CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
   lp-lan_saa9730_regs-CamCtl);
} else {
-   if (dev-flags  IFF_ALLMULTI) {
+   if (dev-flags  IFF_ALLMULTI || dev-mc_count) {
/* accept all multicast packets */
-   writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
-  CAM_CONTROL_BROAD_ACC,
-  lp-lan_saa9730_regs-CamCtl);
-   } else {
/*
 * Will handle the multicast stuff later. -carstenl
 */
+   writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
+  CAM_CONTROL_BROAD_ACC,
+  lp-lan_saa9730_regs-CamCtl);
}
}
 

-- 
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: optionaly validate RAs on raw sockets

2007-07-11 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Tue, 10 Jul 2007 21:11:17 +0300), Remi 
Denis-Courmont [EMAIL PROTECTED] says:

 ICMPv6 Router Advertisements may now contain informations that is
 mostly of interest to userland. This currently mostly consists of
 recursive DNS server addresses (though one should expect other
 stuff to come).

I really do not want to have such non-standard API in kernel.

--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] Updates for RH0 deprecation.

2007-07-09 Thread YOSHIFUJI Hideaki /
Hello.

This is take 2 of updates for deprecating RH0 for
linux-2.6.22 (or net-2.6.23).
Note: sorry, previous patches introduced a linkage error.

Though it is not a good idea to disable RH2, we retain
the knob for it so far for backward compatibility.

Changesets are available at
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git/
on the branch named
linux-2.6.22_deprecate-rh0-20070710

Regards,

HEADLINES
-

[IPV6]: Restore semantics of Routing Header processing.
[IPV6]: Do not send RH0 anymore.
[IPV6]: Make IPV6_{RECV,2292}RTHDR boolean options.

DIFFSTAT


 Documentation/networking/ip-sysctl.txt |3 -
 include/linux/ipv6.h   |8 +-
 include/net/ipv6.h |4 -
 net/dccp/ipv6.c|   20 -
 net/ipv6/datagram.c|3 -
 net/ipv6/exthdrs.c |  121 
 net/ipv6/ipv6_sockglue.c   |   11 +--
 net/ipv6/tcp_ipv6.c|   20 -
 8 files changed, 23 insertions(+), 167 deletions(-)

CHANGESETS
--

commit 9217342590aa4b4c97bef8b7797c036b4bd8c9d3
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date:   Fri May 11 12:06:01 2007 +0900

[IPV6]: Restore semantics of Routing Header processing.

The fix for emerging security threat was overkill and it broke
basic semantic of IPv6 routing header processing.  We should assume
RT0 (or even RT2, depends on configuration) as unknown RH type so
that we
- silently ignore the routing header if segleft == 0
- send ICMPv6 Parameter Problem message back to the sender,
  otherwise.

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

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 14be0b9..05e9bb5 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -371,22 +371,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
struct rt0_hdr *rthdr;
int accept_source_route = ipv6_devconf.accept_source_route;
 
-   if (accept_source_route  0 ||
-   ((idev = in6_dev_get(skb-dev)) == NULL)) {
-   kfree_skb(skb);
-   return -1;
-   }
-   if (idev-cnf.accept_source_route  0) {
+   idev = in6_dev_get(skb-dev);
+   if (idev) {
+   if (accept_source_route  idev-cnf.accept_source_route)
+   accept_source_route = idev-cnf.accept_source_route;
in6_dev_put(idev);
-   kfree_skb(skb);
-   return -1;
}
 
-   if (accept_source_route  idev-cnf.accept_source_route)
-   accept_source_route = idev-cnf.accept_source_route;
-
-   in6_dev_put(idev);
-
if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
!pskb_may_pull(skb, (skb_transport_offset(skb) +
 ((skb_transport_header(skb)[1] + 1)  3 {
@@ -398,24 +389,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb);
 
-   switch (hdr-type) {
-#ifdef CONFIG_IPV6_MIP6
-   case IPV6_SRCRT_TYPE_2:
-   break;
-#endif
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route  0)
-   break;
-   kfree_skb(skb);
-   return -1;
-   default:
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
-IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
- (hdr-type) - skb_network_header(skb));
-   return -1;
-   }
-
if (ipv6_addr_is_multicast(ipv6_hdr(skb)-daddr) ||
skb-pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -454,6 +427,8 @@ looped_back:
 
switch (hdr-type) {
case IPV6_SRCRT_TYPE_0:
+   if (accept_source_route = 0)
+   goto unknown_rh;
if (hdr-hdrlen  0x01) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
 IPSTATS_MIB_INHDRERRORS);
@@ -465,6 +440,8 @@ looped_back:
break;
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
+   if (accept_source_route  0)
+   goto unknown_rh;
/* Silently discard invalid RTH type 2 */
if (hdr-hdrlen != 2 || hdr-segments_left != 1) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -474,6 +451,8 @@ looped_back:
}
break;
 #endif
+   default:
+   goto unknown_rh;
}
 
/*
@@ -577,6 +556,12 @@ looped_back:
skb_push(skb, skb-data - skb_network_header(skb));
dst_input(skb);
return -1;
+
+unknown_rh:
+   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), IPSTATS_MIB_INHDRERRORS);
+   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
+   

Re: [GIT PATCH] Updates for RH0 deprecation.

2007-07-09 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 09 Jul 2007 14:28:30 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 From: YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED]
 Date: Tue, 10 Jul 2007 02:29:01 +0900 (JST)
 
  Changesets are available at
  git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git/
  on the branch named
  linux-2.6.22_deprecate-rh0-20070710
 
 [EMAIL PROTECTED]:~/src/GIT/ipv6-2.6$ git pull 
 git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git 
 linux-2.6.22_deprecate-rh0-20070710
 error: no such remote ref refs/heads/linux-2.6.22_deprecate-rh0-20070710
 fatal: Fetch failure: 
 git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git

... Sorry, the repository was not synchronized appropriately...
(rsync has been stuck for several days; I do not know the reason...)

Would you please try it again?

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


Re: [PATCH] Fix handling of IPv6 RH with 0 segments left

2007-07-07 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Sat, 7 Jul 2007 17:34:59 +0300), Rémi 
Denis-Courmont [EMAIL PROTECTED] says:

 Fix handling of IPv6 Routing Headers with zero segments left.
 In that case, we should ignore the extension header and continue with
 the next one, rather than return a Paramater Problem.

Remi, patch is already available.

--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.6.22-rc5] TCP: Make TCP_RTO_MAX a variable

2007-06-27 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 25 Jun 2007 22:09:39 +0900 (JST)), 
OBATA Noboru [EMAIL PROTECTED] says:

 Please note that this is effective in IPv6 as well.

Of course, I'm happy with 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] Age Entry For IPv4 Route Table

2007-06-24 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Mon, 25 Jun 2007 10:28:38 +0530), Varun 
Chandramohan [EMAIL PROTECTED] says:

 According to the RFC 4292 (IP Forwarding Table MIB) there is a need for an 
 age entry for all the routes in the routing table. The entry in the RFC is 
 inetCidrRouteAge and oid is inetCidrRouteAge.1.10.
 Many snmp application require this age entry. So iam adding the age field in 
 the routing table and providing
 the interface for this value via /proc/net/route.

I'm not in favor of adding new field(s) to /proc/net/route.

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


[IPV6] NDISC: Fix thinko to control Router Preference support.

2007-06-22 Thread YOSHIFUJI Hideaki /
Bug reported by Haruhito Watanabe [EMAIL PROTECTED].

This is also appropriate for -stable releases.

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

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d8b3645..0358e60 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1062,7 +1062,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
pref = ra_msg-icmph.icmp6_router_pref;
/* 10b is handled as if it were 00b (medium) */
if (pref == ICMPV6_ROUTER_PREF_INVALID ||
-   in6_dev-cnf.accept_ra_rtr_pref)
+   !in6_dev-cnf.accept_ra_rtr_pref)
pref = ICMPV6_ROUTER_PREF_MEDIUM;
 #endif
 
-- 
1.5.1

-- 
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] [IPV6 0/3] Deprecate IPv6 Routing Header Type 0.

2007-06-18 Thread YOSHIFUJI Hideaki /
Hello.

I think the IETF community is reaching consensus on deprecation of
RH0 (Routing Header Type 0).  RH0 is now handled as unknown RH type,
e.g, accept it if segleft == 0, or send ICMPv6 Parameter Problem to
the sender.

[PATCH 1/3] [IPV6]: Restore semantics of Routing Header processing.
[PATCH 2/3] [IPV6]: Do not send RH0 anymore.
[PATCH 3/3] [IPV6]: Make IPV6_{RECV,2292}RTHDR boolean options.

-- 
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 1/3] [IPV6]: Restore semantics of Routing Header processing.

2007-06-18 Thread YOSHIFUJI Hideaki /
The fix for emerging security threat was overkill and it broke
basic semantic of IPv6 routing header processing.  We should assume
RT0 (or even RT2, depends on configuration) as unknown RH type so
that we
- silently ignore the routing header if segleft == 0
- send ICMPv6 Parameter Problem message back to the sender,
  otherwise.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 net/ipv6/exthdrs.c |   47 ---
 1 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 14be0b9..05e9bb5 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -371,22 +371,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
struct rt0_hdr *rthdr;
int accept_source_route = ipv6_devconf.accept_source_route;
 
-   if (accept_source_route  0 ||
-   ((idev = in6_dev_get(skb-dev)) == NULL)) {
-   kfree_skb(skb);
-   return -1;
-   }
-   if (idev-cnf.accept_source_route  0) {
+   idev = in6_dev_get(skb-dev);
+   if (idev) {
+   if (accept_source_route  idev-cnf.accept_source_route)
+   accept_source_route = idev-cnf.accept_source_route;
in6_dev_put(idev);
-   kfree_skb(skb);
-   return -1;
}
 
-   if (accept_source_route  idev-cnf.accept_source_route)
-   accept_source_route = idev-cnf.accept_source_route;
-
-   in6_dev_put(idev);
-
if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
!pskb_may_pull(skb, (skb_transport_offset(skb) +
 ((skb_transport_header(skb)[1] + 1)  3 {
@@ -398,24 +389,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb);
 
-   switch (hdr-type) {
-#ifdef CONFIG_IPV6_MIP6
-   case IPV6_SRCRT_TYPE_2:
-   break;
-#endif
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route  0)
-   break;
-   kfree_skb(skb);
-   return -1;
-   default:
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
-IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
- (hdr-type) - skb_network_header(skb));
-   return -1;
-   }
-
if (ipv6_addr_is_multicast(ipv6_hdr(skb)-daddr) ||
skb-pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -454,6 +427,8 @@ looped_back:
 
switch (hdr-type) {
case IPV6_SRCRT_TYPE_0:
+   if (accept_source_route = 0)
+   goto unknown_rh;
if (hdr-hdrlen  0x01) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
 IPSTATS_MIB_INHDRERRORS);
@@ -465,6 +440,8 @@ looped_back:
break;
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
+   if (accept_source_route  0)
+   goto unknown_rh;
/* Silently discard invalid RTH type 2 */
if (hdr-hdrlen != 2 || hdr-segments_left != 1) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -474,6 +451,8 @@ looped_back:
}
break;
 #endif
+   default:
+   goto unknown_rh;
}
 
/*
@@ -577,6 +556,12 @@ looped_back:
skb_push(skb, skb-data - skb_network_header(skb));
dst_input(skb);
return -1;
+
+unknown_rh:
+   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), IPSTATS_MIB_INHDRERRORS);
+   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
+ (hdr-type) - skb_network_header(skb));
+   return -1;
 }
 
 static struct inet6_protocol rthdr_protocol = {
-- 
1.5.1

-- 
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/3] [IPV6]: Do not send RH0 anymore.

2007-06-18 Thread YOSHIFUJI Hideaki /
Based on draft-ietf-ipv6-deprecate-rh0-00.txt.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 Documentation/networking/ip-sysctl.txt |3 +-
 include/linux/ipv6.h   |4 +-
 net/ipv6/datagram.c|3 +-
 net/ipv6/exthdrs.c |   57 
 net/ipv6/ipv6_sockglue.c   |3 +-
 net/ipv6/tcp_ipv6.c|   20 ---
 6 files changed, 5 insertions(+), 85 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt 
b/Documentation/networking/ip-sysctl.txt
index af6a63a..09c184e 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -874,8 +874,7 @@ accept_redirects - BOOLEAN
 accept_source_route - INTEGER
Accept source routing (routing extension header).
 
-0: Accept routing header.
-   = 0: Accept only routing header type 2.
+   = 0: Accept only routing header type 2.
 0: Do not accept routing header.
 
Default: 0
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 648bd1f..2cfbe9a 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -27,8 +27,8 @@ struct in6_ifreq {
int ifr6_ifindex; 
 };
 
-#define IPV6_SRCRT_STRICT  0x01/* this hop must be a neighbor  */
-#define IPV6_SRCRT_TYPE_0  0   /* IPv6 type 0 Routing Header   */
+#define IPV6_SRCRT_STRICT  0x01/* Deprecated; will be removed */
+#define IPV6_SRCRT_TYPE_0  0   /* Deprecated; will be removed */
 #define IPV6_SRCRT_TYPE_2  2   /* IPv6 type 2 Routing Header   */
 
 /*
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index b1fe7ac..debf402 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -657,11 +657,10 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi 
*fl,
rthdr = (struct ipv6_rt_hdr *)CMSG_DATA(cmsg);
 
switch (rthdr-type) {
-   case IPV6_SRCRT_TYPE_0:
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
-#endif
break;
+#endif
default:
err = -EINVAL;
goto exit_f;
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 05e9bb5..c03273c 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -426,18 +426,6 @@ looped_back:
}
 
switch (hdr-type) {
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route = 0)
-   goto unknown_rh;
-   if (hdr-hdrlen  0x01) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
-IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
- ((hdr-hdrlen) -
-  skb_network_header(skb)));
-   return -1;
-   }
-   break;
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
if (accept_source_route  0)
@@ -596,51 +584,6 @@ void __init ipv6_rthdr_init(void)
   --ANK (980729)
  */
 
-struct ipv6_txoptions *
-ipv6_invert_rthdr(struct sock *sk, struct ipv6_rt_hdr *hdr)
-{
-   /* Received rthdr:
-
-  [ H1 - H2 - ... H_prev ]  daddr=ME
-
-  Inverted result:
-  [ H_prev - ... - H1 ] daddr =sender
-
-  Note, that IP output engine will rewrite this rthdr
-  by rotating it left by one addr.
-*/
-
-   int n, i;
-   struct rt0_hdr *rthdr = (struct rt0_hdr*)hdr;
-   struct rt0_hdr *irthdr;
-   struct ipv6_txoptions *opt;
-   int hdrlen = ipv6_optlen(hdr);
-
-   if (hdr-segments_left ||
-   hdr-type != IPV6_SRCRT_TYPE_0 ||
-   hdr-hdrlen  0x01)
-   return NULL;
-
-   n = hdr-hdrlen  1;
-   opt = sock_kmalloc(sk, sizeof(*opt) + hdrlen, GFP_ATOMIC);
-   if (opt == NULL)
-   return NULL;
-   memset(opt, 0, sizeof(*opt));
-   opt-tot_len = sizeof(*opt) + hdrlen;
-   opt-srcrt = (void*)(opt+1);
-   opt-opt_nflen = hdrlen;
-
-   memcpy(opt-srcrt, hdr, sizeof(*hdr));
-   irthdr = (struct rt0_hdr*)opt-srcrt;
-   irthdr-reserved = 0;
-   opt-srcrt-segments_left = n;
-   for (i=0; in; i++)
-   memcpy(irthdr-addr+i, rthdr-addr+(n-1-i), 16);
-   return opt;
-}
-
-EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
-
 /**
   Hop-by-hop options.
  **/
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index aa3d07c..f66ce0c 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -416,11 +416,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, 
int optname,
if (optname == IPV6_RTHDR  opt  opt-srcrt) {
   

[PATCH 3/3] [IPV6]: Make IPV6_{RECV,2292}RTHDR boolean options.

2007-06-18 Thread YOSHIFUJI Hideaki /
Because reversing RH0 is no longer supported by deprecation
of RH0, let's make IPV6_{RECV,2292}RTHDR boolean options.
Boolean are more appropriate from standard POV.

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

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 2cfbe9a..0b1febb 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -299,8 +299,8 @@ struct ipv6_pinfo {
/* pktoption flags */
union {
struct {
-   __u16   srcrt:2,
-   osrcrt:2,
+   __u16   srcrt:1,
+   osrcrt:1,
rxinfo:1,
rxoinfo:1,
rxhlim:1,
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index f66ce0c..b5c0754 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -336,16 +336,12 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, 
int optname,
break;
 
case IPV6_RECVRTHDR:
-   if (val  0 || val  2)
-   goto e_inval;
-   np-rxopt.bits.srcrt = val;
+   np-rxopt.bits.srcrt = valbool;
retv = 0;
break;
 
case IPV6_2292RTHDR:
-   if (val  0 || val  2)
-   goto e_inval;
-   np-rxopt.bits.osrcrt = val;
+   np-rxopt.bits.osrcrt = valbool;
retv = 0;
break;
 
-- 
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: [PATCH] [IPV6 0/3] Deprecate IPv6 Routing Header Type 0.

2007-06-18 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Sun, 17 Jun 2007 23:17:49 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

  [PATCH 1/3] [IPV6]: Restore semantics of Routing Header processing.
  [PATCH 2/3] [IPV6]: Do not send RH0 anymore.
  [PATCH 3/3] [IPV6]: Make IPV6_{RECV,2292}RTHDR boolean options.
 
 I think it is sufficient to schedule this for 2.6.23 and not
 to rush it into 2.6.22
 
 Do you agree?

I agree for 3/3 (and 2/3, maybe).

On the other hand, I would rather like to push 1/3 to 2.6.21-stable
and 2.6.22(-stable) to restore the basic semantics, if possible.
Or I need to put the patch(es) on-line for users.

--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] [XFRM]: Add module alias for transformation type.

2007-05-24 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Fri, 25 May 2007 15:32:20 +1000), Herbert Xu 
[EMAIL PROTECTED] says:

 On Fri, May 25, 2007 at 01:23:23PM +0900, [EMAIL PROTECTED] wrote:
  
  diff --git a/include/net/xfrm.h b/include/net/xfrm.h
  index 1e53520..c9f895f 100644
  --- a/include/net/xfrm.h
  +++ b/include/net/xfrm.h
  @@ -19,9 +19,19 @@
   #include net/ipv6.h
   #include net/ip6_fib.h
   
  +#define XFRM_PROTO_ESP 50
  +#define XFRM_PROTO_AH  51
  +#define XFRM_PROTO_COMP108
  +#define XFRM_PROTO_IPIP4
  +#define XFRM_PROTO_IPV641
  +#define XFRM_PROTO_ROUTING IPPROTO_ROUTING
  +#define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS
 
 Could we use the existing IPPROTO_* values for all of these?

No, because they are of enums.

--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: TCP_MD5 and Intel e1000

2007-05-22 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Tue, 22 May 2007 10:57:38 +0200), Eric 
Dumazet [EMAIL PROTECTED] says:

  I have tried to set up quagga with tcp-md5 support from kernel. All seems ok
  with a intel e100 NIC, but as i testetd with a intel e1000 NIC the tcp
  packets have an invalid md5 digest.
  If i run tcpdump on the mashine the packets are generated, it shows on the
  outgoing interface invalid md5 digests.
  Are there known issues about tcp-md5 and e1000 NICs?
:
 You could try ethtool -K tx off, and/or other ethtool -K settings

Disabling offloading should help; currently tcp-md5 stack
blindly copy md5-signature from the first segment
which is not appropriate for rest of segments.

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


[IPV6] ADDRCONF: Fix conflicts in DEVCONF_xxx constant.

2007-05-20 Thread YOSHIFUJI Hideaki /
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 09ea01a..648bd1f 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -209,9 +209,8 @@ enum {
DEVCONF_RTR_PROBE_INTERVAL,
DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
DEVCONF_PROXY_NDP,
-   __DEVCONF_OPTIMISTIC_DAD,
-   DEVCONF_ACCEPT_SOURCE_ROUTE,
DEVCONF_OPTIMISTIC_DAD,
+   DEVCONF_ACCEPT_SOURCE_ROUTE,
DEVCONF_MAX
 };
 

-- 
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: [FIX][PATCH] ipv6 addrconf.c : wrong handling of non-ipv6 hardware since 2.6.21

2007-05-17 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Thu, 17 May 2007 18:53:03 +0200), Oliver 
Hartkopp [EMAIL PROTECTED] says:

 +static int ipv6_hwtype(struct net_device *dev)
 +{
 +if ((dev-type == ARPHRD_ETHER) ||
 +(dev-type == ARPHRD_LOOPBACK) ||
 +#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
 +(dev-type == ARPHRD_SIT) ||
 +#endif
 +(dev-type == ARPHRD_TUNNEL6) ||
 +(dev-type == ARPHRD_FDDI) ||
 +(dev-type == ARPHRD_IEEE802_TR) ||
 +(dev-type == ARPHRD_ARCNET) ||
 +(dev-type == ARPHRD_INFINIBAND))
 +return 1;
 +
 +return 0;
 +}
 +

Please remove #if, or please provide for other
dependencies as well (e.g., CONFIG_IPV6_TUNNEL etc.)

Otherwise, I would agree.

-- 
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.6.21-stable] [IPV6]: Restore semantics of Routing Header processing.

2007-05-11 Thread YOSHIFUJI Hideaki /
The fix for emerging security threats was overkill and it broke
basic semantic of IPv6 routing header processing.  We should assume
RT0 (or even RT2, depends on configuration) as unknown RH type so
that we
- silently ignore the routing header if segleft == 0
- or, send ICMPv6 Parameter Problem message back to the sender,
  otherwise.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 net/ipv6/exthdrs.c |   46 --
 1 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 3205ec9..6386dd7 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -368,22 +368,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
struct rt0_hdr *rthdr;
int accept_source_route = ipv6_devconf.accept_source_route;
 
-   if (accept_source_route  0 ||
-   ((idev = in6_dev_get(skb-dev)) == NULL)) {
-   kfree_skb(skb);
-   return -1;
-   }
-   if (idev-cnf.accept_source_route  0) {
+   idev = in6_dev_get(skb-dev);
+   if (idev) {
+   if (accept_source_route  idev-cnf.accept_source_route)
+   accept_source_route = idev-cnf.accept_source_route;
in6_dev_put(idev);
-   kfree_skb(skb);
-   return -1;
}
 
-   if (accept_source_route  idev-cnf.accept_source_route)
-   accept_source_route = idev-cnf.accept_source_route;
-
-   in6_dev_put(idev);
-
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))) 
{
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -394,23 +385,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
hdr = (struct ipv6_rt_hdr *) skb-h.raw;
 
-   switch (hdr-type) {
-#ifdef CONFIG_IPV6_MIP6
-   case IPV6_SRCRT_TYPE_2:
-   break;
-#endif
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route  0)
-   break;
-   kfree_skb(skb);
-   return -1;
-   default:
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
-IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (hdr-type) - 
skb-nh.raw);
-   return -1;
-   }
-
if (ipv6_addr_is_multicast(skb-nh.ipv6h-daddr) ||
skb-pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -450,6 +424,8 @@ looped_back:
 
switch (hdr-type) {
case IPV6_SRCRT_TYPE_0:
+   if (accept_source_route = 0)
+   goto unknown_rh;
if (hdr-hdrlen  0x01) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
 IPSTATS_MIB_INHDRERRORS);
@@ -459,6 +435,8 @@ looped_back:
break;
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
+   if (accept_source_route  0)
+   goto unknown_rh;
/* Silently discard invalid RTH type 2 */
if (hdr-hdrlen != 2 || hdr-segments_left != 1) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -468,6 +446,8 @@ looped_back:
}
break;
 #endif
+   default:
+   goto unknown_rh;
}
 
/*
@@ -569,6 +549,12 @@ looped_back:
skb_push(skb, skb-data - skb-nh.raw);
dst_input(skb);
return -1;
+
+unknown_rh:
+   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), IPSTATS_MIB_INHDRERRORS);
+   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
+ (hdr-type) - skb-nh.raw);
+   return -1;
 }
 
 static struct inet6_protocol rthdr_protocol = {
-- 
1.5.1

-- 
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 net-2.6] [IPV6]: Restore semantics of Routing Header processing.

2007-05-11 Thread YOSHIFUJI Hideaki /
The fix for emerging security threats was overkill and it broke
basic semantic of IPv6 routing header processing.  We should assume
RT0 (or even RT2, depends on configuration) as unknown RH type so
that we
- silently ignore the routing header if segleft == 0,
- or, send ICMPv6 Parameter Problem message back to the sender,
  otherwise.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 net/ipv6/exthdrs.c |   47 ---
 1 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 14be0b9..05e9bb5 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -371,22 +371,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
struct rt0_hdr *rthdr;
int accept_source_route = ipv6_devconf.accept_source_route;
 
-   if (accept_source_route  0 ||
-   ((idev = in6_dev_get(skb-dev)) == NULL)) {
-   kfree_skb(skb);
-   return -1;
-   }
-   if (idev-cnf.accept_source_route  0) {
+   idev = in6_dev_get(skb-dev);
+   if (idev) {
+   if (accept_source_route  idev-cnf.accept_source_route)
+   accept_source_route = idev-cnf.accept_source_route;
in6_dev_put(idev);
-   kfree_skb(skb);
-   return -1;
}
 
-   if (accept_source_route  idev-cnf.accept_source_route)
-   accept_source_route = idev-cnf.accept_source_route;
-
-   in6_dev_put(idev);
-
if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
!pskb_may_pull(skb, (skb_transport_offset(skb) +
 ((skb_transport_header(skb)[1] + 1)  3 {
@@ -398,24 +389,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
hdr = (struct ipv6_rt_hdr *)skb_transport_header(skb);
 
-   switch (hdr-type) {
-#ifdef CONFIG_IPV6_MIP6
-   case IPV6_SRCRT_TYPE_2:
-   break;
-#endif
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route  0)
-   break;
-   kfree_skb(skb);
-   return -1;
-   default:
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
-IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
- (hdr-type) - skb_network_header(skb));
-   return -1;
-   }
-
if (ipv6_addr_is_multicast(ipv6_hdr(skb)-daddr) ||
skb-pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -454,6 +427,8 @@ looped_back:
 
switch (hdr-type) {
case IPV6_SRCRT_TYPE_0:
+   if (accept_source_route = 0)
+   goto unknown_rh;
if (hdr-hdrlen  0x01) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
 IPSTATS_MIB_INHDRERRORS);
@@ -465,6 +440,8 @@ looped_back:
break;
 #ifdef CONFIG_IPV6_MIP6
case IPV6_SRCRT_TYPE_2:
+   if (accept_source_route  0)
+   goto unknown_rh;
/* Silently discard invalid RTH type 2 */
if (hdr-hdrlen != 2 || hdr-segments_left != 1) {
IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
@@ -474,6 +451,8 @@ looped_back:
}
break;
 #endif
+   default:
+   goto unknown_rh;
}
 
/*
@@ -577,6 +556,12 @@ looped_back:
skb_push(skb, skb-data - skb_network_header(skb));
dst_input(skb);
return -1;
+
+unknown_rh:
+   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), IPSTATS_MIB_INHDRERRORS);
+   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
+ (hdr-type) - skb_network_header(skb));
+   return -1;
 }
 
 static struct inet6_protocol rthdr_protocol = {
-- 
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 2.6.16-stable] [IPV6]: Restore semantics of Routing Header processing.

2007-05-11 Thread YOSHIFUJI Hideaki /
The fix for emerging security threats was overkill and it broke
basic semantic of IPv6 routing header processing.  We should assume
RT0 as unknown RH type so that we
- silently ignore the routing header if segleft == 0
- or, send ICMPv6 Parameter Problem message back to the sender,
  otherwise.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
 Documentation/networking/ip-sysctl.txt |5 +--
 net/ipv6/exthdrs.c |   38 +++-
 2 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt 
b/Documentation/networking/ip-sysctl.txt
index d512f22..0d33275 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -726,9 +726,8 @@ accept_redirects - BOOLEAN
 accept_source_route - INTEGER
Accept source routing (routing extension header).
 
-0: Accept routing header.
-   = 0: Accept only routing header type 2.
-0: Do not accept routing header.
+0: Accept Routing Header Type 0.
+   = 0: Do not accept Routing Header.
 
Default: 0
 
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index a7cac22..b3d9adf 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -227,22 +227,13 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
struct rt0_hdr *rthdr;
int accept_source_route = ipv6_devconf.accept_source_route;
 
-   if (accept_source_route  0 ||
-   ((idev = in6_dev_get(skb-dev)) == NULL)) {
-   kfree_skb(skb);
-   return -1;
-   }
-   if (idev-cnf.accept_source_route  0) {
+   idev = in6_dev_get(skb-dev);
+   if (idev) {
+   if (accept_source_route  idev-cnf.accept_source_route)
+   accept_source_route = idev-cnf.accept_source_route;
in6_dev_put(idev);
-   kfree_skb(skb);
-   return -1;
}
 
-   if (accept_source_route  idev-cnf.accept_source_route)
-   accept_source_route = idev-cnf.accept_source_route;
-
-   in6_dev_put(idev);
-
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))) 
{
IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
@@ -252,18 +243,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
 
hdr = (struct ipv6_rt_hdr *) skb-h.raw;
 
-   switch (hdr-type) {
-   case IPV6_SRCRT_TYPE_0:
-   if (accept_source_route  0)
-   break;
-   kfree_skb(skb);
-   return -1;
-   default:
-   IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
-   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (hdr-type) - 
skb-nh.raw);
-   return -1;
-   }
-
if (ipv6_addr_is_multicast(skb-nh.ipv6h-daddr) ||
skb-pkt_type != PACKET_HOST) {
IP6_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
@@ -282,6 +261,10 @@ looped_back:
return 1;
}
 
+   if (hdr-type != IPV6_SRCRT_TYPE_0 ||
+   accept_source_route = 0)
+   goto unknown_rh;
+
if (hdr-hdrlen  0x01) {
IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (hdr-hdrlen) - 
skb-nh.raw);
@@ -359,6 +342,11 @@ looped_back:
skb_push(skb, skb-data - skb-nh.raw);
dst_input(skb);
return -1;
+
+unknown_rh:
+   IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
+   icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (hdr-type) - skb-nh.raw);
+   return -1;
 }
 
 static struct inet6_protocol rthdr_protocol = {
-- 
1.5.1

-- 
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 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-11 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru 
Chinen [EMAIL PROTECTED] says:

 [IPV4] SNMP: Display new statistics at /proc/net/netstat
 
 This displays the statistics specified in the updated IP-MIB RFC
 (RFC4293) in /proc/net/netstat. The reason why these are not displayed
 in /proc/net/snmp is that some existing utilities are developed under
 the assumption which ipstat items in /proc/net/snmp is unchanged.
 
 Signed-off-by: Mitsuru Chinen [EMAIL PROTECTED]
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: [stable] [PATCH 2.6.21-stable] [IPV6]: Restore semantics of Routing Header processing.

2007-05-11 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Fri, 11 May 2007 09:22:43 -0700), Chris 
Wright [EMAIL PROTECTED] says:

 * YOSHIFUJI Hideaki / 吉藤英明 ([EMAIL PROTECTED]) wrote:
  The fix for emerging security threats was overkill and it broke
  basic semantic of IPv6 routing header processing.  We should assume
  RT0 (or even RT2, depends on configuration) as unknown RH type so
  that we
  - silently ignore the routing header if segleft == 0
  - or, send ICMPv6 Parameter Problem message back to the sender,
otherwise.
 
 Does that mean this one has received testing and is good for -stable
 now, or does it need some bake time?

Chris, I think it is okay, but
please wait for Dave's approval.
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


[IPV6] ROUTE: Assign rt6i_idev for ip6_{prohibit,blk_hole}_entry.

2007-05-09 Thread YOSHIFUJI Hideaki /
We need to assign rt6i_idev for ip6_{prohibit,blk_hole}_entry as well
as we are doing for ip6_null_entry.

2.6.20-stable also needs this.

Closes: Bug#8450
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 452a82c..d1a9827 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4060,6 +4060,10 @@ int __init addrconf_init(void)
return err;
 
ip6_null_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+   ip6_prohibit_entry.rt6i_idev = in6_dev_get(loopback_dev);
+   ip6_blk_hole_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#endif
 
register_netdevice_notifier(ipv6_dev_notf);
 

-- 
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] ROUTE: Assign rt6i_idev for ip6_{prohibit,blk_hole}_entry.

2007-05-09 Thread YOSHIFUJI Hideaki /
In article [EMAIL PROTECTED] (at Wed, 09 May 2007 01:13:33 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 From: YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED]
 Date: Wed, 09 May 2007 17:05:50 +0900 (JST)
 
  We need to assign rt6i_idev for ip6_{prohibit,blk_hole}_entry as well
  as we are doing for ip6_null_entry.
  
  2.6.20-stable also needs this.
  
  Closes: Bug#8450
  Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 
 Applied, and I'll push to -stable, thanks.

Wait for a moment, please.
I thought it should fix the issue, but
I must say, the fix does not seem sufficient...

I'm now analysing further.

--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]: Do no rely on skb-dst before it is assigned.

2007-05-09 Thread YOSHIFUJI Hideaki /
Because skb-dst is assigned in ip6_route_input(), it is really
bad to use it in hop-by-hop option handler(s).

This fix is also needed for -stable.

Closes: Bug #8450 (Eric Sesterhenn [EMAIL PROTECTED])
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index fb39604..1e6e67e 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -651,6 +651,14 @@ EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
   Hop-by-hop options.
  **/
 
+/*
+ * Note: we cannot rely on skb-dst before we assign it in ip6_route_input(). 
+ */
+static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
+{
+   return skb-dst ? ip6_dst_idev(skb-dst) : __in6_dev_get(skb-dev);
+}
+
 /* Router Alert as of RFC 2711 */
 
 static int ipv6_hop_ra(struct sk_buff **skbp, int optoff)
@@ -677,25 +685,25 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int 
optoff)
if (skb-nh.raw[optoff+1] != 4 || (optoff3) != 2) {
LIMIT_NETDEBUG(KERN_DEBUG ipv6_hop_jumbo: wrong jumbo opt 
length/alignment %d\n,
   skb-nh.raw[optoff+1]);
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb),
 IPSTATS_MIB_INHDRERRORS);
goto drop;
}
 
pkt_len = ntohl(*(__be32*)(skb-nh.raw+optoff+2));
if (pkt_len = IPV6_MAXPLEN) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INHDRERRORS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
return 0;
}
if (skb-nh.ipv6h-payload_len) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INHDRERRORS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
return 0;
}
 
if (pkt_len  skb-len - sizeof(struct ipv6hdr)) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INTRUNCATEDPKTS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), 
IPSTATS_MIB_INTRUNCATEDPKTS);
goto drop;
}
 

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


[IPV6] ROUTE: Assign rt6i_idev for ip6_{prohibit,blk_hole}_entry.

2007-05-09 Thread YOSHIFUJI Hideaki /
I think this is less critical, but is also suitable for -stable
release.

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

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 452a82c..d1a9827 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4060,6 +4060,10 @@ int __init addrconf_init(void)
return err;
 
ip6_null_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+   ip6_prohibit_entry.rt6i_idev = in6_dev_get(loopback_dev);
+   ip6_blk_hole_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#endif
 
register_netdevice_notifier(ipv6_dev_notf);
 

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

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

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


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


[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
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git.

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 

[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


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]

2007-04-19 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

http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=gitroot/yoshfuji/iproute2-dev.git;a=shortlog;h=v2_6_19-061214-20070404-protinfo-20070404

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
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git.

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,
 };
 

[GIT PATCH] Exporting IPv6 statistics via netlink.

2007-04-19 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

http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=gitroot/yoshfuji/iproute2-dev.git;a=shortlog;h=v2_6_19-061214-20070404-protinfo-20070404

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
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git.

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 

[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

http://www.linux-ipv6.org/gitweb/gitweb.cgi?p=/gitroot/ip6aspctl.git;a=summary.


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 = 

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
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git.

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


[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 @@ #endif
memset(rq, 0, 

[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


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/refpurpose
  refsynopsisdiv
  cmdsynopsis
  commandtracepath/command
 +arg choice=opt-l replaceable/pktlen//arg
  arg choice=reqreplaceable/destination//arg
  arg choice=optreplaceable/port//arg
  /cmdsynopsis
 @@ -39,6 +40,18 @@ of UDP ports to maintain trace history.
  /para
  /refsect1
  
 +refsect1titleOPTIONS/title
 +variablelist
 + varlistentry
 +  termoption/-l//term
 +  listitempara
 +Sets the initial packet length to replaceable/pktlen/ instead of
 +65536 for command/tracepath/ or 128000 for command/tracepath6/.
 +  /para/listitem
 + /varlistentry
 +/variablelist
 +/refsect1
 +
  refsect1titleOUTPUT/title
  para
  literallayout
 -- 
 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


Re: [PATCH 1/4] [IPv6] Add link and site-local scope inline

2007-04-06 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 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_typeIPV6_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


<    1   2   3   4   5   >