2002-11-03 02:48:54

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: [PATCH] IPv6: Functions Clean-up

Hello!

This patch cleans up functions in ipv6 stack:

- export route6_me_harder() as ip6_route_harder() and
use it from net/ipv6/netfilter/ip6_queue.c.
- make ip6_addr_prefix() to generate prefix of given address and
prefix length, instead of doing "ipv6_copy_addr() then
ipv6_wash_prefix()."

Patch is against 2.5.45.

Thanks in advance.

-------------------------------------------------------------------
Patch-Name: Functions Clean-up
Patch-Id: FIX_2_5_45_FUNC_CLEANUP-20021102
Patch-Author: YOSHIFUJI Hideaki / USAGI Project <[email protected]>
Credit: YOSHIFUJI Hideaki / USAGI Project <[email protected]>
-------------------------------------------------------------------
Index: include/net/ip6_route.h
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/include/net/ip6_route.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.16.1
diff -u -r1.1.1.1 -r1.1.1.1.16.1
--- include/net/ip6_route.h 7 Oct 2002 10:22:46 -0000 1.1.1.1
+++ include/net/ip6_route.h 2 Nov 2002 14:50:30 -0000 1.1.1.1.16.1
@@ -30,6 +30,8 @@
extern struct dst_entry * ip6_route_output(struct sock *sk,
struct flowi *fl);

+extern int ip6_route_harder(struct sk_buff *skb);
+
extern void ip6_route_init(void);
extern void ip6_route_cleanup(void);

Index: net/ipv6/ip6_output.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ip6_output.c,v
retrieving revision 1.1.1.3
retrieving revision 1.1.1.3.6.1
diff -u -r1.1.1.3 -r1.1.1.3.6.1
--- net/ipv6/ip6_output.c 30 Oct 2002 09:43:18 -0000 1.1.1.3
+++ net/ipv6/ip6_output.c 2 Nov 2002 14:50:30 -0000 1.1.1.3.6.1
@@ -134,7 +134,7 @@


#ifdef CONFIG_NETFILTER
-static int route6_me_harder(struct sk_buff *skb)
+int ip6_route_harder(struct sk_buff *skb)
{
struct ipv6hdr *iph = skb->nh.ipv6h;
struct dst_entry *dst;
@@ -152,7 +152,7 @@

if (dst->error) {
if (net_ratelimit())
- printk(KERN_DEBUG "route6_me_harder: No more route.\n");
+ printk(KERN_DEBUG "ip6_route_harder: No more route.\n");
return -EINVAL;
}

@@ -168,7 +168,7 @@
{
#ifdef CONFIG_NETFILTER
if (skb->nfcache & NFC_ALTERED){
- if (route6_me_harder(skb) != 0){
+ if (ip6_route_harder(skb) != 0){
kfree_skb(skb);
return -EINVAL;
}
Index: net/ipv6/ipv6_syms.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ipv6_syms.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.16.1
diff -u -r1.1.1.1 -r1.1.1.1.16.1
--- net/ipv6/ipv6_syms.c 7 Oct 2002 10:20:36 -0000 1.1.1.1
+++ net/ipv6/ipv6_syms.c 2 Nov 2002 14:50:30 -0000 1.1.1.1.16.1
@@ -1,4 +1,5 @@

+#include <linux/config.h>
#include <linux/module.h>
#include <net/protocol.h>
#include <net/ipv6.h>
@@ -11,6 +12,9 @@
EXPORT_SYMBOL(register_inet6addr_notifier);
EXPORT_SYMBOL(unregister_inet6addr_notifier);
EXPORT_SYMBOL(ip6_route_output);
+#ifdef CONFIG_NETFILTER
+EXPORT_SYMBOL(ip6_route_harder);
+#endif
EXPORT_SYMBOL(addrconf_lock);
EXPORT_SYMBOL(ipv6_setsockopt);
EXPORT_SYMBOL(ipv6_getsockopt);
Index: net/ipv6/route.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/route.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.4.6.1
diff -u -r1.1.1.4 -r1.1.1.4.6.1
--- net/ipv6/route.c 30 Oct 2002 09:43:18 -0000 1.1.1.4
+++ net/ipv6/route.c 2 Nov 2002 14:52:05 -0000 1.1.1.4.6.1
@@ -573,15 +573,17 @@
Remove it only when all the things will work!
*/

-static void ipv6_wash_prefix(struct in6_addr *pfx, int plen)
+static void ipv6_addr_prefix(struct in6_addr *pfx,
+ const struct in6_addr *addr, int plen)
{
int b = plen&0x7;
- int o = (plen + 7)>>3;
+ int o = plen>>3;

+ memcpy(prefix, addr, o);
if (o < 16)
memset(pfx->s6_addr + o, 0, 16 - o);
if (b != 0)
- pfx->s6_addr[plen>>3] &= (0xFF<<(8-b));
+ pfx->s6_addr[o] = addr->s6_addr[o]&(0xff00 >> b);
}

static int ipv6_get_mtu(struct net_device *dev)
@@ -654,16 +656,16 @@
goto out;
}

- ipv6_addr_copy(&rt->rt6i_dst.addr, &rtmsg->rtmsg_dst);
+ ipv6_addr_prefix(&rt->rt6i_dst.addr,
+ &rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len);
rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len;
if (rt->rt6i_dst.plen == 128)
rt->u.dst.flags = DST_HOST;
- ipv6_wash_prefix(&rt->rt6i_dst.addr, rt->rt6i_dst.plen);

#ifdef CONFIG_IPV6_SUBTREES
- ipv6_addr_copy(&rt->rt6i_src.addr, &rtmsg->rtmsg_src);
+ ipv6_addr_prefix(&rt->rt6i_src.addr,
+ &rtmsg->rtmsg_src, rtmsg->rtmsg_src_len);
rt->rt6i_src.plen = rtmsg->rtmsg_src_len;
- ipv6_wash_prefix(&rt->rt6i_src.addr, rt->rt6i_src.plen);
#endif

rt->rt6i_metric = rtmsg->rtmsg_metric;
Index: net/ipv6/netfilter/ip6_queue.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/netfilter/ip6_queue.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.14.1
diff -u -r1.1.1.2 -r1.1.1.2.14.1
--- net/ipv6/netfilter/ip6_queue.c 8 Oct 2002 03:15:20 -0000 1.1.1.2
+++ net/ipv6/netfilter/ip6_queue.c 2 Nov 2002 14:50:30 -0000 1.1.1.2.14.1
@@ -326,45 +326,6 @@
return status;
}

-/*
- * Taken from net/ipv6/ip6_output.c
- *
- * We should use the one there, but is defined static
- * so we put this just here and let the things as
- * they are now.
- *
- * If that one is modified, this one should be modified too.
- */
-static int
-route6_me_harder(struct sk_buff *skb)
-{
- struct ipv6hdr *iph = skb->nh.ipv6h;
- struct dst_entry *dst;
- struct flowi fl;
-
- fl.proto = iph->nexthdr;
- fl.fl6_dst = &iph->daddr;
- fl.fl6_src = &iph->saddr;
- fl.oif = skb->sk ? skb->sk->bound_dev_if : 0;
- fl.fl6_flowlabel = 0;
- fl.uli_u.ports.dport = 0;
- fl.uli_u.ports.sport = 0;
-
- dst = ip6_route_output(skb->sk, &fl);
-
- if (dst->error) {
- if (net_ratelimit())
- printk(KERN_DEBUG "route6_me_harder: No more route.\n");
- return -EINVAL;
- }
-
- /* Drop old route. */
- dst_release(skb->dst);
-
- skb->dst = dst;
- return 0;
-}
-
static int
ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
{
@@ -410,7 +371,7 @@
struct ipv6hdr *iph = e->skb->nh.ipv6h;
if (ipv6_addr_cmp(&iph->daddr, &e->rt_info.daddr) ||
ipv6_addr_cmp(&iph->saddr, &e->rt_info.saddr))
- return route6_me_harder(e->skb);
+ return ip6_route_harder(e->skb);
}
return 0;
}


2002-11-03 11:54:02

by Andras Kis-Szabo

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

Hello,

> - export route6_me_harder() as ip6_route_harder() and
> use it from net/ipv6/netfilter/ip6_queue.c.
Opsz!
At the extension parser code we got that decision that we should use
our own parser in the Netfilter code! (And we should not to trust in the
kernel.)
This patch removes one function from the Netfilter code and forces the
Netfilter to use a similar function from the kernel's one!

Regards,

kisza

--
Andras Kis-Szabo Security Development, Design and Audit
-------------------------/ Zorp, NetFilter and IPv6
[email protected] /------------------------------------------->

2002-11-03 12:02:31

by Pekka Savola

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

On Sun, 3 Nov 2002, Andras Kis-Szabo wrote:
> > - export route6_me_harder() as ip6_route_harder() and
> > use it from net/ipv6/netfilter/ip6_queue.c.
> Opsz!
> At the extension parser code we got that decision that we should use
> our own parser in the Netfilter code! (And we should not to trust in the
> kernel.)
> This patch removes one function from the Netfilter code and forces the
> Netfilter to use a similar function from the kernel's one!

And why is that a problem?

If there is a problem in main kernel code, it should fixed. If the
netfilter version is better, the main kernel code should be changed.

Are there specific reasons to keep them separate?

--
Pekka Savola "Tell me of difficulties surmounted,
Netcore Oy not those you stumble over and fall"
Systems. Networks. Security. -- Robert Jordan: A Crown of Swords

2002-11-03 12:07:25

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

From: Andras Kis-Szabo <[email protected]>
Date: Sun, 03 Nov 2002 14:00:14 +0100

(And we should not to trust in the kernel.)

If you can't trust the exthdr parser in the kernel, you probably can't
trust the kernel to even give you the packets correctly in the first
place. So you better just rm -rf netfilter/ while you have the chance
:-)

2002-11-03 13:10:46

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

In article <1036328414.1048.3.camel@arwen> (at Sun, 03 Nov 2002 14:00:14 +0100), Andras Kis-Szabo <[email protected]> says:

> This patch removes one function from the Netfilter code and forces the
> Netfilter to use a similar function from the kernel's one!

net/ipv6/netfilter/ip6_queue.c says:

/*
* Taken from net/ipv6/ip6_output.c
* We should use the one there, but is defined static
* so we put this just here and let the things as
* they are now.
*
* If that one is modified, this one should be modified too.
*/

So, the reason why the copy of route6_me_harder()
lives there is because net/ipv6/ip6_output.c has not been
exported it.

Is this something to do with parser of extension headers?
Parser of extension headers is different thing, isn't it?

Yes, since duplication of code is bad unless there're really
strong reasons. I believe that there would be a better
design for filtering.

--
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

2002-11-03 13:13:45

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

In article <[email protected]> (at Sun, 03 Nov 2002 22:16:58 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:

> So, the reason why the copy of route6_me_harder()
> lives there is because net/ipv6/ip6_output.c has not been
~~~~~~~~~~~~does not
> exported it.
~~~~~~~~export

--yoshfuji

2002-11-03 13:17:02

by James Morris

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

On Sun, 3 Nov 2002, YOSHIFUJI Hideaki / [iso-2022-jp] 吉藤英明 wrote:

> So, the reason why the copy of route6_me_harder()
> lives there is because net/ipv6/ip6_output.c has not been
> exported it.
>

Yes. It would be much better to use common core networking code.


- James
--
James Morris
<[email protected]>


2002-11-03 13:21:32

by Andras Kis-Szabo

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

Hi,

> /*
> * Taken from net/ipv6/ip6_output.c
> * We should use the one there, but is defined static
> * so we put this just here and let the things as
> * they are now.
> *
> * If that one is modified, this one should be modified too.
> */
>
> So, the reason why the copy of route6_me_harder()
> lives there is because net/ipv6/ip6_output.c has not been
> exported it.
Ok, ok! I have not got problems with this any more! :)
It is even worse that the route6_me_harder() depends on the
CONFIG_NETFILTER option, so this function comes from the Netfilter. In
this case it is an unwanted code-duplication :(

> Is this something to do with parser of extension headers?
> Parser of extension headers is different thing, isn't it?
Yes, it is a different thing with different code.

Regards,

kisza

--
Andras Kis-Szabo Security Development, Design and Audit
-------------------------/ Zorp, NetFilter and IPv6
[email protected] /------------------------------------------->

2003-02-23 09:24:30

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Sun, 03 Nov 2002 11:54:27 +0900 (JST)

This patch cleans up functions in ipv6 stack:

- export route6_me_harder() as ip6_route_harder() and
use it from net/ipv6/netfilter/ip6_queue.c.
- make ip6_addr_prefix() to generate prefix of given address and
prefix length, instead of doing "ipv6_copy_addr() then
ipv6_wash_prefix()."

Please change new name to ip6_route_me_harder(). When one
says "something me harder" is has amusing implications when
heard by most english speakers and I'd like to keep this :-)

I will apply this patch once you make the change. Would you
like me to add it to 2.4.x as well?

We really need to revisit USAGI patch backlog. I have and will apply
privacy extension 2.5.x patch you sent. For all the others please
feel free to "patch bomb" me :-) Please indicate with each patch
whether the it is desired in 2.4.x as well.

If you wish to concentrate on ipv6 ipsec first, that is ok too. :-)

2003-02-24 03:47:14

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

Hello.

In article <[email protected]> (at Sun, 23 Feb 2003 01:18:16 -0800 (PST)), "David S. Miller" <[email protected]> says:

> Please change new name to ip6_route_me_harder(). When one
> says "something me harder" is has amusing implications when
> heard by most english speakers and I'd like to keep this :-)

ok. :-)


> I will apply this patch once you make the change. Would you
> like me to add it to 2.4.x as well?

yes. Do I need to send a patch for linux-2.4.xx, too?


Here's the patch for linux-2.5.62.

Thanks.

Index: include/net/ip6_route.h
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/include/net/ip6_route.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.30.2
diff -u -r1.1.1.1 -r1.1.1.1.30.2
--- include/net/ip6_route.h 7 Oct 2002 10:22:46 -0000 1.1.1.1
+++ include/net/ip6_route.h 23 Feb 2003 17:46:50 -0000 1.1.1.1.30.2
@@ -30,6 +30,8 @@
extern struct dst_entry * ip6_route_output(struct sock *sk,
struct flowi *fl);

+extern int ip6_route_me_harder(struct sk_buff *skb);
+
extern void ip6_route_init(void);
extern void ip6_route_cleanup(void);

Index: net/ipv6/ip6_output.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ip6_output.c,v
retrieving revision 1.1.1.3
retrieving revision 1.1.1.3.16.2
diff -u -r1.1.1.3 -r1.1.1.3.16.2
--- net/ipv6/ip6_output.c 30 Oct 2002 09:43:18 -0000 1.1.1.3
+++ net/ipv6/ip6_output.c 23 Feb 2003 17:46:50 -0000 1.1.1.3.16.2
@@ -134,7 +134,7 @@


#ifdef CONFIG_NETFILTER
-static int route6_me_harder(struct sk_buff *skb)
+int ip6_route_me_harder(struct sk_buff *skb)
{
struct ipv6hdr *iph = skb->nh.ipv6h;
struct dst_entry *dst;
@@ -152,7 +152,7 @@

if (dst->error) {
if (net_ratelimit())
- printk(KERN_DEBUG "route6_me_harder: No more route.\n");
+ printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
return -EINVAL;
}

@@ -168,7 +168,7 @@
{
#ifdef CONFIG_NETFILTER
if (skb->nfcache & NFC_ALTERED){
- if (route6_me_harder(skb) != 0){
+ if (ip6_route_me_harder(skb) != 0){
kfree_skb(skb);
return -EINVAL;
}
Index: net/ipv6/ipv6_syms.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/ipv6_syms.c,v
retrieving revision 1.1.1.3
retrieving revision 1.1.1.3.8.4
diff -u -r1.1.1.3 -r1.1.1.3.8.4
--- net/ipv6/ipv6_syms.c 16 Feb 2003 04:09:28 -0000 1.1.1.3
+++ net/ipv6/ipv6_syms.c 24 Feb 2003 03:40:55 -0000 1.1.1.3.8.4
@@ -1,4 +1,5 @@

+#include <linux/config.h>
#include <linux/module.h>
#include <net/protocol.h>
#include <net/ipv6.h>
@@ -12,6 +13,9 @@
EXPORT_SYMBOL(register_inet6addr_notifier);
EXPORT_SYMBOL(unregister_inet6addr_notifier);
EXPORT_SYMBOL(ip6_route_output);
+#ifdef CONFIG_NETFILTER
+EXPORT_SYMBOL(ip6_route_me_harder);
+#endif
EXPORT_SYMBOL(addrconf_lock);
EXPORT_SYMBOL(ipv6_setsockopt);
EXPORT_SYMBOL(ipv6_getsockopt);
Index: net/ipv6/route.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/route.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 route.c
--- net/ipv6/route.c 10 Feb 2003 19:40:49 -0000 1.1.1.6
+++ net/ipv6/route.c 24 Feb 2003 03:41:15 -0000
@@ -574,15 +574,17 @@
Remove it only when all the things will work!
*/

-static void ipv6_wash_prefix(struct in6_addr *pfx, int plen)
+static void ipv6_addr_prefix(struct in6_addr *pfx,
+ const struct in6_addr *addr, int plen)
{
int b = plen&0x7;
- int o = (plen + 7)>>3;
+ int o = plen>>3;

+ memcpy(prefix, addr, o);
if (o < 16)
memset(pfx->s6_addr + o, 0, 16 - o);
if (b != 0)
- pfx->s6_addr[plen>>3] &= (0xFF<<(8-b));
+ pfx->s6_addr[o] = addr->s6_addr[o]&(0xff00 >> b);
}

static int ipv6_get_mtu(struct net_device *dev)
@@ -655,16 +657,16 @@
goto out;
}

- ipv6_addr_copy(&rt->rt6i_dst.addr, &rtmsg->rtmsg_dst);
+ ipv6_addr_prefix(&rt->rt6i_dst.addr,
+ &rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len);
rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len;
if (rt->rt6i_dst.plen == 128)
rt->u.dst.flags = DST_HOST;
- ipv6_wash_prefix(&rt->rt6i_dst.addr, rt->rt6i_dst.plen);

#ifdef CONFIG_IPV6_SUBTREES
- ipv6_addr_copy(&rt->rt6i_src.addr, &rtmsg->rtmsg_src);
+ ipv6_addr_prefix(&rt->rt6i_src.addr,
+ &rtmsg->rtmsg_src, rtmsg->rtmsg_src_len);
rt->rt6i_src.plen = rtmsg->rtmsg_src_len;
- ipv6_wash_prefix(&rt->rt6i_src.addr, rt->rt6i_src.plen);
#endif

rt->rt6i_metric = rtmsg->rtmsg_metric;
Index: net/ipv6/netfilter/ip6_queue.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/netfilter/ip6_queue.c,v
retrieving revision 1.1.1.4
retrieving revision 1.1.1.4.12.2
diff -u -r1.1.1.4 -r1.1.1.4.12.2
--- net/ipv6/netfilter/ip6_queue.c 16 Feb 2003 04:09:30 -0000 1.1.1.4
+++ net/ipv6/netfilter/ip6_queue.c 23 Feb 2003 17:46:50 -0000 1.1.1.4.12.2
@@ -326,45 +326,6 @@
return status;
}

-/*
- * Taken from net/ipv6/ip6_output.c
- *
- * We should use the one there, but is defined static
- * so we put this just here and let the things as
- * they are now.
- *
- * If that one is modified, this one should be modified too.
- */
-static int
-route6_me_harder(struct sk_buff *skb)
-{
- struct ipv6hdr *iph = skb->nh.ipv6h;
- struct dst_entry *dst;
- struct flowi fl;
-
- fl.proto = iph->nexthdr;
- fl.fl6_dst = &iph->daddr;
- fl.fl6_src = &iph->saddr;
- fl.oif = skb->sk ? skb->sk->bound_dev_if : 0;
- fl.fl6_flowlabel = 0;
- fl.uli_u.ports.dport = 0;
- fl.uli_u.ports.sport = 0;
-
- dst = ip6_route_output(skb->sk, &fl);
-
- if (dst->error) {
- if (net_ratelimit())
- printk(KERN_DEBUG "route6_me_harder: No more route.\n");
- return -EINVAL;
- }
-
- /* Drop old route. */
- dst_release(skb->dst);
-
- skb->dst = dst;
- return 0;
-}
-
static int
ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
{
@@ -410,7 +371,7 @@
struct ipv6hdr *iph = e->skb->nh.ipv6h;
if (ipv6_addr_cmp(&iph->daddr, &e->rt_info.daddr) ||
ipv6_addr_cmp(&iph->saddr, &e->rt_info.saddr))
- return route6_me_harder(e->skb);
+ return ip6_route_me_harder(e->skb);
}
return 0;
}

--
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

2003-02-24 06:32:12

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Mon, 24 Feb 2003 12:57:02 +0900 (JST)

> I will apply this patch once you make the change. Would you
> like me to add it to 2.4.x as well?

yes. Do I need to send a patch for linux-2.4.xx, too?

Not necessary, I know what is different in the networking
between these two trees.

Here's the patch for linux-2.5.62.

Applied, thanks.

2003-02-24 07:00:41

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Mon, 24 Feb 2003 12:57:02 +0900 (JST)

Here's the patch for linux-2.5.62.

Hideaki-san, do you try to compile the patches you send
to me? :-)

-static void ipv6_wash_prefix(struct in6_addr *pfx, int plen)
+static void ipv6_addr_prefix(struct in6_addr *pfx,
+ const struct in6_addr *addr, int plen)
{
int b = plen&0x7;
- int o = (plen + 7)>>3;
+ int o = plen>>3;

+ memcpy(prefix, addr, o);

Where is the variable 'prefix' declared? You probably mean
'pfx->s6_addr' and that is the change I will make in my tree.

Thanks.

2003-02-24 07:08:14

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

In article <[email protected]> (at Sun, 23 Feb 2003 22:54:26 -0800 (PST)), "David S. Miller" <[email protected]> says:

> Hideaki-san, do you try to compile the patches you send
> to me? :-)

sorry, I had compiled with wrong options... :-p
just a moment, please...

--
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

2003-02-24 07:19:14

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

In article <[email protected]> (at Mon, 24 Feb 2003 16:18:15 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:

> In article <[email protected]> (at Sun, 23 Feb 2003 22:54:26 -0800 (PST)), "David S. Miller" <[email protected]> says:
>
> > Hideaki-san, do you try to compile the patches you send
> > to me? :-)
>
> sorry, I had compiled with wrong options... :-p
> just a moment, please...

Please apply this patch on top of the previous patch.
Sorry for the mess.

Index: net/ipv6/route.c
===================================================================
RCS file: /cvsroot/usagi/usagi-backport/linux25/net/ipv6/route.c,v
retrieving revision 1.1.1.6.12.1
retrieving revision 1.1.1.6.12.2
diff -u -r1.1.1.6.12.1 -r1.1.1.6.12.2
--- net/ipv6/route.c 23 Feb 2003 17:40:42 -0000 1.1.1.6.12.1
+++ net/ipv6/route.c 24 Feb 2003 07:10:02 -0000 1.1.1.6.12.2
@@ -580,7 +580,7 @@
int b = plen&0x7;
int o = plen>>3;

- memcpy(prefix, addr, o);
+ memcpy(pfx, addr, o);
if (o < 16)
memset(pfx->s6_addr + o, 0, 16 - o);
if (b != 0)

--
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

2003-02-24 07:25:12

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] IPv6: Functions Clean-up

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Mon, 24 Feb 2003 16:29:11 +0900 (JST)

In article <[email protected]> (at Mon, 24 Feb 2003 16:18:15 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:

> sorry, I had compiled with wrong options... :-p
> just a moment, please...

Please apply this patch on top of the previous patch.
Sorry for the mess.

As I said, I fixed it already by using pfx->s6_addr.

No problems and no need to apologize :)