lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1447816359.22599.129.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Tue, 17 Nov 2015 19:12:39 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Lorenzo Colitti <lorenzo@...gle.com>
Cc:	netdev@...r.kernel.org, edumazet@...gle.com, ek@...gle.com,
	maze@...gle.com, dtor@...gle.com
Subject: Re: [ss PATCH 2/2] ss: support closing inet sockets via SOCK_DIAG.

On Wed, 2015-11-18 at 10:52 +0900, Lorenzo Colitti wrote:
>  
> +static int kill_inet_sock(const struct sockaddr_nl *addr,
> +		struct nlmsghdr *h, void *arg)
> +{
> +	struct rtnl_handle rth;
> +	if (rtnl_open_byproto(&rth, 0, NETLINK_SOCK_DIAG))
> +		return -1;
> +
> +	struct inet_diag_arg *diag_arg = arg;
> +	struct inet_diag_msg *d = NLMSG_DATA(h);
> +	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.r.sdiag_family = d->idiag_family;
> +	req.r.sdiag_protocol = diag_arg->protocol;
> +	req.r.id = d->id;
> +
> +	int err = rtnl_talk(&rth, &req.nlh, NULL, 0);
> +	rtnl_close(&rth);
> +	return err;
> +}


1) Please do not mix variables and code.

2) opening/closing a control socket for every killed TCP socket is going
to consume a lot of cpu cycles.

 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ