ipfilter userland: Fix branch mismerge

The work to ANSIfy and adjust returns to style(9) resulted in a mismerge
of a stash when ipfilter was moved from contrib to sbin. An older file
replaced WIP at the time, resulting in a regression.

The majority of this work was done in 2018 saved as git stashes within
a git-svn tree and migrated to the git tree. The regression occurred
when the various stashes were sequentially merged to create individual
commits, following the ipfilter move to netpfil and sbin.

Reported by:	jrtc27
Fixes:		2582ae5740
Pointy hat to:	cy
MFC after:	1 month
This commit is contained in:
Cy Schubert 2022-01-03 19:04:04 -08:00
parent 44bc301921
commit a3522837b0

View File

@ -62,8 +62,8 @@ static FILE *cfile = NULL;
* This is called once per filter rule being loaded to emit data structures
* required.
*/
void printc(fr)
frentry_t *fr;
void
printc(frentry_t *fr)
{
u_long *ulp;
char *and;
@ -162,9 +162,8 @@ void printc(fr)
static frgroup_t *groups = NULL;
static void addrule(fp, fr)
FILE *fp;
frentry_t *fr;
static void
addrule(FILE *fp, frentry_t *fr)
{
frentry_t *f, **fpp;
frgroup_t *g;
@ -243,8 +242,8 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n",
}
int intcmp(c1, c2)
const void *c1, *c2;
int
intcmp(const void *c1, const void *c2)
{
const mc_t *i1 = (const mc_t *)c1, *i2 = (const mc_t *)c2;
@ -255,18 +254,15 @@ int intcmp(c1, c2)
}
static void indent(fp, in)
FILE *fp;
int in;
static void
indent(FILE *fp, int in)
{
for (; in; in--)
fputc('\t', fp);
}
static void printeq(fp, var, m, max, v)
FILE *fp;
char *var;
int m, max, v;
static void
printeq(FILE *fp, char *var, int m, int max, int v)
{
if (m == max)
fprintf(fp, "%s == %#x) {\n", var, v);
@ -280,10 +276,8 @@ static void printeq(fp, var, m, max, v)
* m - netmask
* v - required address
*/
static void printipeq(fp, var, fl, m, v)
FILE *fp;
char *var;
int fl, m, v;
static void
printipeq(FILE *fp, char *var, int fl, int m, int v)
{
if (m == 0xffffffff)
fprintf(fp, "%s ", var);
@ -294,10 +288,8 @@ static void printipeq(fp, var, fl, m, v)
}
void emit(num, dir, v, fr)
int num, dir;
void *v;
frentry_t *fr;
void
emit(int num, int dir, void *v, frentry_t *fr)
{
u_int incnt, outcnt;
frgroup_t *g;
@ -346,9 +338,8 @@ void emit(num, dir, v, fr)
}
static void emitheader(grp, incount, outcount)
frgroup_t *grp;
u_int incount, outcount;
static void
emitheader(frgroup_t *grp, u_int incount, u_int outcount)
{
static FILE *fph = NULL;
frgroup_t *g;
@ -401,7 +392,8 @@ extern int ipfrule_remove_out_%s(void));\n",
}
}
static void emittail()
static void
emittail(void)
{
frgroup_t *g;
@ -438,12 +430,9 @@ int ipfrule_remove()\n\
}
static void emitGroup(num, dir, v, fr, group, incount, outcount)
int num, dir;
void *v;
frentry_t *fr;
char *group;
u_int incount, outcount;
static void
emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
u_int incount, u_int outcount)
{
static FILE *fp = NULL;
static int header[2] = { 0, 0 };
@ -956,8 +945,8 @@ static void emitGroup(num, dir, v, fr, group, incount, outcount)
}
void printC(dir)
int dir;
void
printC(int dir)
{
static mc_t *m = NULL;
frgroup_t *g;
@ -979,11 +968,8 @@ void printC(dir)
/*
* Now print out code to implement all of the rules.
*/
static void printCgroup(dir, top, m, group)
int dir;
frentry_t *top;
mc_t *m;
char *group;
static void
printCgroup(int dir, frentry_t *top, mc_t *m, char *group)
{
frentry_t *fr, *fr1;
int i, n, rn;
@ -1229,11 +1215,8 @@ static void printCgroup(dir, top, m, group)
}
}
static void printhooks(fp, in, out, grp)
FILE *fp;
int in;
int out;
frgroup_t *grp;
static void
printhooks(FILE *fp, int in, int out, frgroup_t *grp)
{
frentry_t *fr;
char *group;