neigh: use tbl->family to distinguish ipv4 from ipv6
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
				
					committed by
					
						 David S. Miller
						David S. Miller
					
				
			
			
				
	
			
			
			
						parent
						
							cb5b09c17f
						
					
				
				
					commit
					73af614aed
				
			| @@ -2947,12 +2947,13 @@ static struct neigh_sysctl_table { | ||||
| }; | ||||
|  | ||||
| int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | ||||
| 			  char *p_name, proc_handler *handler) | ||||
| 			  proc_handler *handler) | ||||
| { | ||||
| 	int i; | ||||
| 	struct neigh_sysctl_table *t; | ||||
| 	const char *dev_name_source; | ||||
| 	char neigh_path[ sizeof("net//neigh/") + IFNAMSIZ + IFNAMSIZ ]; | ||||
| 	char *p_name; | ||||
|  | ||||
| 	t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL); | ||||
| 	if (!t) | ||||
| @@ -2991,6 +2992,17 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | ||||
| 	if (neigh_parms_net(p)->user_ns != &init_user_ns) | ||||
| 		t->neigh_vars[0].procname = NULL; | ||||
|  | ||||
| 	switch (neigh_parms_family(p)) { | ||||
| 	case AF_INET: | ||||
| 	      p_name = "ipv4"; | ||||
| 	      break; | ||||
| 	case AF_INET6: | ||||
| 	      p_name = "ipv6"; | ||||
| 	      break; | ||||
| 	default: | ||||
| 	      BUG(); | ||||
| 	} | ||||
|  | ||||
| 	snprintf(neigh_path, sizeof(neigh_path), "net/%s/neigh/%s", | ||||
| 		p_name, dev_name_source); | ||||
| 	t->sysctl_header = | ||||
|   | ||||
		Reference in New Issue
	
	Block a user