From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 21 18:29:47 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D65F16A416 for ; Thu, 21 Sep 2006 18:29:47 +0000 (UTC) (envelope-from gortaur@gmail.com) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id CAC5543D8E for ; Thu, 21 Sep 2006 18:29:41 +0000 (GMT) (envelope-from gortaur@gmail.com) Received: by nz-out-0102.google.com with SMTP id 13so414637nzn for ; Thu, 21 Sep 2006 11:29:41 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nAhrZMrlfqe2bJGl8aZRMUtbnv+Xt3Ii4F0B2V/aUDeiw6rAd+wLhbnkDjFRR1ayPTJFG+NjQlPJdugwnCUznn0mmB3Dlc4PKMoVFfCBj094i15b9TdpjQi1i4C+6SCgveLjBFbwaTIkGHl91y/3i+je1zQsTgSwuoZclpcbO8o= Received: by 10.65.38.7 with SMTP id q7mr18954345qbj; Thu, 21 Sep 2006 11:29:41 -0700 (PDT) Received: by 10.65.231.16 with HTTP; Thu, 21 Sep 2006 11:29:41 -0700 (PDT) Message-ID: <89b086450609211129n4c74c4feycdbbe53faccf9568@mail.gmail.com> Date: Thu, 21 Sep 2006 21:29:41 +0300 From: "Taras Danko" To: "Robert Watson" In-Reply-To: <20060921180348.S56349@fledge.watson.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <89b086450609200829t2ef4dd9ft13c2051644101ba8@mail.gmail.com> <20060921180348.S56349@fledge.watson.org> Cc: freebsd-hackers@freebsd.org Subject: Re: How to find a certain socket? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Sep 2006 18:29:47 -0000 2006/9/21, Robert Watson : > > > What are you trying to do, exactly? > The idea is the following: I have a module which replaces the "socket" system call with my own "extended" socket syscall which adds some restrictions for "socket" callers. After my module is kldloaded - some processes/users/domains become restricted in creation of some type of TCP/UDP sockets. This part is quite obvious. But I also want to handle the situation when a restricted process has created a sockets _before_ my module was loaded. So I want to close its sockets so the process will have to recreate them passing through my restriction policy this time. > > And the second question: whats the correct way to close the socket which was > > found? > > I'm not sure there's really a "correct" way to go about ripping a socket out > from under an application. tcpkill does the next closest thing, which is to > simulate a RST on the TCP connection and force it to close, which is > propagated up the stack in a way the application will understand. As I understand, RST will take effect only for the client side sockets but the server side "listening" socket still will be alive awaiting for another connections. And I want to be able to close sockets of both server and client types (sure if they were created by my restricted process mentioned above). Taras Danko -- contact me: email: gortaur@gmail.com icq: 166956956