mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	rtnetlink: Honour NLM_F_ECHO flag in rtnl_newlink_create
This patch pass the netlink header message in rtnl_newlink_create() to the new updated rtnl_configure_link(), so that the kernel could reply unicast when userspace set NLM_F_ECHO flag to request the new created interface info. Suggested-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									77f4aa9a2a
								
							
						
					
					
						commit
						d88e136cab
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -3312,11 +3312,13 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
 | 
			
		|||
 | 
			
		||||
static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
 | 
			
		||||
			       const struct rtnl_link_ops *ops,
 | 
			
		||||
			       const struct nlmsghdr *nlh,
 | 
			
		||||
			       struct nlattr **tb, struct nlattr **data,
 | 
			
		||||
			       struct netlink_ext_ack *extack)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char name_assign_type = NET_NAME_USER;
 | 
			
		||||
	struct net *net = sock_net(skb->sk);
 | 
			
		||||
	u32 portid = NETLINK_CB(skb).portid;
 | 
			
		||||
	struct net *dest_net, *link_net;
 | 
			
		||||
	struct net_device *dev;
 | 
			
		||||
	char ifname[IFNAMSIZ];
 | 
			
		||||
| 
						 | 
				
			
			@ -3370,7 +3372,7 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
 | 
			
		|||
		goto out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = rtnl_configure_link(dev, ifm, 0, NULL);
 | 
			
		||||
	err = rtnl_configure_link(dev, ifm, portid, nlh);
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		goto out_unregister;
 | 
			
		||||
	if (link_net) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3579,7 +3581,7 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
 | 
			
		|||
		return -EOPNOTSUPP;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return rtnl_newlink_create(skb, ifm, ops, tb, data, extack);
 | 
			
		||||
	return rtnl_newlink_create(skb, ifm, ops, nlh, tb, data, extack);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue