Subject: Re: [iproute PATCH v3 2/2] ss: support closing inet sockets via SOCK_DESTROY.

From: Stephen Hemminger <[email-masked]>
Date: Wed, 30 Dec 2015 12:34:14 -0800

On Tue, 22 Dec 2015 17:31:34 +0900
Lorenzo Colitti <[email-masked]> wrote:

>  
> +static int kill_inet_sock(const struct sockaddr_nl *addr,
> +		struct nlmsghdr *h, void *arg)
> +{
> +	struct inet_diag_msg *d = NLMSG_DATA(h);
> +	struct inet_diag_arg *diag_arg = arg;
> +	struct rtnl_handle *rth = diag_arg->rth;
> +	DIAG_REQUEST(req, struct inet_diag_req_v2 r);
> +
> +	req.nlh.nlmsg_type = SOCK_DESTROY;
> +	req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
> +	req.nlh.nlmsg_seq = ++rth->seq;
> +	req.r.sdiag_family = d->idiag_family;
> +	req.r.sdiag_protocol = diag_arg->protocol;
> +	req.r.id = d->id;
> +
> +	return rtnl_send_check_ack(rth, &req.nlh, req.nlh.nlmsg_len, 1);

Just use rtnl_talk() instead, it does request/reply.