From owner-freebsd-ipfw@freebsd.org Wed Jun 8 10:58:33 2016 Return-Path: Delivered-To: freebsd-ipfw@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD9F9B6FF6B for ; Wed, 8 Jun 2016 10:58:33 +0000 (UTC) (envelope-from bycn82@gmail.com) Received: from mail-vk0-x243.google.com (mail-vk0-x243.google.com [IPv6:2607:f8b0:400c:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96CBF1295; Wed, 8 Jun 2016 10:58:33 +0000 (UTC) (envelope-from bycn82@gmail.com) Received: by mail-vk0-x243.google.com with SMTP id a126so672671vkb.1; Wed, 08 Jun 2016 03:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=MkIW7hQf7/DN2PUaVvVSRdcp0L6IrPHjUoBb0PUFH7g=; b=oTpZqu/cxUjsWstsXbAuCi3OEmrHVScu0cmSY1kC1o1qyU5VRa4uIGCrIjdR1ZBIO2 nGz+SKCHFSc2NwyAvkdJDnzUev7DZebsRHJhbSo3UV6t9M3d7n249C/c1qXPvrQTL8ox JZZ922MWSOFPXJhUYkQJJ0APb/GpkxVMAI/bawVBs7VpXM7EblzNQClEdIG8iTRZ1PWm hmPUtmqPMW2hkSN29HOafd771doIwB+PQ5woi5AjppUQdTPgqm1pCO8fNhuvzrT96PXf TZZirwshPWQSE+vbkMFsttHLPCAVuIyKmP+aPXCoOfQyTn1vUWL7nT1YdaY0mj6Ix48E llwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=MkIW7hQf7/DN2PUaVvVSRdcp0L6IrPHjUoBb0PUFH7g=; b=ksqqduexeIWGc9DZqugw1AOZbBb+ZEruU8YJ3wInQpc1xMoqulooU6rxjZ+1+3EsPz KUcaLTGIrBWHmyk7zdomtDLkyopv7SZhIGoOSSGVKhRgVhxv0NuB2IAyNO/nfIQi5M8o 3DX60cI39KIZRxtyJig4vIFar5yVH7jkYS1MQxozo+OI9v9IjBk+lmV1r3suzc/t+5ZA Oa0maMTo0Z263rNnS7caTzRvE+ZOaaCCHyHLC/ZF+hB7fOOszPdMvOfVSeo0ipT2/2z5 Qr+gp9auku7eA4MBYrb5j5CWJbeoWuG0rBnQcZbAdVWBGyuNoys2pFuOZgO4rJIBJZ6E pqJw== X-Gm-Message-State: ALyK8tJuWVe6TC+WwY4K/nxK66srhoCRO9DWpAvNVsMqQarik9lT2MUMxbwTrkYeoSRM0Z2l1YpgMkSoejlSsw== X-Received: by 10.31.167.84 with SMTP id q81mr1999292vke.51.1465383512612; Wed, 08 Jun 2016 03:58:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.37.69 with HTTP; Wed, 8 Jun 2016 03:58:32 -0700 (PDT) Reply-To: bycn82@dragonflybsd.org In-Reply-To: <5757F533.8070907@FreeBSD.org> References: <9229d4f7-8466-57b0-c954-117736102bd7@FreeBSD.org> <5755F0D3.9060909@FreeBSD.org> <20160607220136.R15883@sola.nimnet.asn.au> <5757F533.8070907@FreeBSD.org> From: Bill Yuan Date: Wed, 8 Jun 2016 18:58:32 +0800 Message-ID: Subject: Re: IPFW: more "orthogonal? state operations, push into 11? To: "Andrey V. Elsukov" Cc: Ian Smith , Julian Elischer , freebsd-ipfw , Lev Serebryakov , "Alexander V. Chernikov" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 10:58:34 -0000 In my opinion, keep-state == "if this kind of packet come again, we are going to perform the current action" check-state == "did we met this kind of packet before? Yes! then perform that action" so in DragonflyBSD, below commands are implemented to manipulate the "states" ipfw3 state show [rulenum] ipfw3 state add rule rulenum proto src:port dst:port [state-options] ipfw3 state delete rulenum On 8 June 2016 at 18:36, Andrey V. Elsukov wrote: > On 07.06.16 17:31, Ian Smith wrote: > > If your patch does what Lev wanted to achieve with (I thought too many) > > new dynamic rule actions, then I think your simpler solution is better, > > not least because it's far easier to understand for non-Julians :) > > > > Looking from a useability and documentation perspective only - I won't > > even be looking at this code - I have a few thoughts: > > > > Thus far, keep-state and limit seem to be interchangeable options; limit > > rules will need to work the same with respect to named dynamic flows; do > > I assume that you've just started with only keep-state for testing? > > We don't use limit rules at all, so it wasn't implemented. I think it > will not so hard to implement. > > > I think flow names should be specified as an _optional_ parameter, thus: > > > > check-state [name] > > > > keep-state [name] > > > > limit {src-addr | src-port | dst-addr | dst-port} N [name] > > > > where name (maybe flowname, for easier comprehension by man readers?) is > > optional, assigned as 'default' whenever omitted - as well as being for > > backwards ruleset compatibility, which then only needs mentioning once, > > and maybe also put another way in the STATEFUL FIREWALL section. > > > > So a few of the existing example rules with no name could stand, while > > others (see below) append names of OUTBOUND and INBOUND or whatever. > > > > As is, you have > > > > 740 .It Cm check-state Op Ar name | Cm any | Cm default > > > > which in other contexts would mean you have to supply one of 'name' or > > 'any' or 'default' when you don't have to provide one, 'default' being > > assigned otherwise. Otherwise I think this is fairly well described. > > > > Will 'ipfw -[e]d list|show' show the flow names? or the indices? > > It will show the flow name at the end of line. > > > As I pestered Lev about last year, we still need a small example ruleset > > section that actually deals with potentially problematic stateful issues > > with NAT - which I still don't fully understand - beyond descriptions in > > the abstract case; ie an actual working dual- or multi-flow example. > > > > I know these are "just doc" issues of little importance while testing > > working code, and I haven't supplied any patches, so are just FWIW .. > > Will try to implement support for limit rules and update man. Thanks. > > -- > WBR, Andrey V. Elsukov > >