aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee802154/netlink.c')
-rw-r--r--net/ieee802154/netlink.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 8a221737f75c..33137b99e471 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -75,6 +75,39 @@ out:
75 return -ENOBUFS; 75 return -ENOBUFS;
76} 76}
77 77
78struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
79 int flags, u8 req)
80{
81 void *hdr;
82 struct sk_buff *msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
83
84 if (!msg)
85 return NULL;
86
87 hdr = genlmsg_put_reply(msg, info,
88 &nl802154_family, flags, req);
89 if (!hdr) {
90 nlmsg_free(msg);
91 return NULL;
92 }
93
94 return msg;
95}
96
97int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info)
98{
99 /* XXX: nlh is right at the start of msg */
100 void *hdr = genlmsg_data(NLMSG_DATA(msg->data));
101
102 if (genlmsg_end(msg, hdr) < 0)
103 goto out;
104
105 return genlmsg_reply(msg, info);
106out:
107 nlmsg_free(msg);
108 return -ENOBUFS;
109}
110
78int __init ieee802154_nl_init(void) 111int __init ieee802154_nl_init(void)
79{ 112{
80 int rc; 113 int rc;