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