forked from mirrors/linux
		
	xfrm: Don't accidentally set RTO_ONLINK in decode_session4()
Similar to commit94e2238969("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup. Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits. Found by code inspection, compile tested only. Fixes:4da3089f2b("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									274c224062
								
							
						
					
					
						commit
						23e7b1bfed
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -31,6 +31,7 @@
 | 
				
			||||||
#include <linux/if_tunnel.h>
 | 
					#include <linux/if_tunnel.h>
 | 
				
			||||||
#include <net/dst.h>
 | 
					#include <net/dst.h>
 | 
				
			||||||
#include <net/flow.h>
 | 
					#include <net/flow.h>
 | 
				
			||||||
 | 
					#include <net/inet_ecn.h>
 | 
				
			||||||
#include <net/xfrm.h>
 | 
					#include <net/xfrm.h>
 | 
				
			||||||
#include <net/ip.h>
 | 
					#include <net/ip.h>
 | 
				
			||||||
#include <net/gre.h>
 | 
					#include <net/gre.h>
 | 
				
			||||||
| 
						 | 
					@ -3295,7 +3296,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
 | 
				
			||||||
	fl4->flowi4_proto = iph->protocol;
 | 
						fl4->flowi4_proto = iph->protocol;
 | 
				
			||||||
	fl4->daddr = reverse ? iph->saddr : iph->daddr;
 | 
						fl4->daddr = reverse ? iph->saddr : iph->daddr;
 | 
				
			||||||
	fl4->saddr = reverse ? iph->daddr : iph->saddr;
 | 
						fl4->saddr = reverse ? iph->daddr : iph->saddr;
 | 
				
			||||||
	fl4->flowi4_tos = iph->tos;
 | 
						fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!ip_is_fragment(iph)) {
 | 
						if (!ip_is_fragment(iph)) {
 | 
				
			||||||
		switch (iph->protocol) {
 | 
							switch (iph->protocol) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue