提交 81878d27 编写于 作者: T Thomas Graf 提交者: David S. Miller

[GENL]: Add genlmsg_reply() to simply unicast replies to requests

A generic netlink user has no interest in knowing how to
address the source of the original request.
Signed-off-by: NThomas Graf <tgraf@suug.ch>
Acked-by: NPaul Moore <paul.moore@hp.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3dabc715
...@@ -149,6 +149,16 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) ...@@ -149,6 +149,16 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
return nlmsg_unicast(genl_sock, skb, pid); return nlmsg_unicast(genl_sock, skb, pid);
} }
/**
* genlmsg_reply - reply to a request
* @skb: netlink message to be sent back
* @info: receiver information
*/
static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
{
return genlmsg_unicast(skb, info->snd_pid);
}
/** /**
* gennlmsg_data - head of message payload * gennlmsg_data - head of message payload
* @gnlh: genetlink messsage header * @gnlh: genetlink messsage header
......
...@@ -568,7 +568,7 @@ static int netlbl_cipsov4_list(struct sk_buff *skb, struct genl_info *info) ...@@ -568,7 +568,7 @@ static int netlbl_cipsov4_list(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(ans_skb, data); genlmsg_end(ans_skb, data);
ret_val = genlmsg_unicast(ans_skb, info->snd_pid); ret_val = genlmsg_reply(ans_skb, info);
if (ret_val != 0) if (ret_val != 0)
goto list_failure; goto list_failure;
......
...@@ -390,7 +390,7 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info) ...@@ -390,7 +390,7 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(ans_skb, data); genlmsg_end(ans_skb, data);
ret_val = genlmsg_unicast(ans_skb, info->snd_pid); ret_val = genlmsg_reply(ans_skb, info);
if (ret_val != 0) if (ret_val != 0)
goto listdef_failure; goto listdef_failure;
return 0; return 0;
...@@ -512,7 +512,7 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info) ...@@ -512,7 +512,7 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(ans_skb, data); genlmsg_end(ans_skb, data);
ret_val = genlmsg_unicast(ans_skb, info->snd_pid); ret_val = genlmsg_reply(ans_skb, info);
if (ret_val != 0) if (ret_val != 0)
goto version_failure; goto version_failure;
return 0; return 0;
......
...@@ -160,7 +160,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info) ...@@ -160,7 +160,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(ans_skb, data); genlmsg_end(ans_skb, data);
ret_val = genlmsg_unicast(ans_skb, info->snd_pid); ret_val = genlmsg_reply(ans_skb, info);
if (ret_val != 0) if (ret_val != 0)
goto list_failure; goto list_failure;
return 0; return 0;
......
...@@ -529,7 +529,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) ...@@ -529,7 +529,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
goto errout; goto errout;
} }
err = genlmsg_unicast(msg, info->snd_pid); err = genlmsg_reply(msg, info);
errout: errout:
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册