From owner-freebsd-ipfw@FreeBSD.ORG Mon Apr 21 15:14:21 2014 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CCC5BCF; Mon, 21 Apr 2014 15:14:21 +0000 (UTC) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AEDD11D6; Mon, 21 Apr 2014 15:14:21 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id y10so3748804pdj.22 for ; Mon, 21 Apr 2014 08:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=1BA1/rQade+9J8tVbftl3ZroO/6H15oIevY86aBaINI=; b=tc0hebMBtwu0ldMdfRJnFe0D5F4Pjbpw3Xw5QTIU1Ejpai4xaaf9qQ58mav7DO1Dx8 4tJ/1tcrFOrDEcf3RWHjFLRQUfkFeBXJcDAkULQR/Xp/2qhODK3VS36SXf0jvqROI5Qc NeLj6wQmjYn0us9snqUH80YVCrfmDzNRh6nkgRh4x1ZY5d+py0wJ+aVwPrlnb7AeG7b/ 4PmF//gZfdJviEX+EiijEujmr6mM72wGdOQ5F498eDoaDMcdaHhQ8tn93PXgeyZsv65J SW513rkot044DscmqIm6tXyKKui6xr0XPBES8xXJu7MGWg8E3c5cW+iNgf/NAarrlD3O MEwg== X-Received: by 10.67.2.34 with SMTP id bl2mr38806618pad.58.1398093260963; Mon, 21 Apr 2014 08:14:20 -0700 (PDT) Received: from [192.168.1.100] ([183.90.37.157]) by mx.google.com with ESMTPSA id ff4sm187710194pad.24.2014.04.21.08.14.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 08:14:20 -0700 (PDT) Message-ID: <535535C7.1050707@gmail.com> Date: Mon, 21 Apr 2014 23:14:15 +0800 From: bycn82 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0 MIME-Version: 1.0 To: "Andrey V. Elsukov" Subject: Re: how does it pass in the rule sets References: <5352298C.2090902@gmail.com> <53552C83.7060008@FreeBSD.org> In-Reply-To: <53552C83.7060008@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: freebsd-ipfw@freebsd.org X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2014 15:14:21 -0000 On 4/21/14 22:34, Andrey V. Elsukov wrote: > On 19.04.2014 11:45, bycn82 wrote: >> Hi, >> can someone help to explain how does the user land command `ipfw` pass >> the rule set into the hook function in the kernel? I assume that it must >> be hardcoded in somewhere, but I did not find it yet. > ipfw(8) uses raw socket and setsockopt(2)/getsockopt(2) functions to > interact with kernel. In particular, do_cmd() function from ipfw2.c does it. > Thanks very much, Actually I saw the source already, the ipfw_ctl() method. I would like to call it as "an event handler" But why it will triggered? where are the code to register this method as listener? Sorry for using Java terminologies ;)