2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: ports.c,v 1.9.4.1 2004/12/09 19:41:22 darrenr Exp $
15 * check for possible presence of the port fields in the line
17 int ports(seg
, proto
, pp
, cp
, tp
, linenum
)
27 if (!*seg
|| !**seg
|| !***seg
)
29 if (!strcasecmp(**seg
, "port") && *(*seg
+ 1) && *(*seg
+ 2)) {
31 if (ISALNUM(***seg
) && *(*seg
+ 2)) {
32 if (portnum(**seg
, proto
, pp
, linenum
) == 0)
35 if (!strcmp(**seg
, "<>"))
37 else if (!strcmp(**seg
, "><"))
41 "%d: unknown range operator (%s)\n",
47 fprintf(stderr
, "%d: missing 2nd port value\n",
51 if (portnum(**seg
, proto
, tp
, linenum
) == 0)
53 } else if (!strcmp(**seg
, "=") || !strcasecmp(**seg
, "eq"))
55 else if (!strcmp(**seg
, "!=") || !strcasecmp(**seg
, "ne"))
57 else if (!strcmp(**seg
, "<") || !strcasecmp(**seg
, "lt"))
59 else if (!strcmp(**seg
, ">") || !strcasecmp(**seg
, "gt"))
61 else if (!strcmp(**seg
, "<=") || !strcasecmp(**seg
, "le"))
63 else if (!strcmp(**seg
, ">=") || !strcasecmp(**seg
, "ge"))
66 fprintf(stderr
, "%d: unknown comparator (%s)\n",
70 if (comp
!= FR_OUTRANGE
&& comp
!= FR_INRANGE
) {
72 if (portnum(**seg
, proto
, pp
, linenum
) == 0)