addicmp.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (C) 1993-2001 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id: addicmp.c,v 1.8 2002/01/28 06:50:45 darrenr Exp $
*/
#include <ctype.h>
#include "ipf.h"
"routersol", "timex", "paramprob", "timest", "timestrep",
"inforeq", "inforep", "maskreq", "maskrep", "END"
};
/*
* set the icmp field to the correct type if "icmp" word is found
*/
char ***cp;
int linenum;
{
char **t;
int i;
(*cp)++;
if (!**cp)
return -1;
"%d: Invalid icmp-type (%s) specified\n",
return -1;
}
} else {
for (t = icmptypes, i = 0; ; t++, i++) {
if (!*t)
continue;
if (!strcasecmp("END", *t)) {
i = -1;
break;
}
if (!strcasecmp(*t, **cp))
break;
}
if (i == -1) {
"%d: Unknown icmp-type (%s) specified\n",
return -1;
}
}
(*cp)++;
if (!**cp)
return 0;
return 0;
(*cp)++;
"%d: Invalid icmp code (%s) specified\n",
return -1;
}
} else {
if (i == -1) {
"%d: Unknown icmp code (%s) specified\n",
return -1;
}
}
i &= 0xff;
(*cp)++;
return 0;
}