Skip to content

Commit

Permalink
ipfilter userland: Fix branch mismerge
Browse files Browse the repository at this point in the history
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:		2582ae5
Pointy hat to:	cy

(cherry picked from commit a352283)
  • Loading branch information
cschuber committed Feb 7, 2022
1 parent fcb8e92 commit 189b922
Showing 1 changed file with 27 additions and 44 deletions.
71 changes: 27 additions & 44 deletions sbin/ipf/ipf/ipfcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -401,7 +392,8 @@ extern int ipfrule_remove_out_%s(void));\n",
}
}

static void emittail()
static void
emittail(void)
{
frgroup_t *g;

Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 189b922

Please sign in to comment.