From owner-freebsd-ipfw@freebsd.org Wed Jun 6 18:01:00 2018 Return-Path: Delivered-To: freebsd-ipfw@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26A86FDCAA4 for ; Wed, 6 Jun 2018 18:01:00 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (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 7F8C77F6BC for ; Wed, 6 Jun 2018 18:00:59 +0000 (UTC) (envelope-from fjwcash@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id v135-v6so10475784lfa.9 for ; Wed, 06 Jun 2018 11:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9YfAz3+vnW2cIhuqlR4hfdCOA9L/RWoukLPx2v6bq9I=; b=MaT3iS/qCBlDcgathAyYHzYsE89XKnjn8cieb8xuIqUljdrBz4AXa7RnyY2uKcKvjU dtpdyn8nHdiUsoQZ1pCC3mEcLib9St+eJc2ciUY9uXFitUI0VWPvosIZG+Yp+Lw+AnRW +0w1uCKZnf0m/2mlUVOwvCy6b5hgYeIQRYVREG53WifAOFY7pPn6g1Xyfd1h3lawZxOm aSYlZaH98YJWxj9ANHWChFlBRbcnu4bWG0hvC98quJ1nyOhmifR/uLvVrsHdmXRjvTCj uB4m8C66c1JQQ54QnP3tSD0DRcEKcqgH/+eYcqscPK2Ons+1g7tFZJvUUuX2sT1qXc7/ ABMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9YfAz3+vnW2cIhuqlR4hfdCOA9L/RWoukLPx2v6bq9I=; b=sSpDMPao5DbJdagcHNRxX1IDwIs/NJRC6lJOKIYuCTOPJhAUWNc4xbEeI426+UhCoZ heN4sqTNkHSyE6frFN+/lAcl/hbsSgm3hqAYJrWoUThJEgEIQQJaAdkTbiL6PiwmPJCF uTuMOFXPIzfmKLpKnUUsjqj6679fdobHz8KRmU+6QS8M3XT2x0OaqLpYocXDazweozZd RnmOlTVg/YqrfzY5ZnBCqeyB9ToSl6UpW0VCWgjYImZqPxwJfb/547HjaOwjjzslpcmF xEXJQL/G+Pgt2zOkklhuvrjjp9tIvauih7LYAPsJg2gtVCp2VsasUm0pZlGu+f8PODoO 8xRQ== X-Gm-Message-State: APt69E1fJR2j4WWatYJ66haGF/rlgcOEC1m2c8HNHN30ViwcHSDW4GGd EBvMcn1H2gtNNc1uDORGdWau56fvtOZPFVOeYpw= X-Google-Smtp-Source: ADUXVKK0IncRaF2P0BFdGfJAmPm+/qX+9PmJ7vQXNE2DyBiILo6Whz5PqAZ9t/HR1WAqynvltULpLnnA4nVEIsGp0kw= X-Received: by 2002:a2e:202:: with SMTP id 2-v6mr2907403ljc.117.1528308057810; Wed, 06 Jun 2018 11:00:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:1114:0:0:0:0:0 with HTTP; Wed, 6 Jun 2018 11:00:57 -0700 (PDT) In-Reply-To: <001001d3fdbc$d804d270$880e7750$@gmail.com> References: <001001d3fdbc$d804d270$880e7750$@gmail.com> From: Freddie Cash Date: Wed, 6 Jun 2018 11:00:57 -0700 Message-ID: Subject: Re: Matching rules on ip4/ip6 with udp/tcp To: Dries Michiels Cc: freebsd-ipfw@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2018 18:01:00 -0000 On Wed, Jun 6, 2018 at 10:36 AM, Dries Michiels wrote: > Is there are way to match packets specifying both network generation ip4 = or > ip6 together with the protocol such as tcp or udp? > > Currently the following rules are possible (examples): > > ipfw add 1 allow udp from any to me 22 in recv em0 > > ipfw add 1 allow ip4 from any to me 22 in recv em0 > > > The following rule is not possible (example): > > ipfw add 1 allow ip4 udp from any to me 22 in recv em0 > > > Is there a workaround for this or some reason why this hasn't been > implemented? > > Or do I simply not have the rule syntax right. > =E2=80=8BOne of the following pairs should do what you want, although the m= an page is a little hard to parse on some of it, so they may not actually work:=E2= =80=8B =E2=80=8Bipfw add 1 allow from any to me in recv em0 proto ip4 dst-port 22= =E2=80=8B =E2=80=8Bipfw add 1 allow from any to me in recv em0 proto ip6 dst-port 22= =E2=80=8B =E2=80=8Bipfw add 1 allow udp from any to me in recv em0 proto ip4 dst-port= 22 =E2=80=8Bipfw add 1 allow udp from any to me in recv em0 proto ip6 dst-port= 22 Basically, there's a giant section in the man page about the "options" section of the rule (what goes after the interface). You can do just about anything within that section, including a lot of what could be done in the "protocol" and "source address" and "destination address" sections. =E2=80=8B-- Freddie Cash fjwcash@gmail.com