From owner-svn-src-user@FreeBSD.ORG Sat Jan 3 14:51:50 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 256C51065673; Sat, 3 Jan 2009 14:51:50 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 145418FC19; Sat, 3 Jan 2009 14:51:50 +0000 (UTC) (envelope-from piso@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n03Epnae030647; Sat, 3 Jan 2009 14:51:49 GMT (envelope-from piso@svn.freebsd.org) Received: (from piso@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n03EpnPp030645; Sat, 3 Jan 2009 14:51:49 GMT (envelope-from piso@svn.freebsd.org) Message-Id: <200901031451.n03EpnPp030645@svn.freebsd.org> From: Paolo Pisati Date: Sat, 3 Jan 2009 14:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186723 - user/piso/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jan 2009 14:51:50 -0000 Author: piso Date: Sat Jan 3 14:51:49 2009 New Revision: 186723 URL: http://svn.freebsd.org/changeset/base/186723 Log: -get rid of #ifdef ALIAS_SCTP -style Modified: user/piso/sbin/ipfw/ipfw2.c Modified: user/piso/sbin/ipfw/ipfw2.c ============================================================================== --- user/piso/sbin/ipfw/ipfw2.c Sat Jan 3 14:33:48 2009 (r186722) +++ user/piso/sbin/ipfw/ipfw2.c Sat Jan 3 14:51:49 2009 (r186723) @@ -48,7 +48,6 @@ #include #define IPFW_INTERNAL /* Access to protected structures in ip_fw.h. */ -#define _ALIAS_SCTP /*Using alias_sctp*/ #include #include @@ -3505,13 +3504,9 @@ StrToProto (const char* str) if (!strcmp (str, "udp")) return IPPROTO_UDP; -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ if (!strcmp (str, "sctp")) return IPPROTO_SCTP; errx (EX_DATAERR, "unknown protocol %s. Expected sctp, tcp or udp", str); -#else - errx (EX_DATAERR, "unknown protocol %s. Expected tcp or udp", str); -#endif } static int @@ -3687,29 +3682,27 @@ setup_redir_port(char *spool_buf, int le strncpy(tmp_spool_buf, *av, strlen(*av)+1); lsnat = 1; } else { -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - /* - * The sctp nat does not allow the port numbers to be mapped to new port numbers - * Therefore, no ports are to be specified in the target port field - */ - if (r->proto == IPPROTO_SCTP) { - if (strchr (*av, ':')) - errx(EX_DATAERR, "redirect_port:" - "port numbers do not change in sctp, so do not specify them as part of the target"); - else - StrToAddr(*av, &r->laddr); - } else { -#endif /*Using alias_sctp*/ - if (StrToAddrAndPortRange (*av, &r->laddr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); + /* + * The sctp nat does not allow the port numbers to be mapped to + * new port numbers. Therefore, no ports are to be specified + * in the target port field. + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (*av, ':')) + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in sctp, so do not " + "specify them as part of the target"); + else + StrToAddr(*av, &r->laddr); + } else { + if (StrToAddrAndPortRange (*av, &r->laddr, protoName, + &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); - r->lport = GETLOPORT(portRange); - numLocalPorts = GETNUMPORTS(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - } -#endif /*Using alias_sctp*/ + r->lport = GETLOPORT(portRange); + numLocalPorts = GETNUMPORTS(portRange); + } } INC_ARGCV(); @@ -3733,12 +3726,10 @@ setup_redir_port(char *spool_buf, int le } r->pport = GETLOPORT(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ if (r->proto == IPPROTO_SCTP) { /* so the logic below still works */ - numLocalPorts = GETNUMPORTS(portRange); - r->lport = r->pport; + numLocalPorts = GETNUMPORTS(portRange); + r->lport = r->pport; } -#endif /*Using alias_sctp*/ r->pport_cnt = GETNUMPORTS(portRange); INC_ARGCV(); @@ -3794,33 +3785,31 @@ setup_redir_port(char *spool_buf, int le goto nospace; len -= SOF_SPOOL; space += SOF_SPOOL; - -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - /* - * The sctp nat does not allow the port numbers to be mapped to new port numbers - * Therefore, no ports are to be specified in the target port field - */ - if (r->proto == IPPROTO_SCTP) { - if (strchr (sep, ':')) { - errx(EX_DATAERR, "redirect_port:" - "port numbers do not change in sctp, so do not specify them as part of the target"); - } else { - StrToAddr(sep, &tmp->addr); - tmp->port = r->pport; - } - } else { -#endif /*Using alias_sctp*/ - if (StrToAddrAndPortRange(sep, &tmp->addr, protoName, - &portRange) != 0) - errx(EX_DATAERR, "redirect_port:" - "invalid local port range"); - if (GETNUMPORTS(portRange) != 1) - errx(EX_DATAERR, "redirect_port: local port" - "must be single in this context"); - tmp->port = GETLOPORT(portRange); -#ifdef _ALIAS_SCTP /*Using alias_sctp*/ - } -#endif /*Using alias_sctp*/ + /* + * The sctp nat does not allow the port numbers to be mapped to new port numbers + * Therefore, no ports are to be specified in the target port field + */ + if (r->proto == IPPROTO_SCTP) { + if (strchr (sep, ':')) { + errx(EX_DATAERR, "redirect_port:" + "port numbers do not change in " + "sctp, so do not specify them as " + "part of the target"); + } else { + StrToAddr(sep, &tmp->addr); + tmp->port = r->pport; + } + } else { + if (StrToAddrAndPortRange(sep, &tmp->addr, + protoName, &portRange) != 0) + errx(EX_DATAERR, "redirect_port:" + "invalid local port range"); + if (GETNUMPORTS(portRange) != 1) + errx(EX_DATAERR, "redirect_port: " + "local port must be single in " + "this context"); + tmp->port = GETLOPORT(portRange); + } r->spool_cnt++; /* Point to the next possible cfg_spool. */ spool_buf = &spool_buf[SOF_SPOOL];