A newlink callback may need to identify the rtnetlink endpoint that requested device creation. The source net namespace is already available through struct rtnl_newlink_params, but the sender port ID is not.
Add the sender port ID to struct rtnl_newlink_params and populate it from NETLINK_CB(skb).portid in rtnl_newlink_create. Signed-off-by: Ralf Lici <[email protected]> --- include/net/rtnetlink.h | 2 ++ net/core/rtnetlink.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index ec65a8cebb99..d6844c5593e8 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -75,6 +75,7 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh) * @src_net: Source netns of rtnetlink socket * @link_net: Link netns by IFLA_LINK_NETNSID, NULL if not specified * @peer_net: Peer netns + * @portid: Netlink port ID of the message sender * @tb: IFLA_* attributes * @data: IFLA_INFO_DATA attributes */ @@ -82,6 +83,7 @@ struct rtnl_newlink_params { struct net *src_net; struct net *link_net; struct net *peer_net; + u32 portid; struct nlattr **tb; struct nlattr **data; }; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 6a5e9ace55a0..ed4918a1fc03 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -3846,6 +3846,7 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm, .src_net = sock_net(skb->sk), .link_net = link_net, .peer_net = peer_net, + .portid = NETLINK_CB(skb).portid, .tb = tb, .data = data, }; -- 2.54.0 _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
