[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3176866b-3e8d-4669-796f-8292d68a5511@cumulusnetworks.com>
Date: Sat, 8 Apr 2017 15:07:04 -0400
From: David Ahern <dsa@...ulusnetworks.com>
To: Johannes Berg <johannes@...solutions.net>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Cc: pablo@...filter.org, Jamal Hadi Salim <jhs@...atatu.com>,
Jiri Benc <jbenc@...hat.com>, jiri@...nulli.us,
Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH v2 3/5] netlink: allow sending extended ACK with cookie on
success
since a v3 is coming another small cleanup ...
On 4/8/17 2:34 PM, Johannes Berg wrote:
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index c74f56a4fcf1..98e55a59c97e 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -2336,20 +2339,27 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
> !(nlk->flags & NETLINK_F_CAP_ACK) ? nlh->nlmsg_len
> : sizeof(*nlh));
>
> - if (err && nlk->flags & NETLINK_F_EXT_ACK && extack) {
> - if (extack->_msg)
> - WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG,
> - extack->_msg));
> - if (extack->bad_attr &&
> - !WARN_ON((u8 *)extack->bad_attr < in_skb->data ||
> - (u8 *)extack->bad_attr >= in_skb->data +
> - in_skb->len))
> - WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
> - (u8 *)extack->bad_attr -
> - in_skb->data));
> - if (extack->missing_attr)
> - WARN_ON(nla_put_u16(skb, NLMSGERR_ATTR_ATTR,
> - extack->missing_attr));
> + if (nlk->flags & NETLINK_F_EXT_ACK) {
> + if (err && extack) {
push the extack into the flags if check
> + if (extack->_msg)
> + WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG,
> + extack->_msg));
> + if (extack->bad_attr &&
> + !WARN_ON((u8 *)extack->bad_attr < in_skb->data ||
> + (u8 *)extack->bad_attr >= in_skb->data +
> + in_skb->len))
> + WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
> + (u8 *)extack->bad_attr -
> + in_skb->data));
> + if (extack->missing_attr)
> + WARN_ON(nla_put_u16(skb, NLMSGERR_ATTR_ATTR,
> + extack->missing_attr));
> + } else if (!err && extack) {
and here too
> + if (extack->cookie_len)
> + WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE,
> + extack->cookie_len,
> + extack->cookie));
> + }
Powered by blists - more mailing lists