Subject: Re: [PATCH iproute2 WIP] ifstat: use new RTM_GETSTATS api

From: Stephen Hemminger <[email-masked]>
Date: Wed, 20 Apr 2016 11:53:47 -0700

On Wed, 20 Apr 2016 09:16:15 -0700
Roopa Prabhu <[email-masked]> wrote:

> +int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int family, int type,
> +				   __u32 filt_mask)
> +{
> +	struct {
> +		struct nlmsghdr nlh;
> +		struct if_stats_msg ifsm;
> +	} req;

Please use C99 initialization instead of memset in new code.

> +	int err;
> +
> +	memset(&req, 0, sizeof(req));
> +	req.nlh.nlmsg_len = sizeof(req);
> +	req.nlh.nlmsg_type = type;
> +	req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
> +	req.nlh.nlmsg_pid = 0;
> +	req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
> +	req.ifsm.family = family;
> +	req.ifsm.filter_mask = filt_mask;
> +
> +	err = send(rth->fd, (void*)&req, sizeof(req), 0);
> +
> +	return err;

Why not just:
        return send(rth->fd, &req, sizoef(req), 0);

> +}