ipft_tx.c (153881) | ipft_tx.c (161357) |
---|---|
1/* $FreeBSD: head/contrib/ipfilter/lib/ipft_tx.c 153881 2005-12-30 11:52:26Z guido $ */ | 1/* $FreeBSD: head/contrib/ipfilter/lib/ipft_tx.c 161357 2006-08-16 12:23:02Z guido $ */ |
2 3/* 4 * Copyright (C) 1995-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * | 2 3/* 4 * Copyright (C) 1995-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * |
8 * $Id: ipft_tx.c,v 1.15.2.6 2005/12/04 10:07:22 darrenr Exp $ | 8 * $Id: ipft_tx.c,v 1.15.2.7 2005/12/18 14:53:39 darrenr Exp $ |
9 */ 10#if !defined(lint) 11static const char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed"; | 9 */ 10#if !defined(lint) 11static const char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed"; |
12static const char rcsid[] = "@(#)$Id: ipft_tx.c,v 1.15.2.6 2005/12/04 10:07:22 darrenr Exp $"; | 12static const char rcsid[] = "@(#)$Id: ipft_tx.c,v 1.15.2.7 2005/12/18 14:53:39 darrenr Exp $"; |
13#endif 14 15#include <ctype.h> 16 17#include "ipf.h" 18#include "ipt.h" 19 20#ifndef linux --- 49 unchanged lines hidden (view full) --- 70 71/* 72 * find the port number given by the name, either from getservbyname() or 73 * straight atoi() 74 */ 75static u_short tx_portnum(name) 76char *name; 77{ | 13#endif 14 15#include <ctype.h> 16 17#include "ipf.h" 18#include "ipt.h" 19 20#ifndef linux --- 49 unchanged lines hidden (view full) --- 70 71/* 72 * find the port number given by the name, either from getservbyname() or 73 * straight atoi() 74 */ 75static u_short tx_portnum(name) 76char *name; 77{ |
78 struct servent *sp, *sp2; 79 u_short p1 = 0; | 78 struct servent *sp; |
80 81 if (ISDIGIT(*name)) 82 return (u_short)atoi(name); | 79 80 if (ISDIGIT(*name)) 81 return (u_short)atoi(name); |
83 if (!tx_proto) 84 tx_proto = "tcp/udp"; 85 if (strcasecmp(tx_proto, "tcp/udp")) { 86 sp = getservbyname(name, tx_proto); 87 if (sp) 88 return ntohs(sp->s_port); 89 (void) fprintf(stderr, "unknown service \"%s\".\n", name); 90 return 0; 91 } 92 sp = getservbyname(name, "tcp"); | 82 sp = getservbyname(name, tx_proto); |
93 if (sp) | 83 if (sp) |
94 p1 = sp->s_port; 95 sp2 = getservbyname(name, "udp"); 96 if (!sp || !sp2) { 97 (void) fprintf(stderr, "unknown tcp/udp service \"%s\".\n", 98 name); 99 return 0; 100 } 101 if (p1 != sp2->s_port) { 102 (void) fprintf(stderr, "%s %d/tcp is a different port to ", 103 name, p1); 104 (void) fprintf(stderr, "%s %d/udp\n", name, sp->s_port); 105 return 0; 106 } 107 return ntohs(p1); | 84 return ntohs(sp->s_port); 85 (void) fprintf(stderr, "unknown service \"%s\".\n", name); 86 return 0; |
108} 109 110 111char *tx_icmptypes[] = { 112 "echorep", (char *)NULL, (char *)NULL, "unreach", "squench", 113 "redir", (char *)NULL, (char *)NULL, "echo", "routerad", 114 "routersol", "timex", "paramprob", "timest", "timestrep", 115 "inforeq", "inforep", "maskreq", "maskrep", "END" --- 223 unchanged lines hidden --- | 87} 88 89 90char *tx_icmptypes[] = { 91 "echorep", (char *)NULL, (char *)NULL, "unreach", "squench", 92 "redir", (char *)NULL, (char *)NULL, "echo", "routerad", 93 "routersol", "timex", "paramprob", "timest", "timestrep", 94 "inforeq", "inforep", "maskreq", "maskrep", "END" --- 223 unchanged lines hidden --- |