diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 6694eafc233741..357eda1df51f8d 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -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 len, 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 len, } 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 len, 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; + /* + * 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); } - } 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*/ r->spool_cnt++; /* Point to the next possible cfg_spool. */ spool_buf = &spool_buf[SOF_SPOOL];