Skip to contentSkip to conversation

ipv4: fix for ip_options_rcv_srr() daddr update.

PATCH Applied Li Wei 2 participants 9 messages Nov 9, 2011 – Nov 15, 2011

Subsystems (3)
lore
Share & tools
lore

Li Wei

author
#0 lore raw

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
index ec93335..05d20cc 100644
@@ -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
maintainer Applied
#1 lore raw

From: Li Wei <[email protected]>
Date: Wed, 09 Nov 2011 15:39:28 +0800

Quoted 5 lines

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.

Applied, thank you.

author
#2 lore raw
Quoted 12 lines

From: Li Wei <[email protected]>
Date: Wed, 09 Nov 2011 15:39:28 +0800

Quoted 5 lines

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.

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.

maintainer
#3 lore raw

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

An alternative is to store the calculated destination address somewhere in the IPCB(skb).

author
#4 lore raw
Quoted 8 lines

From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 13:40:45 +0800

Quoted 5 lines

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.

Quoted 7 lines
Quoted 2 lines

It seems we need rt->rt_dst in ip_forward_options() and ip_forward() instead of iph->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?

maintainer
#5 lore raw

From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:26:31 +0800

Quoted 2 lines

My question, in ip_forward() and ip_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.

author
#6 lore raw
Quoted 11 lines

From: Li Wei <[email protected]>
Date: Tue, 15 Nov 2011 15:26:31 +0800

Quoted 2 lines

My question, in ip_forward() and ip_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.

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.

maintainer
#7 lore raw

From: 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 +0800

Quoted 2 lines

My question, in ip_forward() and ip_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 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 use rt->rt_dst safely, It is an ordinary __be32 not 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.

author
#8 lore raw
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_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.

Thank you, I got it.

I'll do my best to fix it but without any promise, because i am a kernel newbie :D