From owner-freebsd-net@FreeBSD.ORG Thu Jun 23 08:06:19 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2313216A41C for ; Thu, 23 Jun 2005 08:06:19 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2B7043D58 for ; Thu, 23 Jun 2005 08:06:18 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id j5N86ID3009311; Thu, 23 Jun 2005 01:06:18 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id j5N86IjM009310; Thu, 23 Jun 2005 01:06:18 -0700 (PDT) (envelope-from rizzo) Date: Thu, 23 Jun 2005 01:06:18 -0700 From: Luigi Rizzo To: Ari Suutari Message-ID: <20050623010618.B7580@xorpc.icir.org> References: <42B7B352.8040806@suutari.iki.fi> <42BA6A22.6030506@suutari.iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <42BA6A22.6030506@suutari.iki.fi>; from ari@suutari.iki.fi on Thu, Jun 23, 2005 at 10:52:02AM +0300 Cc: freebsd-net@freebsd.org Subject: Re: Policy routing idea (Was: ipfw: Would it be possible to continue processing rest of rules after match ?) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2005 08:06:19 -0000 On Thu, Jun 23, 2005 at 10:52:02AM +0300, Ari Suutari wrote: > Hi, > > The patches which implement both > "ipfw setnexthop" and "ipfw .... defaultroute" are at: look reasonable, but i would like to reuse the existing 'forward' code a lot more, to avoid duplication and inconsistencies should we apply fixes/changes to that in the future. E.g. > http://www.suutari.iki.fi/freebsd/ipfw-nexthop.patch for the chunk at --- 2951,2987 ---- i think it would be better to reuse the 'case TOK_FORWARD', by changing the opcode and messages according to the actual command. BTW for the 'setnexthop', the port number does not really make much sense... though it can be useful as a degenerate 'nexthop' case to forward to a local port. > http://www.suutari.iki.fi/freebsd/netinet-nexthop.patch here too i would reuse the existing code more, e.g. in ipfw_log() put 'case O_SETNEXTHOP' next to case 'O_FORWARD_IP' and replace the string "Forward" in the first snprintf() with "%s" and an additional argument cmd->opcode == O_FORWARD_IP ? "Forward" : "SetNextHop" Same in the action part at --- 2474,2490 ----, just reuse the O_FORWARD case and end the block with if (cmd->opcode == O_FORWARD_IP) goto done; else goto next_rule; and the check for instruction format --- 3055,3069 ---- can just reuse the O_FORWARD_IP code with no modifications. (btw do we still have it under #ifdef IPFIREWALL_FORWARD ?) thanks luigi > These are against 5.4-RELEASE - if that causes > too much trouble I can try to generate them against > -current. > > I have tested these in lab environment, but not in production > use. However, I woudn't expect much problems, since these > features use much existing code. > > Ari S. > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"