[NETLINK]: Introduce NLMSG_NEW macro to better handle netlink flags

Introduces a new macro NLMSG_NEW which extends NLMSG_PUT but takes
a flags argument. NLMSG_PUT stays there for compatibility but now
calls NLMSG_NEW with flags == 0. NLMSG_PUT_ANSWER is renamed to
NLMSG_NEW_ANSWER which now also takes a flags argument.

Also converts the users of NLMSG_PUT_ANSWER to use NLMSG_NEW_ANSWER
and fixes the two direct users of __nlmsg_put to either provide
the flags or use NLMSG_NEW(_ANSWER).

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Graf
2005-06-18 22:53:48 -07:00
committed by David S. Miller
parent af0d114176
commit 1797754ea7
3 changed files with 19 additions and 14 deletions

View File

@ -1590,8 +1590,8 @@ static int neightbl_fill_info(struct neigh_table *tbl, struct sk_buff *skb,
struct nlmsghdr *nlh;
struct ndtmsg *ndtmsg;
nlh = NLMSG_PUT_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg));
nlh->nlmsg_flags |= NLM_F_MULTI;
nlh = NLMSG_NEW_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg),
NLM_F_MULTI);
ndtmsg = NLMSG_DATA(nlh);
@ -1675,8 +1675,8 @@ static int neightbl_fill_param_info(struct neigh_table *tbl,
struct ndtmsg *ndtmsg;
struct nlmsghdr *nlh;
nlh = NLMSG_PUT_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg));
nlh->nlmsg_flags |= NLM_F_MULTI;
nlh = NLMSG_NEW_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg),
NLM_F_MULTI);
ndtmsg = NLMSG_DATA(nlh);