ipv4: fix for ip_options_rcv_srr() daddr update.
Subsystems (3)
PATCH 1/1 ipv4: fix for ip_options_rcv_srr() daddr update.
When opt->srr_is_hit is set skb_rtable(skb) has been updated for 'nexthop' and iph->daddr should always equals to skb_rtable->rt_dst holds, We need update iph->daddr either.
--- net/ipv4/ip_options.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/ipv4/ip_options.c +1 -0
@@ -640,6 +640,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) }if (srrptr <= srrspace) { opt->srr_is_hit =1 ; + iph->daddr = nexthop; opt->is_changed =1 ; }return 0 ;
Signature · 1 line
1.7.3.2
From: Li Wei <[email protected]>
Date: Wed, 09 Nov 2011 15:39:28 +0800
Quoted 5 lines
When
opt->srr_is_hitis setskb_rtable(skb)has been updated for 'nexthop' andiph->daddrshould always equals toskb_rtable->rt_dstholds, We need updateiph->daddreither.Signed-off-by Li Wei <[email protected]>
Applied, thank you.
Quoted 12 lines
From: Li Wei <[email protected]>
Date: Wed, 09 Nov 2011 15:39:28 +0800Quoted 5 lines
When
opt->srr_is_hitis setskb_rtable(skb)has been updated for 'nexthop' andiph->daddrshould always equals toskb_rtable->rt_dstholds, We need updateiph->daddreither.Signed-off-by Li Wei <[email protected]>Applied, thank you.
Hi, David
These days i am doing some ICMP tests and sadly found that wen can't update iph->daddr in ip_options_rcv_srr(), It's too early. When some exception ocurred later (eg. in ip_forward() when goto sr_failed) we need the ip header be identical to the original one as ICMP need it.
It seems we need rt->rt_dst in ip_forward_options() and ip_forward() instead of iph->daddr.
David Miller
maintainerFrom: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 13:40:45 +0800
Quoted 7 lines
These days i am doing some ICMP tests and sadly found that wen can't update
iph->daddrinip_options_rcv_srr(), It's too early. When some exception ocurred later (eg. inip_forward()when gotosr_failed) we need the ip header be identical to the original one as ICMP need it.It seems we need
rt->rt_dstinip_forward_options()andip_forward()instead ofiph->daddr.
An alternative is to store the calculated destination address somewhere in the IPCB(skb).
Quoted 8 lines
From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 13:40:45 +0800Quoted 5 lines
These days i am doing some ICMP tests and sadly found that wen can't update
iph->daddrinip_options_rcv_srr(), It's too early. When some exception ocurred later (eg. inip_forward()when gotosr_failed) we need the ip header be identical to the original one as ICMP need it.
Quoted 7 lines
Quoted 2 lines
It seems we need
rt->rt_dstinip_forward_options()andip_forward()instead ofiph->daddr.An alternative is to store the calculated destination address somewhere in the IPCB(skb).
You mean modify struct inet_skb_parm add some field to store the calculated destination address?
My question, in ip_forward() and ip_forward_options() rt is there, why not we just use it?
David Miller
maintainerFrom: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:26:31 +0800
Quoted 2 lines
My question, in
ip_forward()andip_forward_options()rt is there, why not we just use it?
Because I'm trying to eliminate all accesses to rt->rt_dst because when I remove the routing cache, routes will be shared. One 'rt' will refer to many specific destination addresses.
Quoted 11 lines
From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:26:31 +0800Quoted 2 lines
My question, in
ip_forward()andip_forward_options()rt is there, why not we just use it?Because I'm trying to eliminate all accesses to
rt->rt_dstbecause when I remove the routing cache, routes will be shared. One 'rt' will refer to many specific destination addresses.
Sorry, I can't understand what you said, can you make it more clear?
I think in ip_forward(), we need 'rt' to forward skb, until this skb has been forwarded we hold a reference to it in skb, We can use rt->rt_dst safely, It is an ordinary __be32 not a reference.
David Miller
maintainerFrom: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:51:29 +0800
Quoted 11 lines
Quoted 11 lines
From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:26:31 +0800Quoted 2 lines
My question, in
ip_forward()andip_forward_options()rt is there, why not we just use it?Because I'm trying to eliminate all accesses to
rt->rt_dstbecause when I remove the routing cache, routes will be shared. One 'rt' will refer to many specific destination addresses.
Quoted 5 lines
Sorry, I can't understand what you said, can you make it more clear?
I think in
ip_forward(), we need 'rt' to forward skb, until this skb has been forwarded we hold a reference to it in skb, We can usert->rt_dstsafely, It is an ordinary__be32not a reference.
My long term plan is to eliminate cached routes, we will directly use routing table entries instead.
In such a scheme, the member rt->rt_dst will no longer even exist.
This is what I've been working towards for more than a year, it is a slow and very difficult transformation.
If you starting adding rt->rt_dst references back, we are taking steps backwards.
Quoted 12 lines
My long term plan is to eliminate cached routes, we will directly use routing table entries instead.
In such a scheme, the member
rt->rt_dstwill no longer even exist.This is what I've been working towards for more than a year, it is a slow and very difficult transformation.
If you starting adding
rt->rt_dstreferences back, we are taking steps backwards.
Thank you, I got it.
I'll do my best to fix it but without any promise, because i am a kernel newbie :D