forked from mirrors/linux
		
	neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit
Commitcd9ff4de01changed the key for IFF_POINTOPOINT devices to INADDR_ANY but neigh_xmit which is used for MPLS encapsulations was not updated to use the altered key. The result is that every packet Tx does a lookup on the gateway address which does not find an entry, a new one is created only to find the existing one in the table right before the insert since arp_constructor was updated to reset the primary key. This is seen in the allocs and destroys counters: ip -s -4 ntable show | head -10 | grep alloc which increase for each packet showing the unnecessary overhread. Fix by having neigh_xmit use __ipv4_neigh_lookup_noref for NEIGH_ARP_TABLE. Fixes:cd9ff4de01("ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY") Reported-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: David Ahern <dsahern@gmail.com> Tested-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									64c6f4bbca
								
							
						
					
					
						commit
						4b2a2bfeb3
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -31,6 +31,7 @@
 | 
				
			||||||
#include <linux/times.h>
 | 
					#include <linux/times.h>
 | 
				
			||||||
#include <net/net_namespace.h>
 | 
					#include <net/net_namespace.h>
 | 
				
			||||||
#include <net/neighbour.h>
 | 
					#include <net/neighbour.h>
 | 
				
			||||||
 | 
					#include <net/arp.h>
 | 
				
			||||||
#include <net/dst.h>
 | 
					#include <net/dst.h>
 | 
				
			||||||
#include <net/sock.h>
 | 
					#include <net/sock.h>
 | 
				
			||||||
#include <net/netevent.h>
 | 
					#include <net/netevent.h>
 | 
				
			||||||
| 
						 | 
					@ -2984,7 +2985,13 @@ int neigh_xmit(int index, struct net_device *dev,
 | 
				
			||||||
		if (!tbl)
 | 
							if (!tbl)
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
		rcu_read_lock_bh();
 | 
							rcu_read_lock_bh();
 | 
				
			||||||
 | 
							if (index == NEIGH_ARP_TABLE) {
 | 
				
			||||||
 | 
								u32 key = *((u32 *)addr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								neigh = __ipv4_neigh_lookup_noref(dev, key);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			neigh = __neigh_lookup_noref(tbl, addr, dev);
 | 
								neigh = __neigh_lookup_noref(tbl, addr, dev);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if (!neigh)
 | 
							if (!neigh)
 | 
				
			||||||
			neigh = __neigh_create(tbl, addr, dev, false);
 | 
								neigh = __neigh_create(tbl, addr, dev, false);
 | 
				
			||||||
		err = PTR_ERR(neigh);
 | 
							err = PTR_ERR(neigh);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue