ipfilter: Adjust userland returns to conform to style(9)

Adjust ipfilter's userland return statements to conform to style(9).

MFC after:	1 month
This commit is contained in:
Cy Schubert 2021-12-21 18:37:19 -08:00
parent 8c82b37461
commit 2582ae5740
117 changed files with 965 additions and 948 deletions

View File

@ -26,15 +26,15 @@ int genmask(family, msk, mskp)
#ifdef USE_INET6
case AF_INET6 :
if (inet_pton(AF_INET6, msk, &mskp->in4) != 1)
return -1;
return(-1);
break;
#endif
case AF_INET :
if (inet_aton(msk, &mskp->in4) == 0)
return -1;
return(-1);
break;
default :
return -1;
return(-1);
/*NOTREACHED*/
}
} else {
@ -47,12 +47,12 @@ int genmask(family, msk, mskp)
{
case AF_INET6 :
if ((*endptr != '\0') || (bits < 0) || (bits > 128))
return -1;
return(-1);
fill6bits(bits, mskp->i6);
break;
case AF_INET :
if (*endptr != '\0' || bits > 32 || bits < 0)
return -1;
return(-1);
if (bits == 0)
addr = 0;
else
@ -60,9 +60,9 @@ int genmask(family, msk, mskp)
mskp->in4.s_addr = addr;
break;
default :
return -1;
return(-1);
/*NOTREACHED*/
}
}
return 0;
return(0);
}

View File

@ -1712,7 +1712,7 @@ ipv4_16:
YY_NUMBER '.' YY_NUMBER
{ if ($1 > 255 || $3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
$$.s_addr = ($1 << 24) | ($3 << 16);
$$.s_addr = htonl($$.s_addr);
@ -1723,7 +1723,7 @@ ipv4_24:
ipv4_16 '.' YY_NUMBER
{ if ($3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
$$.s_addr |= htonl($3 << 8);
}
@ -1732,7 +1732,7 @@ ipv4_24:
ipv4: ipv4_24 '.' YY_NUMBER
{ if ($3 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
$$.s_addr |= htonl($3);
}
@ -2003,7 +2003,7 @@ ipf_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, char *filename)
if (fp == NULL) {
fprintf(stderr, "fopen(%s) failed: %s\n", filename,
STRERROR(errno));
return -1;
return(-1);
}
} else
fp = stdin;
@ -2012,7 +2012,7 @@ ipf_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, char *filename)
;
if (fp != NULL)
fclose(fp);
return 0;
return(0);
}
@ -2028,14 +2028,14 @@ ipf_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, FILE *fp)
ipfaddfunc = addfunc;
if (feof(fp))
return 0;
return(0);
i = fgetc(fp);
if (i == EOF)
return 0;
return(0);
if (ungetc(i, fp) == 0)
return 0;
return(0);
if (feof(fp))
return 0;
return(0);
s = getenv("YYDEBUG");
if (s != NULL)
yydebug = atoi(s);
@ -2044,7 +2044,7 @@ ipf_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t *iocfuncs, FILE *fp)
yyin = fp;
yyparse();
return 1;
return(1);
}
@ -2121,7 +2121,7 @@ addrule(void)
for (f1 = frc; count > 0; count--, f1 = f1->fr_next) {
f->fr_next = allocfr();
if (f->fr_next == NULL)
return NULL;
return(NULL);
f->fr_next->fr_pnext = &f->fr_next;
added++;
f = f->fr_next;
@ -2133,7 +2133,7 @@ addrule(void)
}
}
return f2->fr_next;
return(f2->fr_next);
}
@ -2152,15 +2152,15 @@ lookuphost(char *name, i6addr_t *addrp)
if (strcmp(name, fr->fr_names + fr->fr_ifnames[i]) == 0) {
ifpflag = FRI_DYNAMIC;
dynamic = addname(&fr, name);
return 1;
return(1);
}
}
if (gethost(AF_INET, name, addrp) == -1) {
fprintf(stderr, "unknown name \"%s\"\n", name);
return -1;
return(-1);
}
return 0;
return(0);
}
@ -2274,10 +2274,10 @@ newalist(alist_t *ptr)
al = malloc(sizeof(*al));
if (al == NULL)
return NULL;
return(NULL);
al->al_not = 0;
al->al_next = ptr;
return al;
return(al);
}
@ -2290,10 +2290,10 @@ makepool(alist_t *list)
int num;
if (list == NULL)
return 0;
return(0);
top = calloc(1, sizeof(*top));
if (top == NULL)
return 0;
return(0);
for (n = top, a = list; (n != NULL) && (a != NULL); a = a->al_next) {
if (use_inet6 == 1) {
@ -2334,7 +2334,7 @@ makepool(alist_t *list)
top = n->ipn_next;
free(n);
}
return num;
return(num);
}
@ -2347,10 +2347,10 @@ makehash(alist_t *list)
int num;
if (list == NULL)
return 0;
return(0);
top = calloc(1, sizeof(*top));
if (top == NULL)
return 0;
return(0);
for (n = top, a = list; (n != NULL) && (a != NULL); a = a->al_next) {
if (a->al_family == AF_INET6) {
@ -2383,7 +2383,7 @@ makehash(alist_t *list)
top = n->ipe_next;
free(n);
}
return num;
return(num);
}
@ -2395,7 +2395,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
ipfobj_t obj;
if (ptr == NULL)
return 0;
return(0);
fr = ptr;
add = 0;
@ -2442,7 +2442,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg, sizeof(msg), "%d:ioctl(zero rule)",
fr->fr_flineno);
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
} else {
#ifdef USE_QUAD_T
@ -2462,7 +2462,7 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg, sizeof(msg), "%d:ioctl(delete rule)",
fr->fr_flineno);
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
}
} else {
@ -2472,11 +2472,11 @@ ipf_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg, sizeof(msg), "%d:ioctl(add/insert rule)",
fr->fr_flineno);
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
}
}
return 0;
return(0);
}
static void
@ -2609,7 +2609,7 @@ addname(frentry_t **frp, char *name)
frc = f;
*frp = f;
if (f == NULL)
return -1;
return(-1);
if (f->fr_pnext != NULL)
*f->fr_pnext = f;
f->fr_size += nlen;
@ -2617,7 +2617,7 @@ addname(frentry_t **frp, char *name)
f->fr_namelen += nlen;
strcpy(f->fr_names + pos, name);
f->fr_names[f->fr_namelen] = '\0';
return pos;
return(pos);
}
@ -2641,7 +2641,7 @@ allocfr(void)
fr->fr_rif.fd_name = -1;
fr->fr_dif.fd_name = -1;
}
return fr;
return(fr);
}

View File

@ -69,11 +69,11 @@ yygetc(int docont)
c = yytext[yypos++];
if (c == '\n')
yylineNum++;
return c;
return(c);
}
if (yypos == YYBUFSIZ)
return TOOLONG;
return(TOOLONG);
if (pos >= string_start && pos <= string_end) {
c = string_val[pos - string_start];
@ -94,7 +94,7 @@ yygetc(int docont)
yylast = yypos;
yytext[yypos] = '\0';
return c;
return(c);
}
@ -118,8 +118,8 @@ yyswallow(int last)
if (c != EOF)
yyunputc(c);
if (c == last)
return 0;
return -1;
return(0);
return(-1);
}
@ -131,7 +131,7 @@ yytexttochar(void)
for (i = 0; i < yypos; i++)
yychars[i] = (char)(yytext[i] & 0xff);
yychars[i] = '\0';
return yychars;
return(yychars);
}
@ -171,7 +171,7 @@ yytexttostr(int offset, int max)
str[i - offset] = (char)(yytext[i] & 0xff);
str[i - offset] = '\0';
}
return str;
return(str);
}
@ -242,7 +242,7 @@ yylex(void)
lnext = 0;
if ((isbuilding == 0) && !ISALNUM(c)) {
prior = c;
return c;
return(c);
}
goto nextchar;
}
@ -333,7 +333,7 @@ yylex(void)
if (yydebug)
fprintf(stderr, "reset at EOF\n");
prior = 0;
return 0;
return(0);
}
if (strchr("=,/;{}()@", c) != NULL) {
@ -599,7 +599,7 @@ yylex(void)
if (rval == YY_NUMBER)
priornum = yylval.num;
prior = rval;
return rval;
return(rval);
}
@ -609,12 +609,12 @@ static wordtab_t *yyfindkey(key)
wordtab_t *w;
if (yywordtab == NULL)
return NULL;
return(NULL);
for (w = yywordtab; w->w_word != 0; w++)
if (strcasecmp(key, w->w_word) == 0)
return w;
return NULL;
return(w);
return(NULL);
}
@ -624,12 +624,12 @@ yykeytostr(int num)
wordtab_t *w;
if (yywordtab == NULL)
return "<unknown>";
return("<unknown>");
for (w = yywordtab; w->w_word; w++)
if (w->w_value == num)
return w->w_word;
return "<unknown>";
return(w->w_word);
return("<unknown>");
}
@ -640,7 +640,7 @@ yysettab(wordtab_t *words)
save = yywordtab;
yywordtab = words;
return save;
return(save);
}

View File

@ -111,7 +111,7 @@ static int m_xhalf(mb_t *, int, int *);
(_k) -= len; \
(_m) = (_m)->m_next; \
if ((_m) == 0) \
return 0; \
return(0); \
len = M_LEN(m); \
} \
}
@ -129,7 +129,7 @@ m_xword(m, k, err)
cp = MTOD(m, u_char *) + k;
if (len - k >= 4) {
*err = 0;
return EXTRACT_LONG(cp);
return(EXTRACT_LONG(cp));
}
m0 = m->m_next;
if (m0 == NULL || M_LEN(m0) + len - k < 4)
@ -139,17 +139,17 @@ m_xword(m, k, err)
switch (len - k) {
case 1:
return (cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2];
return(cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2];
case 2:
return (cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1];
return(cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) | np[1];
default:
return (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0];
return(cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | np[0];
}
bad:
*err = 1;
return 0;
return(0);
}
static int
@ -165,16 +165,16 @@ m_xhalf(m, k, err)
cp = MTOD(m, u_char *) + k;
if (len - k >= 2) {
*err = 0;
return EXTRACT_SHORT(cp);
return(EXTRACT_SHORT(cp));
}
m0 = m->m_next;
if (m0 == NULL)
goto bad;
*err = 0;
return (cp[0] << 8) | MTOD(m0, u_char *)[0];
return(cp[0] << 8) | MTOD(m0, u_char *)[0];
bad:
*err = 1;
return 0;
return(0);
}
/*
@ -209,7 +209,7 @@ bpf_filter(pc, p, wirelen, buflen)
/*
* No filter means accept all.
*/
return (u_int)-1;
return(u_int)-1;
A = 0;
X = 0;
--pc;
@ -218,21 +218,21 @@ bpf_filter(pc, p, wirelen, buflen)
switch (pc->code) {
default:
return 0;
return(0);
case BPF_RET|BPF_K:
return (u_int)pc->k;
return(u_int)pc->k;
case BPF_RET|BPF_A:
return (u_int)A;
return(u_int)A;
case BPF_LD|BPF_W|BPF_ABS:
k = pc->k;
if (k + sizeof(int32) > buflen) {
if (m == NULL)
return 0;
return(0);
A = m_xword(m, k, &merr);
if (merr != 0)
return 0;
return(0);
continue;
}
A = EXTRACT_LONG(&p[k]);
@ -242,10 +242,10 @@ bpf_filter(pc, p, wirelen, buflen)
k = pc->k;
if (k + sizeof(short) > buflen) {
if (m == NULL)
return 0;
return(0);
A = m_xhalf(m, k, &merr);
if (merr != 0)
return 0;
return(0);
continue;
}
A = EXTRACT_SHORT(&p[k]);
@ -255,7 +255,7 @@ bpf_filter(pc, p, wirelen, buflen)
k = pc->k;
if (k >= buflen) {
if (m == NULL)
return 0;
return(0);
n = m;
MINDEX(len, n, k);
A = MTOD(n, u_char *)[k];
@ -276,10 +276,10 @@ bpf_filter(pc, p, wirelen, buflen)
k = X + pc->k;
if (k + sizeof(int32) > buflen) {
if (m == NULL)
return 0;
return(0);
A = m_xword(m, k, &merr);
if (merr != 0)
return 0;
return(0);
continue;
}
A = EXTRACT_LONG(&p[k]);
@ -289,10 +289,10 @@ bpf_filter(pc, p, wirelen, buflen)
k = X + pc->k;
if (k + sizeof(short) > buflen) {
if (m == NULL)
return 0;
return(0);
A = m_xhalf(m, k, &merr);
if (merr != 0)
return 0;
return(0);
continue;
}
A = EXTRACT_SHORT(&p[k]);
@ -302,7 +302,7 @@ bpf_filter(pc, p, wirelen, buflen)
k = X + pc->k;
if (k >= buflen) {
if (m == NULL)
return 0;
return(0);
n = m;
MINDEX(len, n, k);
A = MTOD(n, u_char *)[k];
@ -315,7 +315,7 @@ bpf_filter(pc, p, wirelen, buflen)
k = pc->k;
if (k >= buflen) {
if (m == NULL)
return 0;
return(0);
n = m;
MINDEX(len, n, k);
X = (MTOD(n, char *)[k] & 0xf) << 2;
@ -398,7 +398,7 @@ bpf_filter(pc, p, wirelen, buflen)
case BPF_ALU|BPF_DIV|BPF_X:
if (X == 0)
return 0;
return(0);
A /= X;
continue;
@ -486,10 +486,10 @@ bpf_validate(f, len)
const struct bpf_insn *p;
if (len == 0)
return 1;
return(1);
if (len < 1 || len > BPF_MAXINSNS)
return 0;
return(0);
for (i = 0; i < len; ++i) {
p = &f[i];
@ -511,23 +511,23 @@ bpf_validate(f, len)
*/
#if 0
if (p->k >= bpf_maxbufsize)
return 0;
return(0);
#endif
break;
case BPF_MEM:
if (p->k >= BPF_MEMWORDS)
return 0;
return(0);
break;
case BPF_LEN:
break;
default:
return 0;
return(0);
}
break;
case BPF_ST:
case BPF_STX:
if (p->k >= BPF_MEMWORDS)
return 0;
return(0);
break;
case BPF_ALU:
switch (BPF_OP(p->code)) {
@ -544,9 +544,9 @@ bpf_validate(f, len)
* Check for constant division by 0.
*/
if (BPF_RVAL(p->code) == BPF_K && p->k == 0)
return 0;
return(0);
default:
return 0;
return(0);
}
break;
case BPF_JMP:
@ -570,17 +570,17 @@ bpf_validate(f, len)
switch (BPF_OP(p->code)) {
case BPF_JA:
if (from + p->k < from || from + p->k >= len)
return 0;
return(0);
break;
case BPF_JEQ:
case BPF_JGT:
case BPF_JGE:
case BPF_JSET:
if (from + p->jt >= len || from + p->jf >= len)
return 0;
return(0);
break;
default:
return 0;
return(0);
}
break;
case BPF_RET:
@ -588,8 +588,8 @@ bpf_validate(f, len)
case BPF_MISC:
break;
default:
return 0;
return(0);
}
}
return BPF_CLASS(f[len - 1].code) == BPF_RET;
return(BPF_CLASS(f[len - 1].code) == BPF_RET);
}

View File

@ -91,7 +91,7 @@ typedef struct frentry {
u_short fr_skip; /* # of rules to skip */
u_short fr_loglevel; /* syslog log facility + priority */
int (*fr_func)(int, ip_t *, fr_info_t *));
char fr_icode; /* return ICMP code */
( char fr_icode; /* return ICMP code */);
char fr_ifname[IFNAMSIZ];
#ifdef BSD
char fr_oifname[IFNAMSIZ];
@ -118,8 +118,8 @@ Flags which are recognised in fr_flags:
FR_LOGP 0x000012 /* Log-pass */
FR_LOGBODY 0x000020 /* log the body of packets too */
FR_LOGFIRST 0x000040 /* log only the first packet to match */
FR_RETRST 0x000080 /* return a TCP RST packet if blocked */
FR_RETICMP 0x000100 /* return an ICMP packet if blocked */
( FR_RETRST 0x000080 /* return a TCP RST packet if blocked */);
( FR_RETICMP 0x000100 /* return an ICMP packet if blocked */);
FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */
FR_NOMATCH 0x000200 /* no match occured */
FR_ACCOUNT 0x000400 /* count packet bytes */
@ -210,7 +210,7 @@ struct filterstats {
u_long fr_npkl; /* packets unmatched and logged */
u_long fr_pkl; /* packets logged */
u_long fr_skip; /* packets to be logged but buffer full */
u_long fr_ret; /* packets for which a return is sent */
( u_long fr_ret; /* packets for which a return is sent */);
u_long fr_acct; /* packets for which counting was performed */
u_long fr_bnfr; /* bad attempts to allocate fragment state */
u_long fr_nfr; /* new fragment state kept */

View File

@ -108,7 +108,7 @@ auth
rules cause the matching packet to be queued up for processing by a
user space program. The user space program is responsible for making
an ioctl system call to collect the information about the queued
packet and another ioctl system call to return the verdict (block,
packet( and another ioctl system call to return the verdict (block,);
pass, etc) on what to do with the packet. In the event that the queue
becomes full, the packets will end up being dropped.
.HP
@ -224,7 +224,7 @@ To address this problem, a block rule can be qualified in two ways.
The first of these is specific to TCP and instructs IPFilter to send back
a reset (RST) packet. This packet indicates to the remote system that the
packet it sent has been rejected and that it shouldn't make any further
attempts to send packets to that port. Telling IPFilter to return a TCP
attempts( to send packets to that port. Telling IPFilter to return a TCP);
RST packet in response to something that has been received is achieved
with the return-rst keyword like this:
.PP
@ -240,18 +240,18 @@ For all of the other protocols handled by the IP protocol suite, to send
back an error indicating that the received packet was dropped requires
sending back an ICMP error packet. Whilst these can also be used for TCP,
the sending host may not treat the received ICMP error as a hard error
in the same way as it does the TCP RST packet. To return an ICMP error
in( the same way as it does the TCP RST packet. To return an ICMP error);
it is necessary to place return-icmp after the block keyword like this:
.PP
.nf
block return-icmp in proto udp from any to 192.168.0.1/24
.fi
.PP
When electing to return an ICMP error packet, it is also possible to
When( electing to return an ICMP error packet, it is also possible to);
select what type of ICMP error is returned. Whilst the full compliment
of ICMP unreachable codes can be used by specifying a number instead of
the string below, only the following should be used in conjunction with
return-icmp. Which return code to use is a choice to be made when
return-icmp.( Which return code to use is a choice to be made when);
weighing up the pro's and con's. Using some of the codes may make it
more obvious that a firewall is being used rather than just the host
not responding.

View File

@ -174,11 +174,11 @@ static int
opendevice(char *ipfdev, int check)
{
if (opts & OPT_DONOTHING)
return -2;
return(-2);
if (check && checkrev(ipfname) == -1) {
fprintf(stderr, "User/kernel version check failed\n");
return -2;
return(-2);
}
if (!ipfdev)
@ -188,7 +188,7 @@ opendevice(char *ipfdev, int check)
if ((fd = open(ipfdev, O_RDWR)) == -1)
if ((fd = open(ipfdev, O_RDONLY)) == -1)
ipferror(fd, "open device");
return fd;
return(fd);
}
@ -208,9 +208,9 @@ get_flags(void)
if ((opendevice(ipfname, 1) != -2) &&
(ioctl(fd, SIOCGETFF, &i) == -1)) {
ipferror(fd, "SIOCGETFF");
return 0;
return(0);
}
return i;
return(i);
}
@ -256,7 +256,7 @@ ipf_interceptadd(int fd, ioctlfunc_t ioctlfunc, void *ptr)
if (ipf_addrule(fd, ioctlfunc, ptr) != 0)
exitstatus = 1;
return 0;
return(0);
}
@ -527,13 +527,13 @@ showversion(void)
if ((vfd = open(ipfname, O_RDONLY)) == -1) {
perror("open device");
return 1;
return(1);
}
if (ioctl(vfd, SIOCGETFS, &ipfo)) {
ipferror(vfd, "ioctl(SIOCGETFS)");
close(vfd);
return 1;
return(1);
}
close(vfd);
flags = get_flags();
@ -574,5 +574,5 @@ showversion(void)
printf("Active list: %d\n", fio.f_active);
printf("Feature mask: %#x\n", fio.f_features);
return 0;
return(0);
}

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(frentry_t *fr)
void printc(fr)
frentry_t *fr;
{
u_long *ulp;
char *and;
@ -162,8 +162,9 @@ printc(frentry_t *fr)
static frgroup_t *groups = NULL;
static void
addrule(FILE *fp, frentry_t *fr)
static void addrule(fp, fr)
FILE *fp;
frentry_t *fr;
{
frentry_t *f, **fpp;
frgroup_t *g;
@ -242,27 +243,30 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n",
}
int
intcmp(const void *c1, const void *c2)
int intcmp(c1, c2)
const void *c1, *c2;
{
const mc_t *i1 = (const mc_t *)c1, *i2 = (const mc_t *)c2;
if (i1->n == i2->n) {
return i1->c - i2->c;
return(i1->c - i2->c);
}
return i2->n - i1->n;
return(i2->n - i1->n);
}
static void
indent(FILE *fp, int in)
static void indent(fp, in)
FILE *fp;
int in;
{
for (; in; in--)
fputc('\t', fp);
}
static void
printeq(FILE *fp, char *var, int m, int max, int v)
static void printeq(fp, var, m, max, v)
FILE *fp;
char *var;
int m, max, v;
{
if (m == max)
fprintf(fp, "%s == %#x) {\n", var, v);
@ -276,8 +280,10 @@ printeq(FILE *fp, char *var, int m, int max, int v)
* m - netmask
* v - required address
*/
static void
printipeq(FILE *fp, char *var, int fl, int m, int v)
static void printipeq(fp, var, fl, m, v)
FILE *fp;
char *var;
int fl, m, v;
{
if (m == 0xffffffff)
fprintf(fp, "%s ", var);
@ -288,8 +294,10 @@ printipeq(FILE *fp, char *var, int fl, int m, int v)
}
void
emit(int num, int dir, void *v, frentry_t *fr)
void emit(num, dir, v, fr)
int num, dir;
void *v;
frentry_t *fr;
{
u_int incnt, outcnt;
frgroup_t *g;
@ -338,8 +346,9 @@ emit(int num, int dir, void *v, frentry_t *fr)
}
static void
emitheader(frgroup_t *grp, u_int incount, u_int outcount)
static void emitheader(grp, incount, outcount)
frgroup_t *grp;
u_int incount, outcount;
{
static FILE *fph = NULL;
frgroup_t *g;
@ -392,8 +401,7 @@ extern int ipfrule_remove_out_%s(void));\n",
}
}
static void
emittail(void)
static void emittail()
{
frgroup_t *g;
@ -406,10 +414,10 @@ int ipfrule_add()\n\
fprintf(cfile, "\
err = ipfrule_add_%s_%s();\n\
if (err != 0)\n\
return err;\n",
return(err);\n",
(g->fg_flags & FR_INQUE) ? "in" : "out", g->fg_name);
fprintf(cfile, "\
return 0;\n");
return(0);\n");
fprintf(cfile, "}\n\
\n");
@ -422,17 +430,20 @@ int ipfrule_remove()\n\
fprintf(cfile, "\
err = ipfrule_remove_%s_%s();\n\
if (err != 0)\n\
return err;\n",
return(err);\n",
(g->fg_flags & FR_INQUE) ? "in" : "out", g->fg_name);
fprintf(cfile, "\
return 0;\n");
return(0);\n");
fprintf(cfile, "}\n");
}
static void
emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
u_int incount, u_int outcount)
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 FILE *fp = NULL;
static int header[2] = { 0, 0 };
@ -456,7 +467,7 @@ emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
fprintf(fp, "}\n");
}
if (openfunc == 1) {
fprintf(fp, "\treturn fr;\n}\n");
fprintf(fp, "\treturn(fr);\n}\n");
openfunc = 0;
if (n != NULL) {
free(n);
@ -477,7 +488,7 @@ emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
fprintf(fp, "}\n");
}
if (openfunc == 1) {
fprintf(fp, "\treturn fr;\n}\n");
fprintf(fp, "\treturn(fr);\n}\n");
openfunc = 0;
}
}
@ -930,7 +941,7 @@ emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
indent(fp, in);
if (fr->fr_flags & FR_QUICK) {
fprintf(fp, "return (frentry_t *)&%s_rule_%s_%d;\n",
fprintf(fp, "return((frentry_t *)&%s_rule_%s_%d);\n",
fr->fr_flags & FR_INQUE ? "in" : "out",
FR_NAME(fr, fr_group), num);
} else {
@ -945,8 +956,8 @@ emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
}
void
printC(int dir)
void printC(dir)
int dir;
{
static mc_t *m = NULL;
frgroup_t *g;
@ -968,8 +979,11 @@ printC(int dir)
/*
* Now print out code to implement all of the rules.
*/
static void
printCgroup(int dir, frentry_t *top, mc_t *m, char *group)
static void printCgroup(dir, top, m, group)
int dir;
frentry_t *top;
mc_t *m;
char *group;
{
frentry_t *fr, *fr1;
int i, n, rn;
@ -1215,8 +1229,11 @@ printCgroup(int dir, frentry_t *top, mc_t *m, char *group)
}
}
static void
printhooks(FILE *fp, int in, int out, frgroup_t *grp)
static void printhooks(fp, in, out, grp)
FILE *fp;
int in;
int out;
frgroup_t *grp;
{
frentry_t *fr;
char *group;
@ -1311,7 +1328,7 @@ int ipfrule_add_%s_%s()\n", instr, group);
err = frrequest(&ipfmain, IPL_LOGIPF, SIOCADDFR, (caddr_t)fp,\n\
ipfmain.ipf_active, 0);\n",
instr, group);
fprintf(fp, "\treturn err;\n}\n");
fprintf(fp, "\treturn(err);\n}\n");
fprintf(fp, "\n\n\
int ipfrule_remove_%s_%s()\n", instr, group);
@ -1348,8 +1365,8 @@ int ipfrule_remove_%s_%s()\n", instr, group);
instr, group, instr, group, instr, group);
fprintf(fp, "\
if (err)\n\
return err;\n\
return(err);\n\
\n\n");
fprintf(fp, "\treturn err;\n}\n");
fprintf(fp, "\treturn(err);\n}\n");
}

View File

@ -68,7 +68,7 @@ The ioctls which are for use with logging and don't affect the filter are:
The SIOCIPFFB ioctl flushes the log buffer and returns the number of bytes
flushed. FIONREAD returns the number of bytes currently used for storing
log data. If IPFILTER_LOG is not defined when compiling, SIOCIPFFB is not
available and FIONREAD will return but not do anything.
available( and FIONREAD will return but not do anything.);
.PP
There is currently no support for non-blocking IO with this device, meaning
all read operations should be considered blocking in nature (if there is no

View File

@ -142,7 +142,7 @@ int changestateif(char *ifs, char *fname)
}
close(fd);
return 0;
return(0);
}
@ -198,7 +198,7 @@ int changenatif(char *ifs, char *fname)
}
close(fd);
return 0;
return(0);
}
@ -286,9 +286,9 @@ int main(int argc, char *argv[])
if (!filename || ns < 0)
usage();
if (ns == 0)
return changenatif(ifs, filename);
return(changenatif(ifs, filename));
else
return changestateif(ifs, filename);
return(changestateif(ifs, filename));
}
if ((ns >= 0) || (lock >= 0)) {
@ -327,7 +327,7 @@ int main(int argc, char *argv[])
}
}
}
return err;
return(err);
}
@ -336,7 +336,7 @@ int opendevice(char *ipfdev)
int fd = -1;
if (opts & OPT_DONOTHING)
return -2;
return(-2);
if (!ipfdev)
ipfdev = IPL_NAME;
@ -344,7 +344,7 @@ int opendevice(char *ipfdev)
if ((fd = open(ipfdev, O_RDWR)) == -1)
if ((fd = open(ipfdev, O_RDONLY)) == -1)
perror("open device");
return fd;
return(fd);
}
@ -361,12 +361,12 @@ int setlock(int fd, int lock)
if (!(opts & OPT_DONOTHING)) {
if (ioctl(fd, SIOCSTLCK, &lock) == -1) {
perror("SIOCSTLCK");
return 1;
return(1);
}
if (opts & OPT_VERBOSE)
printf("Lock now %s\n", lock ? "on" : "off");
}
return 0;
return(0);
}
@ -383,7 +383,7 @@ int writestate(int fd, char *file)
if (wfd == -1) {
fprintf(stderr, "%s ", file);
perror("state:open");
return 1;
return(1);
}
ipsp = &ips;
@ -404,19 +404,19 @@ int writestate(int fd, char *file)
break;
perror("state:SIOCSTGET");
close(wfd);
return 1;
return(1);
}
if (opts & OPT_VERBOSE)
printf("Got state next %p\n", ips.ips_next);
if (write(wfd, ipsp, sizeof(ips)) != sizeof(ips)) {
perror("state:write");
close(wfd);
return 1;
return(1);
}
} while (ips.ips_next != NULL);
close(wfd);
return 0;
return(0);
}
@ -433,7 +433,7 @@ int readstate(int fd, char *file)
if (sfd == -1) {
fprintf(stderr, "%s ", file);
perror("open");
return 1;
return(1);
}
bzero((char *)&ips, sizeof(ips));
@ -522,7 +522,7 @@ int readstate(int fd, char *file)
free(is);
}
return 0;
return(0);
freeipshead:
while ((is = ipshead) != NULL) {
@ -531,7 +531,7 @@ int readstate(int fd, char *file)
}
if (sfd != -1)
close(sfd);
return 1;
return(1);
}
@ -556,7 +556,7 @@ int readnat(int fd, char *file)
if (nfd == -1) {
fprintf(stderr, "%s ", file);
perror("nat:open");
return 1;
return(1);
}
bzero((char *)&ipn, sizeof(ipn));
@ -652,7 +652,7 @@ int readnat(int fd, char *file)
if (ioctl(fd, SIOCSTPUT, &obj)) {
fprintf(stderr, "in=%p:", in);
perror("SIOCSTPUT");
return 1;
return(1);
}
if (nat->nat_flags & SI_NEWFR) {
@ -667,7 +667,7 @@ int readnat(int fd, char *file)
free(in);
}
return 0;
return(0);
freenathead:
while ((in = ipnhead) != NULL) {
@ -676,7 +676,7 @@ int readnat(int fd, char *file)
}
if (nfd != -1)
close(nfd);
return 1;
return(1);
}
@ -694,7 +694,7 @@ int writenat(int fd, char *file)
if (nfd == -1) {
fprintf(stderr, "%s ", file);
perror("nat:open");
return 1;
return(1);
}
obj.ipfo_rev = IPFILTER_VERSION;
@ -710,7 +710,7 @@ int writenat(int fd, char *file)
close(nfd);
if (ipnp != NULL)
free(ipnp);
return 1;
return(1);
}
if (opts & OPT_VERBOSE)
@ -740,7 +740,7 @@ int writenat(int fd, char *file)
perror("nat:SIOCSTGET");
close(nfd);
free(ipnp);
return 1;
return(1);
}
if (opts & OPT_VERBOSE)
@ -750,7 +750,7 @@ int writenat(int fd, char *file)
perror("nat:write");
close(nfd);
free(ipnp);
return 1;
return(1);
}
next = ipnp->ipn_next;
} while (ipnp && next);
@ -758,7 +758,7 @@ int writenat(int fd, char *file)
free(ipnp);
close(nfd);
return 0;
return(0);
}
@ -772,15 +772,15 @@ int writeall(char *dirname)
if (chdir(dirname)) {
fprintf(stderr, "IPF_SAVEDIR=%s: ", dirname);
perror("chdir(IPF_SAVEDIR)");
return 1;
return(1);
}
fd = opendevice(NULL);
if (fd == -1)
return 1;
return(1);
if (setlock(fd, 1)) {
close(fd);
return 1;
return(1);
}
devfd = opendevice(IPSTATE_NAME);
@ -799,16 +799,16 @@ int writeall(char *dirname)
if (setlock(fd, 0)) {
close(fd);
return 1;
return(1);
}
close(fd);
return 0;
return(0);
bad:
setlock(fd, 0);
close(fd);
return 1;
return(1);
}
@ -821,35 +821,35 @@ int readall(char *dirname)
if (chdir(dirname)) {
perror("chdir(IPF_SAVEDIR)");
return 1;
return(1);
}
fd = opendevice(NULL);
if (fd == -1)
return 1;
return(1);
if (setlock(fd, 1)) {
close(fd);
return 1;
return(1);
}
devfd = opendevice(IPSTATE_NAME);
if (devfd == -1)
return 1;
return(1);
if (readstate(devfd, NULL))
return 1;
return(1);
close(devfd);
devfd = opendevice(IPNAT_NAME);
if (devfd == -1)
return 1;
return(1);
if (readnat(devfd, NULL))
return 1;
return(1);
close(devfd);
if (setlock(fd, 0)) {
close(fd);
return 1;
return(1);
}
return 0;
return(0);
}

View File

@ -443,7 +443,7 @@ int main(int argc, char *argv[])
else
showstats(fiop, frf);
return 0;
return(0);
}
@ -807,7 +807,7 @@ printlivelist( struct friostat *fiop, int out, int set, frentry_t *fp,
ipferror(ipf_fd, "ioctl(SIOCIPFITER)");
num = IPFGENITER_IPF;
(void) ioctl(ipf_fd,SIOCIPFDELTOK, &num);
return rules;
return(rules);
}
if (bcmp(fp, &zero, sizeof(zero)) == 0)
break;
@ -891,7 +891,7 @@ printlivelist( struct friostat *fiop, int out, int set, frentry_t *fp,
num = IPFGENITER_IPF;
(void) ioctl(ipf_fd,SIOCIPFDELTOK, &num);
return rules;
return(rules);
}
@ -1941,17 +1941,17 @@ static char *getip(int v, i6addr_t *addr)
#endif
if (v == 0)
return ("any");
return("any");
if (v == 4)
return inet_ntoa(addr->in4);
return(inet_ntoa(addr->in4));
#ifdef USE_INET6
(void) inet_ntop(AF_INET6, &addr->in6, hostbuf, sizeof(hostbuf) - 1);
hostbuf[MAXHOSTNAMELEN] = '\0';
return hostbuf;
return(hostbuf);
#else
return "IPv6";
return("IPv6");
#endif
}
@ -1973,7 +1973,7 @@ static char *ttl_to_string(long int ttl)
snprintf(ttlbuf, sizeof(ttlbuf), "%2d:%02d:%02d", hours, minutes, seconds);
else
snprintf(ttlbuf, sizeof(ttlbuf), "%2d:%02d", minutes, seconds);
return ttlbuf;
return(ttlbuf);
}
@ -1984,10 +1984,10 @@ static int sort_pkts(const void *a, const void *b)
register const statetop_t *bp = b;
if (ap->st_pkts == bp->st_pkts)
return 0;
return(0);
else if (ap->st_pkts < bp->st_pkts)
return 1;
return -1;
return(1);
return(-1);
}
@ -1997,10 +1997,10 @@ static int sort_bytes(const void *a, const void *b)
register const statetop_t *bp = b;
if (ap->st_bytes == bp->st_bytes)
return 0;
return(0);
else if (ap->st_bytes < bp->st_bytes)
return 1;
return -1;
return(1);
return(-1);
}
@ -2010,10 +2010,10 @@ static int sort_p(const void *a, const void *b)
register const statetop_t *bp = b;
if (ap->st_p == bp->st_p)
return 0;
return(0);
else if (ap->st_p < bp->st_p)
return 1;
return -1;
return(1);
return(-1);
}
@ -2023,10 +2023,10 @@ static int sort_ttl(const void *a, const void *b)
register const statetop_t *bp = b;
if (ap->st_age == bp->st_age)
return 0;
return(0);
else if (ap->st_age < bp->st_age)
return 1;
return -1;
return(1);
return(-1);
}
static int sort_srcip(const void *a, const void *b)
@ -2037,20 +2037,20 @@ static int sort_srcip(const void *a, const void *b)
#ifdef USE_INET6
if (use_inet6 && !use_inet4) {
if (IP6_EQ(&ap->st_src, &bp->st_src))
return 0;
return(0);
else if (IP6_GT(&ap->st_src, &bp->st_src))
return 1;
return(1);
} else
#endif
{
if (ntohl(ap->st_src.in4.s_addr) ==
ntohl(bp->st_src.in4.s_addr))
return 0;
return(0);
else if (ntohl(ap->st_src.in4.s_addr) >
ntohl(bp->st_src.in4.s_addr))
return 1;
return(1);
}
return -1;
return(-1);
}
static int sort_srcpt(const void *a, const void *b)
@ -2059,10 +2059,10 @@ static int sort_srcpt(const void *a, const void *b)
register const statetop_t *bp = b;
if (htons(ap->st_sport) == htons(bp->st_sport))
return 0;
return(0);
else if (htons(ap->st_sport) > htons(bp->st_sport))
return 1;
return -1;
return(1);
return(-1);
}
static int sort_dstip(const void *a, const void *b)
@ -2073,20 +2073,20 @@ static int sort_dstip(const void *a, const void *b)
#ifdef USE_INET6
if (use_inet6 && !use_inet4) {
if (IP6_EQ(&ap->st_dst, &bp->st_dst))
return 0;
return(0);
else if (IP6_GT(&ap->st_dst, &bp->st_dst))
return 1;
return(1);
} else
#endif
{
if (ntohl(ap->st_dst.in4.s_addr) ==
ntohl(bp->st_dst.in4.s_addr))
return 0;
return(0);
else if (ntohl(ap->st_dst.in4.s_addr) >
ntohl(bp->st_dst.in4.s_addr))
return 1;
return(1);
}
return -1;
return(-1);
}
static int sort_dstpt(const void *a, const void *b)
@ -2095,10 +2095,10 @@ static int sort_dstpt(const void *a, const void *b)
register const statetop_t *bp = b;
if (htons(ap->st_dport) == htons(bp->st_dport))
return 0;
return(0);
else if (htons(ap->st_dport) > htons(bp->st_dport))
return 1;
return -1;
return(1);
return(-1);
}
#endif
@ -2121,16 +2121,16 @@ ipstate_t *fetchstate(ipstate_t *src, ipstate_t *dst)
state.igi_data = dst;
if (ioctl(state_fd, SIOCGENITER, &obj) != 0)
return NULL;
return(NULL);
if (dst->is_next == NULL) {
int n = IPFGENITER_STATE;
(void) ioctl(ipf_fd,SIOCIPFDELTOK, &n);
}
} else {
if (kmemcpy((char *)dst, (u_long)src, sizeof(*dst)))
return NULL;
return(NULL);
}
return dst;
return(dst);
}
@ -2149,8 +2149,8 @@ static int fetchfrag( int fd, int type, ipfr_t *frp)
frag.igi_data = frp;
if (ioctl(fd, SIOCGENITER, &obj))
return EFAULT;
return 0;
return(EFAULT);
return(0);
}
@ -2295,7 +2295,7 @@ static int state_matcharray(ipstate_t *stp, int *array)
break;
}
return rv;
return(rv);
}

View File

@ -38,7 +38,7 @@ int
ipfattach(softc)
ipf_main_softc_t *softc;
{
return 0;
return(0);
}
@ -46,7 +46,7 @@ int
ipfdetach(softc)
ipf_main_softc_t *softc;
{
return 0;
return(0);
}
@ -71,10 +71,10 @@ ipfioctl(softc, dev, cmd, data, mode)
error = ipf_ioctlswitch(softc, unit, data, cmd, mode, uid, NULL);
if (error != -1) {
SPL_X(s);
return error;
return(error);
}
SPL_X(s);
return error;
return(error);
}
@ -115,7 +115,7 @@ no_output(ifp, m, s, rt)
struct mbuf *m;
struct sockaddr *s;
{
return 0;
return(0);
}
@ -143,11 +143,11 @@ write_output(ifp, m, s, rt)
fd = open(fname, O_WRONLY|O_APPEND);
if (fd == -1) {
perror("open");
return -1;
return(-1);
}
write(fd, (char *)ip, ntohs(ip->ip_len));
close(fd);
return 0;
return(0);
}
@ -217,7 +217,7 @@ get_unit(name, family)
defined(__FreeBSD__)
if (!*name)
return NULL;
return(NULL);
if (name == NULL)
name = "anon0";
@ -230,7 +230,7 @@ get_unit(name, family)
if (!strcmp(name, ifp->if_xname)) {
if (addr != NULL)
ipf_setifpaddr(ifp, addr);
return ifp;
return(ifp);
}
}
#else
@ -248,7 +248,7 @@ get_unit(name, family)
if (!strcmp(name, ifname)) {
if (addr != NULL)
ipf_setifpaddr(ifp, addr);
return ifp;
return(ifp);
}
}
#endif
@ -256,12 +256,12 @@ get_unit(name, family)
if (!ifneta) {
ifneta = (struct ifnet **)malloc(sizeof(ifp) * 2);
if (!ifneta)
return NULL;
return(NULL);
ifneta[1] = NULL;
ifneta[0] = (struct ifnet *)calloc(1, sizeof(*ifp));
if (!ifneta[0]) {
free(ifneta);
return NULL;
return(NULL);
}
nifs = 1;
} else {
@ -272,13 +272,13 @@ get_unit(name, family)
if (!ifneta) {
free(old_ifneta);
nifs = 0;
return NULL;
return(NULL);
}
ifneta[nifs] = NULL;
ifneta[nifs - 1] = (struct ifnet *)malloc(sizeof(*ifp));
if (!ifneta[nifs - 1]) {
nifs--;
return NULL;
return(NULL);
}
}
ifp = ifneta[nifs - 1];
@ -314,7 +314,7 @@ get_unit(name, family)
ipf_setifpaddr(ifp, addr);
}
return ifp;
return(ifp);
}
@ -332,7 +332,7 @@ get_ifname(ifp)
else
strcpy(ifname, ifp->if_name);
#endif
return ifname;
return(ifname);
}
@ -398,7 +398,7 @@ ipf_fastroute(m, mpp, fin, fdp)
ifp = fdp->fd_ptr;
if (ifp == NULL)
return 0; /* no routing table out here */
return(0; /* no routing table out here */);
if (fin->fin_out == 0) {
fin->fin_ifp = ifp;
@ -433,7 +433,7 @@ ipf_fastroute(m, mpp, fin, fdp)
done:
fin->fin_ifp = sifp;
fin->fin_out = sout;
return error;
return(error);
}
@ -442,7 +442,7 @@ ipf_send_reset(fin)
fr_info_t *fin;
{
ipfkverbose("- TCP RST sent\n");
return 0;
return(0);
}
@ -453,7 +453,7 @@ ipf_send_icmp_err(type, fin, dst)
int dst;
{
ipfkverbose("- ICMP unreachable sent\n");
return 0;
return(0);
}
@ -510,9 +510,9 @@ ipfuiomove(buf, len, rwflag, uio)
ioc++;
}
if (left > 0)
return EFAULT;
return(EFAULT);
}
return 0;
return(0);
}
@ -552,7 +552,7 @@ ipf_newisn(fin)
*/
iss_seq_off += 0x00010000;
newiss += iss_seq_off;
return newiss;
return(newiss);
}
@ -582,7 +582,7 @@ ipf_nextipid(fin)
id = ipid++;
MUTEX_EXIT(&softc->ipf_rw);
return id;
return(id);
}
@ -592,13 +592,13 @@ ipf_checkv4sum(fin)
{
if (fin->fin_flx & FI_SHORT)
return 1;
return(1);
if (ipf_checkl4sum(fin) == -1) {
fin->fin_flx |= FI_BAD;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -608,13 +608,13 @@ ipf_checkv6sum(fin)
fr_info_t *fin;
{
if (fin->fin_flx & FI_SHORT)
return 1;
return(1);
if (ipf_checkl4sum(fin) == -1) {
fin->fin_flx |= FI_BAD;
return -1;
return(-1);
}
return 0;
return(0);
}
#endif
@ -632,7 +632,7 @@ copyoutptr(softc, src, dst, size)
bcopy(dst, (char *)&ca, sizeof(ca));
bcopy(src, ca, size);
return 0;
return(0);
}
@ -648,13 +648,13 @@ copyinptr(src, dst, size)
bcopy(src, (char *)&ca, sizeof(ca));
bcopy(ca, dst, size);
return 0;
return(0);
}
#endif
/*
* return the first IP Address associated with an interface
* return the first IP Address associated with an interface
*/
int
ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
@ -679,8 +679,8 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
sin = (struct sockaddr_in *)&ifa->ifa_addr;
return ipf_ifpfillv4addr(atype, sin, &mask,
&inp->in4, &inpmask->in4);
return(ipf_ifpfillv4addr(atype, sin, &mask,
&inp->in4, &inpmask->in4));
}
#ifdef USE_INET6
if (v == 6) {
@ -691,12 +691,12 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
((i6addr_t *)&mask.sin6_addr)->i6[1] = 0xffffffff;
((i6addr_t *)&mask.sin6_addr)->i6[2] = 0xffffffff;
((i6addr_t *)&mask.sin6_addr)->i6[3] = 0xffffffff;
return ipf_ifpfillv6addr(atype, sin6, &mask,
inp, inpmask);
return(ipf_ifpfillv6addr(atype, sin6, &mask,
inp, inpmask));
}
#endif
}
return 0;
return(0);
}
@ -744,7 +744,7 @@ ipf_random()
number ^= last;
break;
}
return number;
return(number);
}
@ -752,7 +752,7 @@ int
ipf_verifysrc(fin)
fr_info_t *fin;
{
return 1;
return(1);
}
@ -763,7 +763,7 @@ ipf_inject(fin, m)
{
FREE_MB_T(m);
return 0;
return(0);
}
@ -788,7 +788,7 @@ ipf_pcksum(fin, hlen, sum)
sum = (sum & 0xffff) + (sum >> 16);
sum2 = (u_short)(~sum & 0xffff);
return sum2;
return(sum2);
}
@ -799,7 +799,7 @@ ipf_pullup(m, fin, plen)
int plen;
{
if (M_LEN(m) >= plen)
return fin->fin_ip;
return(fin->fin_ip);
/*
* Fake ipf_pullup failing
@ -808,5 +808,5 @@ ipf_pullup(m, fin, plen)
*fin->fin_mp = NULL;
fin->fin_m = NULL;
fin->fin_ip = NULL;
return NULL;
return(NULL);
}

View File

@ -44,7 +44,7 @@ in providing a secure IP environment.
\fBipftest\fP will parse any standard ruleset for use with \fBipf\fP,
\fBipnat\fP and/or \fBippool\fP
and apply input, returning output as to the result. However, \fBipftest\fP
will return one of three values for packets passed through the filter:
will( return one of three values for packets passed through the filter:);
pass, block or nomatch. This is intended to give the operator a better
idea of what is happening with packets passing through their filter
ruleset.

View File

@ -143,7 +143,7 @@ main(int argc, char *argv[])
case 'N' :
if (ipnat_parsefile(-1, ipnat_addrule, ipnattestioctl,
optarg) == -1)
return -1;
return(-1);
loaded = 1;
opts |= OPT_NAT;
break;
@ -152,13 +152,13 @@ main(int argc, char *argv[])
break;
case 'P' :
if (ippool_parsefile(-1, optarg, ipooltestioctl) == -1)
return -1;
return(-1);
loaded = 1;
break;
case 'r' :
if (ipf_parsefile(-1, ipf_addrule, iocfunctions,
optarg) == -1)
return -1;
return(-1);
loaded = 1;
break;
case 'S' :
@ -256,7 +256,7 @@ main(int argc, char *argv[])
(void)printf("block return-icmp-as-dest");
break;
default :
(void)printf("recognised return %#x\n", i);
(void)printf("recognised( return %#x\n", i));
break;
}
@ -325,7 +325,7 @@ main(int argc, char *argv[])
fflush(stdout);
abort();
}
return 0;
return(0);
}
@ -346,9 +346,9 @@ int ipftestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i, softc->ipf_interror);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -370,9 +370,9 @@ ipnattestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -394,9 +394,9 @@ ipstatetestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -418,9 +418,9 @@ ipauthtestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -442,9 +442,9 @@ ipscantestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -466,9 +466,9 @@ ipsynctestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -490,9 +490,9 @@ ipooltestioctl(int dev, ioctlcmd_t cmd, ...)
(u_int)cmd, data, i, softc->ipf_interror);
if (i != 0) {
errno = i;
return -1;
return(-1);
}
return 0;
return(0);
}
@ -500,7 +500,7 @@ int
kmemcpy(char *addr, long offset, int size)
{
bcopy((char *)offset, addr, size);
return 0;
return(0);
}
@ -513,7 +513,7 @@ kstrncpy(char *buf, long pos, int n)
while ((n > 0) && (*buf++ = *ptr++))
;
return 0;
return(0);
}

View File

@ -166,15 +166,15 @@ white [ \t\r]+
%%
{white} ;
\n { lineNum++; swallow(); }
\{ { push_proto(); return next_item('{'); }
\} { pop_proto(); return next_item('}'); }
; { return next_item(';'); }
[0-9]+ { return next_item(IL_NUMBER); }
[0-9a-fA-F] { return next_item(IL_HEXDIGIT); }
: { return next_item(IL_COLON); }
#[^\n]* { return next_item(IL_COMMENT); }
[^ \{\}\n\t;:{}]* { return next_item(IL_TOKEN); }
\"[^\"]*\" { return next_item(IL_TOKEN); }
\{ {( push_proto(); return next_item('{'); });
\} {( pop_proto(); return next_item('}'); });
; {( return next_item(';'); });
[0-9]+ {( return next_item(IL_NUMBER); });
[0-9a-fA-F] {( return next_item(IL_HEXDIGIT); });
: {( return next_item(IL_COLON); });
#[^\n]* {( return next_item(IL_COMMENT); });
[^( \{\}\n\t;:{}]* { return next_item(IL_TOKEN); });
\"[^\"]*\" {( return next_item(IL_TOKEN); });
%%
void yyerror(msg)
char *msg;
@ -214,7 +214,7 @@ int save_token(void)
{
yylval.str = strdup((char *)yytext);
return IL_TOKEN;
return(IL_TOKEN);
}
@ -226,20 +226,20 @@ int next_item(int nstate)
printf("text=[%s] id=%d next=%d\n", yytext, nstate, next);
if (next == IL_TOKEN) {
next = -1;
return save_token();
return(save_token());
}
token++;
for (wt = words; wt->word; wt++)
if (!strcasecmp(wt->word, (char *)yytext))
return next_state(wt->state, wt->next);
return(next_state(wt->state, wt->next));
if (opts & OPT_DEBUG)
printf("unknown keyword=[%s]\n", yytext);
next = -1;
if (nstate == IL_NUMBER)
yylval.num = atoi((char *)yytext);
token++;
return nstate;
return(nstate);
}
@ -298,7 +298,7 @@ int next_state(int nstate, int fornext)
nstate = IL_UDPLEN;
break;
}
return nstate;
return(nstate);
}

View File

@ -600,7 +600,7 @@ char *arg;
bcopy(hp->h_addr, &in.s_addr, sizeof(struct in_addr));
else
in.s_addr = inet_addr(arg);
return in;
return(in);
}
@ -610,8 +610,8 @@ char *pr, *name;
struct servent *sp;
if (!(sp = getservbyname(name, pr)))
return htons(atoi(name));
return sp->s_port;
return(htons(atoi(name)));
return(sp->s_port);
}
@ -629,7 +629,7 @@ struct ether_addr *geteaddr(char *arg, struct ether_addr *buf)
bcopy(e->ether_addr_octet, buf->ether_addr_octet,
sizeof(e->ether_addr_octet));
# endif
return e;
return(e);
}
@ -669,7 +669,7 @@ void *new_header(int type)
else if (aip->ah_p == IPPROTO_UDP)
aip->ah_udp->uh_ulen += sz;
}
return (void *)canip->ah_data;
return(void *)canip->ah_data;
}
@ -1371,9 +1371,9 @@ int arp_getipv4(char *ip, char *addr)
for (a = arplist; a; a = a->arp_next)
if (!bcmp(ip, (char *)&a->arp_addr, 4)) {
bcopy((char *)&a->arp_eaddr, addr, 6);
return 0;
return(0);
}
return -1;
return(-1);
}
@ -1742,7 +1742,7 @@ u_short c_chksum(u_short *buf, u_int len, u_long init)
sum += *buf++;
sum = (sum>>16) + (sum & 0xffff);
sum += (sum >>16);
return (~sum);
return(~sum);
}
@ -1753,5 +1753,5 @@ u_long p_chksum(u_short *buf, u_int len)
for(; nwords > 0; nwords--)
sum += *buf++;
return sum;
return(sum);
}

View File

@ -307,19 +307,19 @@ find_icmpsubtype(int type, icmp_subtype_t *table, size_t tablesz)
int i;
if (tablesz < 2)
return NULL;
return(NULL);
if ((type < 0) || (type > table[tablesz - 2].ist_val))
return NULL;
return(NULL);
i = type;
if (table[type].ist_val == type)
return table + type;
return(table + type);
for (i = 0, ist = table; ist->ist_val != -2; i++, ist++)
if (ist->ist_val == type)
return ist;
return NULL;
return(ist);
return(NULL);
}
@ -330,19 +330,19 @@ find_icmptype(int type, icmp_type_t *table, size_t tablesz)
int i;
if (tablesz < 2)
return NULL;
return(NULL);
if ((type < 0) || (type > table[tablesz - 2].it_val))
return NULL;
return(NULL);
i = type;
if (table[type].it_val == type)
return table + type;
return(table + type);
for (i = 0, it = table; it->it_val != -2; i++, it++)
if (it->it_val == type)
return it;
return NULL;
return(it);
return(NULL);
}
@ -447,7 +447,7 @@ getlocalproto(u_int p)
sprintf(pnum, "%u", p);
s = pnum;
}
return s;
return(s);
}
@ -461,11 +461,11 @@ read_log(int fd, int *lenp, char *buf, int bufsize)
nr = read(fd, buf, bufsize);
if (!nr)
return 2;
return(2);
if ((nr < 0) && (errno != EINTR))
return -1;
return(-1);
*lenp = nr;
return 0;
return(0);
}
@ -482,7 +482,7 @@ portlocalname(res, proto, port)
port &= 0xffff;
sprintf(pname, "%u", port);
if (!res || (ipmonopts & IPMON_PORTNUM))
return pname;
return(pname);
s = NULL;
if (!strcmp(proto, "tcp"))
s = tcp_ports[port];
@ -490,7 +490,7 @@ portlocalname(res, proto, port)
s = udp_ports[port];
if (s == NULL)
s = pname;
return s;
return(s);
}
@ -521,7 +521,7 @@ icmpname(u_int type, u_int code)
else
sprintf(name + strlen(name), "%d", code);
return name;
return(name);
}
static char *
@ -551,7 +551,7 @@ icmpname6(u_int type, u_int code)
else
sprintf(name + strlen(name), "%d", code);
return name;
return(name);
}
@ -624,7 +624,7 @@ get_tm(time_t sec)
t = sec;
tm = localtime(&t);
return tm;
return(tm);
}
static void
@ -1775,11 +1775,11 @@ read_loginfo(config_t *conf)
n = select(conf->maxfd + 1, &fdr, NULL, NULL, NULL);
if (n == 0)
return 1;
return(1);
if (n == -1) {
if (errno == EINTR)
return 1;
return -1;
return(1);
return(-1);
}
for (i = 0, nr = 0; i < 3; i++) {
@ -1792,7 +1792,7 @@ read_loginfo(config_t *conf)
if (l->regular) {
tr = (lseek(l->fd, 0, SEEK_CUR) < l->size);
if (!tr && !(ipmonopts & IPMON_TAIL))
return 0;
return(0);
}
n = 0;
@ -1828,13 +1828,13 @@ read_loginfo(config_t *conf)
else {
ipferror(l->fd, "read");
}
return 0;
return(0);
case 1 :
if (ipmonopts & IPMON_SYSLOG)
syslog(LOG_CRIT, "aborting logging\n");
else if (conf->log != NULL)
fprintf(conf->log, "aborting logging\n");
return 0;
return(0);
case 2 :
break;
case 0 :
@ -1851,5 +1851,5 @@ read_loginfo(config_t *conf)
if (!nr && (ipmonopts & IPMON_TAIL))
sleep(1);
return 1;
return(1);
}

View File

@ -243,7 +243,7 @@ typeopt:
ipv4: YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER
{ if ($1 > 255 || $3 > 255 || $5 > 255 || $7 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
$$.s_addr = ($1 << 24) | ($3 << 16) | ($5 << 8) | $7;
$$.s_addr = htonl($$.s_addr);
@ -311,7 +311,7 @@ new_opt(int type)
o->o_line = yylineNum;
o->o_logfac = -1;
o->o_logpri = -1;
return o;
return(o);
}
static void
@ -620,7 +620,7 @@ check_action(char *buf, char *log, int opts, int lvl)
(*d->ipmd_store)(d->ipmd_token, &msg);
}
return matched;
return(matched);
}
@ -665,13 +665,13 @@ load_config(char *file)
fp = fopen(file, "r");
if (!fp) {
perror("load_config:fopen:");
return -1;
return(-1);
}
yyin = fp;
while (!feof(fp))
yyparse();
fclose(fp);
return 0;
return(0);
}
@ -749,15 +749,15 @@ add_doing(ipmon_saver_t *saver)
ipmon_saver_int_t *it;
if (find_doing(saver->ims_name) == IPM_DOING)
return NULL;
return(NULL);
it = calloc(1, sizeof(*it));
if (it == NULL)
return NULL;
return(NULL);
it->imsi_stor = saver;
it->imsi_next = saverlist;
saverlist = it;
return it;
return(it);
}
@ -768,9 +768,9 @@ find_doing(char *string)
for (it = saverlist; it != NULL; it = it->imsi_next) {
if (!strcmp(it->imsi_stor->ims_name, string))
return IPM_DOING;
return(IPM_DOING);
}
return 0;
return(0);
}
@ -785,7 +785,7 @@ build_doing(char *target, char *options)
d = calloc(1, sizeof(*d));
if (d == NULL)
return NULL;
return(NULL);
for (it = saverlist; it != NULL; it = it->imsi_next) {
if (!strcmp(it->imsi_stor->ims_name, target))
@ -793,7 +793,7 @@ build_doing(char *target, char *options)
}
if (it == NULL) {
free(d);
return NULL;
return(NULL);
}
strarray[0] = options;
@ -802,7 +802,7 @@ build_doing(char *target, char *options)
d->ipmd_token = (*it->imsi_stor->ims_parse)(strarray);
if (d->ipmd_token == NULL) {
free(d);
return NULL;
return(NULL);
}
save = it->imsi_stor;
@ -827,7 +827,7 @@ build_doing(char *target, char *options)
}
}
return d;
return(d);
}
@ -974,11 +974,11 @@ install_saver(char *name, char *path)
char nbuf[80];
if (find_doing(name) == IPM_DOING)
return -1;
return(-1);
isi = calloc(1, sizeof(*isi));
if (isi == NULL)
return -1;
return(-1);
is = calloc(1, sizeof(*is));
if (is == NULL)
@ -1026,7 +1026,7 @@ install_saver(char *name, char *path)
isi->imsi_next = saverlist;
saverlist = isi;
return 0;
return(0);
loaderror:
if (isi->imsi_handle != NULL)
@ -1034,5 +1034,5 @@ loaderror:
free(isi);
if (is != NULL)
free(is);
return -1;
return(-1);
}

View File

@ -252,8 +252,8 @@ are always in the
.I inbound
,
.I outbound
order. In this case, hme0 would be the return interface and le0 would be
the outgoing interface. If you wish to allow return packets on any
order.( In this case, hme0 would be the return interface and le0 would be);
the( outgoing interface. If you wish to allow return packets on any);
interface, the correct syntax to use would be:
.nf

View File

@ -221,11 +221,11 @@ main(int argc, char *argv[])
if (opts & (OPT_FLUSH|OPT_CLEAR))
flushtable(fd, opts, natfilter);
if (file) {
return ipnat_parsefile(fd, ipnat_addrule, ioctl, file);
return(ipnat_parsefile(fd, ipnat_addrule, ioctl, file));
}
if (opts & (OPT_LIST|OPT_STAT))
dostats(fd, nsp, opts, 1, natfilter);
return 0;
return(0);
}
@ -829,5 +829,5 @@ nat_matcharray(nat_t *nat, int *array)
break;
}
return rv;
return(rv);
}

View File

@ -1213,7 +1213,7 @@ ipaddr: ipv4 { $$ = $1; }
ipv4: YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER
{ if ($1 > 255 || $3 > 255 || $5 > 255 || $7 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
bzero((char *)&$$, sizeof($$));
$$.a.in4.s_addr = ($1 << 24) | ($3 << 16) | ($5 << 8) | $7;
@ -1316,7 +1316,7 @@ ipnat_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t ioctlfunc,
if (!fp) {
FPRINTF(stderr, "fopen(%s) failed: %s\n", filename,
STRERROR(errno));
return -1;
return(-1);
}
} else
fp = stdin;
@ -1329,7 +1329,7 @@ ipnat_parsefile(int fd, addfunc_t addfunc, ioctlfunc_t ioctlfunc,
rval = 0;
else if (rval != 0)
rval = 1;
return rval;
return(rval);
}
@ -1346,14 +1346,14 @@ ipnat_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t ioctlfunc,
natioctlfunc = ioctlfunc;
if (feof(fp))
return -1;
return(-1);
i = fgetc(fp);
if (i == EOF)
return -1;
return(-1);
if (ungetc(i, fp) == EOF)
return -1;
return(-1);
if (feof(fp))
return -1;
return(-1);
s = getenv("YYDEBUG");
if (s)
yydebug = atoi(s);
@ -1362,7 +1362,7 @@ ipnat_parsesome(int fd, addfunc_t addfunc, ioctlfunc_t ioctlfunc,
yyin = fp;
yyparse();
return parser_error;
return(parser_error);
}
@ -1499,7 +1499,7 @@ ipnat_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg, sizeof(msg), "%d:ioctl(zero nat rule)",
ipn->in_flineno);
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
} else {
PRINTF("hits %lu ", ipn->in_hits);
@ -1519,7 +1519,7 @@ ipnat_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg, sizeof(msg), "%d:ioctl(delete nat rule)",
ipn->in_flineno);
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
}
} else {
@ -1534,11 +1534,11 @@ ipnat_addrule(int fd, ioctlfunc_t ioctlfunc, void *ptr)
snprintf(msg + strlen_msg, sizeof(msg) -strlen_msg, "(line %d)",
ipn->in_flineno);
}
return ipf_perror_fd(fd, ioctlfunc, msg);
return(ipf_perror_fd(fd, ioctlfunc, msg));
}
}
}
return 0;
return(0);
}
@ -1606,7 +1606,7 @@ proxy_dns_add_pass(char *prefix, char *name)
strcat(n->na_name, name);
}
}
return n;
return(n);
}
@ -1626,7 +1626,7 @@ proxy_dns_add_block(char *prefix, char *name)
}
n->na_value = 1;
}
return n;
return(n);
}
@ -1734,7 +1734,7 @@ addname(ipnat_t **np, char *name)
nattop = n;
*np = n;
if (n == NULL)
return -1;
return(-1);
if (n->in_pnext != NULL)
*n->in_pnext = n;
n->in_size += nlen;
@ -1742,5 +1742,5 @@ addname(ipnat_t **np, char *name)
n->in_namelen += nlen;
strcpy(n->in_names + pos, name);
n->in_names[n->in_namelen] = '\0';
return pos;
return(pos);
}

View File

@ -122,7 +122,7 @@ main(int argc, char *argv[])
if (err != 0)
exit(1);
return 0;
return(0);
}
@ -161,23 +161,23 @@ poolnodecommand(int remove, int argc, char *argv[])
if (ipset == 1) {
fprintf(stderr,
"cannot set role after ip address\n");
return -1;
return(-1);
}
role = getrole(optarg);
if (role == IPL_LOGNONE)
return -1;
return(-1);
break;
case 't' :
if (ipset == 1) {
fprintf(stderr,
"cannot set type after ip address\n");
return -1;
return(-1);
}
type = gettype(optarg, NULL);
switch (type) {
case IPLT_NONE :
fprintf(stderr, "unknown type '%s'\n", optarg);
return -1;
return(-1);
case IPLT_HASH :
ptr = &hnode;
break;
@ -191,7 +191,7 @@ poolnodecommand(int remove, int argc, char *argv[])
ttl = atoi(optarg);
if (ttl < 0) {
fprintf(stderr, "cannot set negative ttl\n");
return -1;
return(-1);
}
} else {
usage(argv[0]);
@ -218,12 +218,12 @@ poolnodecommand(int remove, int argc, char *argv[])
if (ipset == 0) {
fprintf(stderr, "no IP address given with -i\n");
return -1;
return(-1);
}
if (poolname == NULL) {
fprintf(stderr, "poolname not given with add/remove node\n");
return -1;
return(-1);
}
switch (type) {
@ -242,7 +242,7 @@ poolnodecommand(int remove, int argc, char *argv[])
default :
break;
}
return err;
return(err);
}
@ -279,7 +279,7 @@ poolcommand(int remove, int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
return -1;
return(-1);
}
break;
case 'S' :
@ -308,7 +308,7 @@ poolcommand(int remove, int argc, char *argv[])
if (poolname == NULL) {
fprintf(stderr, "poolname not given with add/remove pool\n");
return -1;
return(-1);
}
if (type == IPLT_NONE && remove == 0) {
@ -318,7 +318,7 @@ poolcommand(int remove, int argc, char *argv[])
} else {
fprintf(stderr, "unknown type '%s'\n", typearg);
}
return -1;
return(-1);
}
if (type == IPLT_HASH || (type == IPLT_NONE && remove == 1)) {
@ -363,7 +363,7 @@ poolcommand(int remove, int argc, char *argv[])
break;
}
}
return err;
return(err);
}
@ -412,8 +412,8 @@ loadpoolfile(int argc, char *argv[], char *infile)
}
if (ippool_parsefile(fd, infile, ioctl) != 0)
return -1;
return 0;
return(-1);
return(0);
}
@ -441,7 +441,7 @@ poolstats(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
return -1;
return(-1);
}
break;
case 't' :
@ -449,7 +449,7 @@ poolstats(int argc, char *argv[])
if (type != IPLT_POOL) {
fprintf(stderr,
"-s not supported for this type yet\n");
return -1;
return(-1);
}
break;
case 'v' :
@ -482,7 +482,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(S0IOCLOOKUPSTAT)");
return -1;
return(-1);
}
printf("%lu\taddress pools\n", plstat.ipls_pools);
printf("%lu\taddress pool nodes\n", plstat.ipls_nodes);
@ -497,7 +497,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(SIOCLOOKUPSTAT)");
return -1;
return(-1);
}
printf("%lu\thash tables\n", htstat.iphs_numtables);
printf("%lu\thash table nodes\n", htstat.iphs_numnodes);
@ -514,7 +514,7 @@ poolstats(int argc, char *argv[])
c = ioctl(fd, SIOCLOOKUPSTAT, &op);
if (c == -1) {
ipferror(fd, "ioctl(SIOCLOOKUPSTAT)");
return -1;
return(-1);
}
printf("%u\tdestination lists\n",
dlstat.ipls_numlists);
@ -528,7 +528,7 @@ poolstats(int argc, char *argv[])
dlstat.ipls_numderefnodes);
}
}
return 0;
return(0);
}
@ -552,14 +552,14 @@ poolflush(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
return -1;
return(-1);
}
break;
case 't' :
type = gettype(optarg, NULL);
if (type == IPLT_NONE) {
fprintf(stderr, "unknown type '%s'\n", optarg);
return -1;
return(-1);
}
break;
case 'v' :
@ -599,7 +599,7 @@ poolflush(int argc, char *argv[])
printf("%u object%s flushed\n", flush.iplf_count,
(flush.iplf_count == 1) ? "" : "s");
return 0;
return(0);
}
@ -630,7 +630,7 @@ getrole(char *rolename)
role = IPL_LOGNONE;
}
return role;
return(role);
}
@ -652,7 +652,7 @@ gettype(char *typename, u_int *minor)
} else {
type = IPLT_NONE;
}
return type;
return(type);
}
@ -691,7 +691,7 @@ poollist(int argc, char *argv[])
role = getrole(optarg);
if (role == IPL_LOGNONE) {
fprintf(stderr, "unknown role '%s'\n", optarg);
return -1;
return(-1);
}
break;
#if 0
@ -708,7 +708,7 @@ poollist(int argc, char *argv[])
type = gettype(optarg, NULL);
if (type == IPLT_NONE) {
fprintf(stderr, "unknown type '%s'\n", optarg);
return -1;
return(-1);
}
break;
case 'v' :
@ -744,7 +744,7 @@ poollist(int argc, char *argv[])
poollist_live(role, poolname, type, fd);
else
poollist_dead(role, poolname, type, kernel, core);
return 0;
return(0);
}
@ -1044,7 +1044,7 @@ setnodeaddr(int type, int role, void *ptr, char *arg)
mask.s_addr = 0xffffffff;
else if (strchr(s, '.') == NULL) {
if (ntomask(AF_INET, atoi(s + 1), &mask.s_addr) != 0)
return -1;
return(-1);
} else {
mask.s_addr = inet_addr(s + 1);
}
@ -1110,5 +1110,5 @@ setnodeaddr(int type, int role, void *ptr, char *arg)
#endif
}
return 0;
return(0);
}

View File

@ -426,7 +426,7 @@ seed: IPT_SEED '=' YY_NUMBER { ipht.iph_seed = $3; }
ipv4: YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER '.' YY_NUMBER
{ if ($1 > 255 || $3 > 255 || $5 > 255 || $7 > 255) {
yyerror("Invalid octet string for IP address");
return 0;
return(0);
}
$$.s_addr = ($1 << 24) | ($3 << 16) | ($5 << 8) | $7;
$$.s_addr = htonl($$.s_addr);
@ -629,7 +629,7 @@ ippool_parsefile(int fd, char *filename, ioctlfunc_t iocfunc)
if (!fp) {
fprintf(stderr, "fopen(%s) failed: %s\n", filename,
STRERROR(errno));
return -1;
return(-1);
}
} else
fp = stdin;
@ -638,7 +638,7 @@ ippool_parsefile(int fd, char *filename, ioctlfunc_t iocfunc)
;
if (fp != NULL)
fclose(fp);
return 0;
return(0);
}
@ -651,14 +651,14 @@ ippool_parsesome(int fd, FILE *fp, ioctlfunc_t iocfunc)
poolioctl = iocfunc;
if (feof(fp))
return 0;
return(0);
i = fgetc(fp);
if (i == EOF)
return 0;
return(0);
if (ungetc(i, fp) == EOF)
return 0;
return(0);
if (feof(fp))
return 0;
return(0);
s = getenv("YYDEBUG");
if (s)
yydebug = atoi(s);
@ -667,7 +667,7 @@ ippool_parsesome(int fd, FILE *fp, ioctlfunc_t iocfunc)
yyin = fp;
yyparse();
return 1;
return(1);
}
@ -684,7 +684,7 @@ add_htablehosts(char *url)
hlist = calloc(1, sizeof(*hlist));
if (hlist == NULL)
return NULL;
return(NULL);
if (gethost(hlist->al_family, url, &hlist->al_i6addr) == -1) {
yyerror("Unknown hostname");
@ -712,7 +712,7 @@ add_htablehosts(char *url)
alist_free(hlist);
return htop;
return(htop);
}
@ -729,7 +729,7 @@ add_poolhosts(char *url)
hlist = calloc(1, sizeof(*hlist));
if (hlist == NULL)
return NULL;
return(NULL);
if (gethost(hlist->al_family, url, &hlist->al_i6addr) == -1) {
yyerror("Unknown hostname");
@ -766,7 +766,7 @@ add_poolhosts(char *url)
alist_free(hlist);
return ptop;
return(ptop);
}
@ -779,7 +779,7 @@ read_whoisfile(char *file)
fp = fopen(file, "r");
if (fp == NULL)
return NULL;
return(NULL);
last = NULL;
ntop = NULL;
@ -800,7 +800,7 @@ read_whoisfile(char *file)
last = ipn;
}
fclose(fp);
return ntop;
return(ntop);
}

View File

@ -251,7 +251,7 @@ cram(char *dst, char *src)
} else
*u++ = c, i++;
}
return i;
return(i);
}
@ -411,7 +411,7 @@ makepair(char *s1, char *s2)
a = malloc(sizeof(char *) * 2);
a[0] = s1;
a[1] = s2;
return a;
return(a);
}
@ -429,7 +429,7 @@ combine(int a1, int a2, int a3, int a4)
a4 &= 0xff;
in.s_addr |= a4;
in.s_addr = htonl(in.s_addr);
return in;
return(in);
}
@ -443,9 +443,9 @@ gethostip(char *host)
hp = gethostbyname(host);
if (!hp)
return in;
return(in);
bcopy(hp->h_addr, (char *)&in, sizeof(in));
return in;
return(in);
}
@ -456,8 +456,8 @@ getportnum(char *port)
s = getservbyname(port, "tcp");
if (s == NULL)
return -1;
return s->s_port;
return(-1);
return(s->s_port);
}

View File

@ -46,13 +46,13 @@ int resolve(char *host, char *address)
if (!(hp = gethostbyname(host)))
{
fprintf(stderr, "unknown host: %s\n", host);
return -1;
return(-1);
}
bcopy((char *)hp->h_addr, (char *)address, 4);
return 0;
return(0);
}
bcopy((char*)&add, address, 4);
return 0;
return(0);
}
@ -67,11 +67,11 @@ int arp(char *addr, char *eaddr)
#ifdef IPSEND
if (arp_getipv4(addr, ether) == 0)
return 0;
return(0);
#endif
if (!addr)
return -1;
return(-1);
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
@ -109,8 +109,8 @@ int arp(char *addr, char *eaddr)
sizeof(struct in_addr)))
{
bcopy(LLADDR(sdl), eaddr, sdl->sdl_alen);
return 0;
return(0);
}
}
return -1;
return(-1);
}

View File

@ -45,13 +45,13 @@ int resolve(char *host, char *address)
if (!(hp = gethostbyname(host)))
{
fprintf(stderr, "unknown host: %s\n", host);
return -1;
return(-1);
}
bcopy((char *)hp->h_addr, (char *)address, 4);
return 0;
return(0);
}
bcopy((char*)&add, address, 4);
return 0;
return(0);
}
/*
@ -72,11 +72,11 @@ int arp(ip, ether)
#ifdef IPSEND
if (arp_getipv4(ip, ether) == 0)
return 0;
return(0);
#endif
if (!bcmp(ipsave, ip, 4)) {
bcopy(ethersave, ether, 6);
return 0;
return(0);
}
fd = -1;
bzero((char *)&ar, sizeof(ar));
@ -95,7 +95,7 @@ int arp(ip, ether)
if ((sfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
perror("arp: socket");
return -1;
return(-1);
}
tryagain:
if (ioctl(sfd, SIOCGARP, (caddr_t)&ar) == -1)
@ -116,19 +116,19 @@ int arp(ip, ether)
fprintf(stderr, "(%s):", inet_ntoa(sin->sin_addr));
if (errno != ENXIO)
perror("SIOCGARP");
return -1;
return(-1);
}
if ((ar.arp_ha.sa_data[0] == 0) && (ar.arp_ha.sa_data[1] == 0) &&
(ar.arp_ha.sa_data[2] == 0) && (ar.arp_ha.sa_data[3] == 0) &&
(ar.arp_ha.sa_data[4] == 0) && (ar.arp_ha.sa_data[5] == 0)) {
fprintf(stderr, "(%s):", inet_ntoa(sin->sin_addr));
return -1;
return(-1);
}
bcopy(ar.arp_ha.sa_data, ether, 6);
savearp:
bcopy(ether, ethersave, 6);
bcopy(ip, ipsave, 4);
return 0;
return(0);
}

View File

@ -26,7 +26,7 @@ typedef unsigned long ulong;
#include <string.h>
#include "dltest.h"
#define CASERET(s) case s: return ("s")
#define CASERET(s) case s: return("s")
char *dlprim();
char *dlstate();
@ -1056,7 +1056,7 @@ stringtoaddr(char *sp, char *addr)
p = NULL;
}
return (n);
return(n);
}
@ -1068,7 +1068,7 @@ hexnibble(char c)
'a', 'b', 'c', 'd', 'e', 'f'
};
return (hextab[c & 0x0f]);
return(hextab[c & 0x0f]);
}
char*
@ -1106,7 +1106,7 @@ dlprim(u_long prim)
CASERET(DL_RESET_CON);
default:
(void) snprintf(primbuf, sizeof(primbuf), "unknown primitive 0x%x", prim);
return (primbuf);
return(primbuf);
}
}
@ -1140,7 +1140,7 @@ dlstate(u_long state)
CASERET(DL_SUBS_BIND_PND);
default:
(void) snprintf(statebuf, sizeof(statebuf), "unknown state 0x%x", state);
return (statebuf);
return(statebuf);
}
}
@ -1181,7 +1181,7 @@ dlerrno(u_long errno)
default:
(void) snprintf(errnobuf, sizeof(errnobuf), "unknown dlpi errno 0x%x", errno);
return (errnobuf);
return(errnobuf);
}
}
@ -1196,7 +1196,7 @@ dlpromisclevel(u_long level)
CASERET(DL_PROMISC_MULTI);
default:
(void) snprintf(levelbuf, sizeof(levelbuf), "unknown promisc level 0x%x", level);
return (levelbuf);
return(levelbuf);
}
}
@ -1212,7 +1212,7 @@ dlservicemode(u_long servicemode)
default:
(void) snprintf(servicemodebuf, sizeof(servicemodebuf),
"unknown provider service mode 0x%x", servicemode);
return (servicemodebuf);
return(servicemodebuf);
}
}
@ -1226,7 +1226,7 @@ dlstyle(long style)
CASERET(DL_STYLE2);
default:
(void) snprintf(stylebuf, sizeof(stylebuf), "unknown provider style 0x%x", style);
return (stylebuf);
return(stylebuf);
}
}
@ -1246,7 +1246,7 @@ dlmactype(u_long media)
CASERET(DL_CTCA);
default:
(void) snprintf(mediabuf, sizeof(mediabuf), "unknown media type 0x%x", media);
return (mediabuf);
return(mediabuf);
}
}
@ -1277,7 +1277,7 @@ strioctl(int fd, int cmd, int timout, int len, char *dp)
rc = ioctl(fd, I_STR, &sioc);
if (rc < 0)
return (rc);
return(rc);
else
return (sioc.ic_len);
return(sioc.ic_len);
}

View File

@ -41,7 +41,7 @@ chksum(u_short *buf, int len)
sum += *buf++;
sum = (sum>>16) + (sum & 0xffff);
sum += (sum >>16);
return (~sum);
return(~sum);
}
@ -67,12 +67,12 @@ send_ether(int nfd, char *buf, int len, struct in_addr gwip)
else if (arp((char *)&gwip, (char *) &eh->ether_dhost) == -1)
{
perror("arp");
return -2;
return(-2);
}
eh->ether_type = htons(ETHERTYPE_IP);
last_gw.s_addr = gwip.s_addr;
err = sendip(nfd, s, sizeof(*eh) + len);
return err;
return(err);
}
@ -95,7 +95,7 @@ send_ip(int nfd, int mtu, ip_t *ip, struct in_addr gwip, int frag)
if (!ipbuf)
{
perror("malloc failed");
return -2;
return(-2);
}
}
@ -109,7 +109,7 @@ send_ip(int nfd, int mtu, ip_t *ip, struct in_addr gwip, int frag)
else if (arp((char *)&gwip, (char *) &eh->ether_dhost) == -1)
{
perror("arp");
return -2;
return(-2);
}
bcopy((char *) &eh->ether_dhost, last_arp, sizeof(last_arp));
eh->ether_type = htons(ETHERTYPE_IP);
@ -159,7 +159,7 @@ send_ip(int nfd, int mtu, ip_t *ip, struct in_addr gwip, int frag)
fprintf(stderr, "mtu (%d) < ip header size (%d) + 8\n",
mtu, hlen);
fprintf(stderr, "can't fragment data\n");
return -2;
return(-2);
}
ol = (IP_HL(ip) << 2) - sizeof(*ip);
for (i = 0, s = (char*)(ip + 1); ol > 0; )
@ -229,7 +229,7 @@ send_ip(int nfd, int mtu, ip_t *ip, struct in_addr gwip, int frag)
}
bcopy((char *)&ipsv, (char *)ip, sizeof(*ip));
return err;
return(err);
}
@ -280,7 +280,7 @@ send_tcp(int nfd, int mtu, ip_t *ip, struct in_addr gwip)
t2->th_sum = chksum((u_short *)ip2, thlen + sizeof(ip_t));
bcopy((char *)t2, (char *)ip + hlen, thlen);
return send_ip(nfd, mtu, ip, gwip, 1);
return(send_ip(nfd, mtu, ip, gwip, 1));
}
@ -310,7 +310,7 @@ send_udp(int nfd, int mtu, ip_t *ip, struct in_addr gwip)
bcopy((char *)&ti->ti_sport,
(char *)ip + (IP_HL(ip) << 2), sizeof(udphdr_t));
return send_ip(nfd, mtu, ip, gwip, 1);
return(send_ip(nfd, mtu, ip, gwip, 1));
}
@ -327,7 +327,7 @@ send_icmp(int nfd, int mtu, ip_t *ip, in_addr gwip)
ic->icmp_cksum = 0;
ic->icmp_cksum = chksum((u_short *)ic, sizeof(struct icmp));
return send_ip(nfd, mtu, ip, gwip, 1);
return(send_ip(nfd, mtu, ip, gwip, 1));
}
@ -340,12 +340,12 @@ send_packet(int nfd, int mtu, ip_t *ip, struct in_addr gwip)
switch (ip->ip_p)
{
case IPPROTO_TCP :
return send_tcp(nfd, mtu, ip, gwip);
( return send_tcp(nfd, mtu, ip, gwip));
case IPPROTO_UDP :
return send_udp(nfd, mtu, ip, gwip);
( return send_udp(nfd, mtu, ip, gwip));
case IPPROTO_ICMP :
return send_icmp(nfd, mtu, ip, gwip);
( return send_icmp(nfd, mtu, ip, gwip));
default :
return send_ip(nfd, mtu, ip, gwip, 1);
( return send_ip(nfd, mtu, ip, gwip, 1));
}
}

View File

@ -128,5 +128,5 @@ main(int argc, char **argv)
printf("Gateway: %s\n", inet_ntoa(gwip));
printf("mtu: %d\n", mtu);
return ip_resend(dev, mtu, ipr, gwip, resend);
return(ip_resend(dev, mtu, ipr, gwip, resend));
}

View File

@ -128,8 +128,8 @@ send_packets(char *dev, int mtu, ip_t *ip, struct in_addr gwip)
wfd = initdevice(dev, 5);
if (wfd == -1)
return -1;
return send_packet(wfd, mtu, ip, gwip);
return(-1);
return(send_packet(wfd, mtu, ip, gwip));
}
void
@ -213,7 +213,7 @@ main(int argc, char **argv)
exit(1);
}
iplang(langfile);
return 0;
return(0);
case 'P' :
{
struct protoent *p;
@ -405,7 +405,7 @@ main(int argc, char **argv)
}
#ifdef DOSOCKET
if (ip->ip_p == IPPROTO_TCP && tcp->th_dport)
return do_socket(dev, mtu, ip, gwip);
return(do_socket(dev, mtu, ip, gwip));
#endif
return send_packets(dev, mtu, ip, gwip);
return(send_packets(dev, mtu, ip, gwip));
}

View File

@ -66,9 +66,9 @@ u_short ipseclevel(slevel)
if (!so->on_name) {
fprintf(stderr, "no such security level: %s\n", slevel);
return 0;
return(0);
}
return so->on_value;
return(so->on_value);
}
@ -83,7 +83,7 @@ addipopt(char *op, struct ipopt_names *io, int len, char *class)
if ((len + io->on_siz) > 48) {
fprintf(stderr, "options too long\n");
return 0;
return(0);
}
len += io->on_siz;
*op++ = io->on_value;
@ -136,7 +136,7 @@ addipopt(char *op, struct ipopt_names *io, int len, char *class)
else
op += io->on_siz - 3;
}
return len - olen;
return(len - olen);
}
@ -166,7 +166,7 @@ buildopts(char *cp, char *op, int len)
}
if (!io->on_name) {
fprintf(stderr, "unknown IP option name %s\n", s);
return 0;
return(0);
}
}
@ -188,5 +188,5 @@ buildopts(char *cp, char *op, int len)
}
}
}
return len;
return(len);
}

View File

@ -192,5 +192,5 @@ main(int argc, char **argv)
ip_test7(dev, mtu, (ip_t *)ti, gwip, pointtest);
break;
}
return 0;
return(0);
}

View File

@ -74,7 +74,7 @@ ip_resend(char *dev, int mtu, struct ipread *r, struct in_addr gwip,
mb_t mb;
if (wfd == -1)
return -1;
return(-1);
if (datain)
fd = (*r->r_open)(datain);
@ -89,7 +89,7 @@ ip_resend(char *dev, int mtu, struct ipread *r, struct in_addr gwip,
if(!eh)
{
perror("malloc failed");
return -2;
return(-2);
}
bzero((char *) &eh->ether_shost, sizeof(eh->ether_shost));
@ -97,7 +97,7 @@ ip_resend(char *dev, int mtu, struct ipread *r, struct in_addr gwip,
{
perror("arp");
free(eh);
return -2;
return(-2);
}
while ((i = (*r->r_readip)(&mb, NULL, NULL)) > 0)
@ -134,5 +134,5 @@ ip_resend(char *dev, int mtu, struct ipread *r, struct in_addr gwip,
}
(*r->r_close)();
free(eh);
return 0;
return(0);
}

View File

@ -65,7 +65,7 @@ initdevice(char *device, int tout)
if ((fd = open(bpfname, O_RDWR)) < 0)
{
fprintf(stderr, "no bpf devices available as /dev/bpfxx\n");
return -1;
return(-1);
}
#else
char bpfname[16];
@ -80,14 +80,14 @@ initdevice(char *device, int tout)
if (i == 16)
{
fprintf(stderr, "no bpf devices available as /dev/bpfxx\n");
return -1;
return(-1);
}
#endif
if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0)
{
perror("BIOCVERSION");
return -1;
return(-1);
}
if (bv.bv_major != BPF_MAJOR_VERSION ||
bv.bv_minor < BPF_MINOR_VERSION)
@ -96,7 +96,7 @@ initdevice(char *device, int tout)
bv.bv_major, bv.bv_minor);
fprintf(stderr, "current version: %d.%d\n",
BPF_MAJOR_VERSION, BPF_MINOR_VERSION);
return -1;
return(-1);
}
(void) strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
@ -128,7 +128,7 @@ initdevice(char *device, int tout)
}
(void) ioctl(fd, BIOCFLUSH, 0);
return fd;
return(fd);
}
@ -141,8 +141,8 @@ sendip(int fd, char *pkt, int len)
if (write(fd, pkt, len) == -1)
{
perror("send");
return -1;
return(-1);
}
return len;
return(len);
}

View File

@ -119,7 +119,7 @@ initdevice(char *device, int tout)
exit(-1);
}
#endif
return fd;
return(fd);
}
@ -154,13 +154,13 @@ sendip(int fd, char *pkt, int len)
if (putmsg(fd, cp, dp, pri) == -1)
{
perror("putmsg");
return -1;
return(-1);
}
if (ioctl(fd, I_FLUSH, FLUSHW) == -1)
{
perror("I_FLUSHW");
return -1;
return(-1);
}
return len;
return(len);
}

View File

@ -106,7 +106,7 @@ initdevice(char *device, int tout)
perror(ifr.ifr_name);
exit(1);
}
return fd;
return(fd);
}
@ -125,7 +125,7 @@ sendip(int fd, char *pkt, int len)
* For ethernet, need at least 802.3 header and IP header.
*/
if (len < (sizeof(sa->sa_data) + sizeof(struct ip)))
return -1;
return(-1);
/*
* to avoid any output processing for IP, say we're not.
*/
@ -148,13 +148,13 @@ sendip(int fd, char *pkt, int len)
if (putmsg(fd, cp, dp, 0) == -1)
{
perror("putmsg");
return -1;
return(-1);
}
if (ioctl(fd, I_FLUSH, FLUSHW) == -1)
{
perror("I_FLUSH");
return -1;
return(-1);
}
return len;
return(len);
}

View File

@ -111,14 +111,14 @@ kmemcpy(char *buf, void *pos, int n)
if (lseek(kfd, offset, SEEK_SET) == -1)
{
perror("lseek");
return -1;
return(-1);
}
if (read(kfd, buf, n) == -1)
{
perror("read");
return -1;
return(-1);
}
return n;
return(n);
}
struct nlist names[4] = {
@ -145,9 +145,9 @@ kinfo_proc *getproc(void)
if (sysctl(mib, 4, &kp, &n, NULL, 0) == -1)
{
perror("sysctl");
return NULL;
return(NULL);
}
return &kp;
return(&kp);
}
@ -162,18 +162,18 @@ find_tcp(int tfd, struct tcpiphdr *ti)
struct file *f, **o;
if (!(p = getproc()))
return NULL;
return(NULL);
fd = (struct filedesc *)malloc(sizeof(*fd));
if (fd == NULL)
return NULL;
return(NULL);
#if defined( __FreeBSD__)
if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1)
{
fprintf(stderr, "read(%#lx,%#lx) failed\n",
(u_long)p, (u_long)p->ki_fd);
free(fd);
return NULL;
return(NULL);
}
#else
if (KMCPY(fd, p->kp_proc.p_fd, sizeof(*fd)) == -1)
@ -181,7 +181,7 @@ find_tcp(int tfd, struct tcpiphdr *ti)
fprintf(stderr, "read(%#lx,%#lx) failed\n",
(u_long)p, (u_long)p->kp_proc.p_fd);
free(fd);
return NULL;
return(NULL);
}
#endif
@ -229,7 +229,7 @@ find_tcp(int tfd, struct tcpiphdr *ti)
(u_long)i->inp_ppcb, (u_long)t, (u_long)sizeof(*t));
goto finderror;
}
return (struct tcpcb *)i->inp_ppcb;
return(struct tcpcb *)i->inp_ppcb;
finderror:
if (o != NULL)
@ -242,7 +242,7 @@ find_tcp(int tfd, struct tcpiphdr *ti)
free(i);
if (t != NULL)
free(t);
return NULL;
return(NULL);
}
int
@ -259,13 +259,13 @@ do_socket(char *dev, int mtu, struct tcpiphdr *ti, struct in_addr gwip)
if (fd == -1)
{
perror("socket");
return -1;
return(-1);
}
if (fcntl(fd, F_SETFL, FNDELAY) == -1)
{
perror("fcntl");
return -1;
return(-1);
}
bzero((char *)&lsin, sizeof(lsin));
@ -275,7 +275,7 @@ do_socket(char *dev, int mtu, struct tcpiphdr *ti, struct in_addr gwip)
if (bind(fd, (struct sockaddr *)&lsin, sizeof(lsin)) == -1)
{
perror("bind");
return -1;
return(-1);
}
len = sizeof(lsin);
(void) getsockname(fd, (struct sockaddr *)&lsin, &len);
@ -284,10 +284,10 @@ do_socket(char *dev, int mtu, struct tcpiphdr *ti, struct in_addr gwip)
nfd = initdevice(dev, 1);
if (nfd == -1)
return -1;
return(-1);
if (!(t = find_tcp(fd, ti)))
return -1;
return(-1);
bzero((char *)&rsin, sizeof(rsin));
rsin.sin_family = AF_INET;
@ -298,7 +298,7 @@ do_socket(char *dev, int mtu, struct tcpiphdr *ti, struct in_addr gwip)
errno != EINPROGRESS)
{
perror("connect");
return -1;
return(-1);
}
KMCPY(&tcb, t, sizeof(tcb));
ti->ti_win = tcb.rcv_adv;
@ -306,9 +306,9 @@ do_socket(char *dev, int mtu, struct tcpiphdr *ti, struct in_addr gwip)
ti->ti_ack = tcb.rcv_nxt;
if (send_tcp(nfd, mtu, (ip_t *)ti, gwip) == -1)
return -1;
return(-1);
(void)write(fd, "Hello World\n", 12);
sleep(2);
close(fd);
return 0;
return(0);
}

View File

@ -47,13 +47,13 @@ initdevice(char *device, int tout)
if ((fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror("socket(AF_INET, SOCK_RAW, IPPROTO_RAW)");
return -1;
return(-1);
}
if (ioctl(fd, SIOCGIFADDR, &ifr) == -1)
{
perror("ioctl SIOCGIFADDR");
return -1;
return(-1);
}
bzero((char *)&s, sizeof(s));
@ -61,7 +61,7 @@ initdevice(char *device, int tout)
bcopy(&ifr.ifr_addr, s.sa_data, 4);
if (bind(fd, &s, sizeof(s)) == -1)
perror("bind");
return fd;
return(fd);
}
@ -83,8 +83,8 @@ int sendip(int fd, char *pkt, int len)
if (sendto(fd, pkt, len, 0, &sin, sizeof(sin)) == -1)
{
perror("send");
return -1;
return(-1);
}
return len;
return(len);
}

View File

@ -22,7 +22,7 @@ addipopt(char *op, struct ipopt_names *io, int len, char *class)
if ((len + io->on_siz) > 48) {
fprintf(stderr, "options too long\n");
return 0;
return(0);
}
len += io->on_siz;
*op++ = io->on_value;
@ -58,5 +58,5 @@ addipopt(char *op, struct ipopt_names *io, int len, char *class)
if (opts & OPT_DEBUG)
fprintf(stderr, "bo: %s %d %#x: %d\n",
io->on_name, io->on_value, io->on_bit, len);
return len - olen;
return(len - olen);
}

View File

@ -24,12 +24,12 @@ alist_new(int family, char *host)
family = AF_INET;
}
if (family != AF_INET && family != AF_INET6)
return NULL;
return(NULL);
al = calloc(1, sizeof(*al));
if (al == NULL) {
fprintf(stderr, "alist_new out of memory\n");
return NULL;
return(NULL);
}
while (ISSPACE(*host))
@ -86,8 +86,8 @@ alist_new(int family, char *host)
al->al_family = family;
if (slash != NULL)
*slash = '/';
return al;
return(al);
bad:
free(al);
return NULL;
return(NULL);
}

View File

@ -15,9 +15,9 @@ allocmbt(size_t len)
m = (mb_t *)malloc(sizeof(mb_t));
if (m == NULL)
return NULL;
return(NULL);
m->mb_len = len;
m->mb_next = NULL;
m->mb_data = (char *)m->mb_buf;
return m;
return(m);
}

View File

@ -14,6 +14,6 @@ int
bcopywrap(void *from, void *to, size_t size)
{
bcopy((caddr_t)from, (caddr_t)to, size);
return 0;
return(0);
}

View File

@ -36,7 +36,7 @@ buildopts(char *cp, char *op, int len)
}
if (!io->on_name) {
fprintf(stderr, "unknown IP option name %s\n", s);
return 0;
return(0);
}
}
while ((len & 3) != 3) {
@ -45,5 +45,5 @@ buildopts(char *cp, char *op, int len)
}
*op++ = IPOPT_EOL;
len++;
return len;
return(len);
}

View File

@ -29,18 +29,18 @@ checkrev(char *ipfname)
if ((vfd == -1) && ((vfd = open(ipfname, O_RDONLY)) == -1)) {
perror("open device");
return -1;
return(-1);
}
if (ioctl(vfd, SIOCGETFS, &obj)) {
ipferror(vfd, "ioctl(SIOCGETFS)");
close(vfd);
vfd = -1;
return -1;
return(-1);
}
if (strncmp(IPL_VERSION, fio.f_version, sizeof(fio.f_version))) {
return -1;
return(-1);
}
return 0;
return(0);
}

View File

@ -25,24 +25,24 @@ connecttcp(char *server, int port)
if (ISDIGIT(*server)) {
if (inet_aton(server, &sin.sin_addr) == -1) {
return -1;
return(-1);
}
} else {
host = gethostbyname(server);
if (host == NULL)
return -1;
return(-1);
memcpy(&sin.sin_addr, host->h_addr_list[0],
sizeof(sin.sin_addr));
}
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd == -1)
return -1;
return(-1);
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
close(fd);
return -1;
return(-1);
}
return fd;
return(fd);
}

View File

@ -13,7 +13,7 @@
/*
* count consecutive 1's in bit mask. If the mask generated by counting
* consecutive 1's is different to that passed, return -1, else return #
* consecutive 1's is different to that passed, return -1, else return #
* of bits.
*/
int
@ -35,6 +35,6 @@ count4bits(u_int ip)
ipn++;
}
if (ipn == ip)
return cnt;
return -1;
return(cnt);
return(-1);
}

View File

@ -25,5 +25,5 @@ count6bits(u_32_t *msk)
if (j & 0x80000000)
i++;
}
return i;
return(i);
}

View File

@ -15,10 +15,10 @@ dupmbt(mb_t *orig)
m = (mb_t *)malloc(sizeof(mb_t));
if (m == NULL)
return NULL;
return(NULL);
m->mb_len = orig->mb_len;
m->mb_next = NULL;
m->mb_data = (char *)m->mb_buf + (orig->mb_data - (char *)orig->mb_buf);
bcopy(orig->mb_data, m->mb_data, m->mb_len);
return m;
return(m);
}

View File

@ -82,13 +82,13 @@ fac_toname(int facpri)
j = fac >> 3;
if (j < (sizeof(facs)/sizeof(facs[0]))) {
if (facs[j].value == fac)
return facs[j].name;
return(facs[j].name);
}
for (i = 0; facs[i].name; i++)
if (fac == facs[i].value)
return facs[i].name;
return(facs[i].name);
return NULL;
return(NULL);
}
@ -102,8 +102,8 @@ fac_findname(char *name)
for (i = 0; facs[i].name; i++)
if (!strcmp(facs[i].name, name))
return facs[i].value;
return -1;
return(facs[i].value);
return(-1);
}
@ -126,8 +126,8 @@ pri_findname(char *name)
for (i = 0; pris[i].name; i++)
if (!strcmp(pris[i].name, name))
return pris[i].value;
return -1;
return(pris[i].value);
return(-1);
}
@ -141,9 +141,9 @@ pri_toname(int facpri)
pri = facpri & LOG_PRIMASK;
if (pris[pri].value == pri)
return pris[pri].name;
return(pris[pri].name);
for (i = 0; pris[i].name; i++)
if (pri == pris[i].value)
return pris[i].name;
return NULL;
return(pris[i].name);
return(NULL);
}

View File

@ -4,10 +4,10 @@ const char *
familyname(int family)
{
if (family == AF_INET)
return "inet";
return("inet");
#ifdef USE_INET6
if (family == AF_INET6)
return "inet6";
return("inet6");
#endif
return "unknown";
return("unknown");
}

View File

@ -18,7 +18,7 @@ findword(wordtab_t *words, char *name)
if (!strcmp(name, w->w_word))
break;
if (w->w_word == NULL)
return NULL;
return(NULL);
return w;
return(w);
}

View File

@ -5,11 +5,11 @@ ftov(int version)
{
#ifdef USE_INET6
if (version == AF_INET6)
return 6;
return(6);
#endif
if (version == AF_INET)
return 4;
return(4);
if (version == AF_UNSPEC)
return 0;
return -1;
return(0);
return(-1);
}

View File

@ -30,7 +30,7 @@ gethost(int family, char *name, i6addr_t *hostp)
hostp->i6[3] = htonl(0xfedcba98);
}
#endif
return 0;
return(0);
}
if (!strcmp(name, "<thishost>"))
@ -43,14 +43,14 @@ gethost(int family, char *name, i6addr_t *hostp)
(h->h_length == sizeof(addr))) {
bcopy(h->h_addr, (char *)&addr, sizeof(addr));
hostp->in4.s_addr = addr;
return 0;
return(0);
}
}
n = getnetbyname(name);
if (n != NULL) {
hostp->in4.s_addr = htonl(n->n_net & 0xffffffff);
return 0;
return(0);
}
}
#ifdef USE_INET6
@ -66,9 +66,9 @@ gethost(int family, char *name, i6addr_t *hostp)
sin6 = (struct sockaddr_in6 *)res->ai_addr;
hostp->in6 = sin6->sin6_addr;
freeaddrinfo(res);
return 0;
return(0);
}
}
#endif
return -1;
return(-1);
}

View File

@ -15,14 +15,14 @@ geticmptype(int family, char *name)
for (i = icmptypelist; i->it_name != NULL; i++) {
if (!strcmp(name, i->it_name)) {
if (family == AF_INET)
return i->it_v4;
return(i->it_v4);
#ifdef USE_INET6
if (family == AF_INET6)
return i->it_v6;
return(i->it_v6);
#endif
return -1;
return(-1);
}
}
return -1;
return(-1);
}

View File

@ -13,7 +13,7 @@
#include "kmem.h"
/*
* Given a pointer to an interface in the kernel, return a pointer to a
* Given a pointer to an interface in the kernel, return a pointer to a
* string which is the interface name.
*/
char *
@ -27,28 +27,28 @@ getifname(struct ifnet *ptr)
qif_t qif;
if ((void *)ptr == (void *)-1)
return "!";
return("!");
if (ptr == NULL)
return "-";
return("-");
if (kmemcpy((char *)&qif, (u_long)ptr, sizeof(qif)) == -1)
return "X";
return("X");
ifname = strdup(qif.qf_name);
if ((ifname != NULL) && (*ifname == '\0')) {
free(ifname);
return "!";
return("!");
}
return ifname;
return(ifname);
#else
struct ifnet netif;
if ((void *)ptr == (void *)-1)
return "!";
return("!");
if (ptr == NULL)
return "-";
return("-");
if (kmemcpy((char *)&netif, (u_long)ptr, sizeof(netif)) == -1)
return "X";
return strdup(netif.if_xname);
return("X");
return(strdup(netif.if_xname));
#endif
}

View File

@ -25,7 +25,7 @@ getnattype(nat_t *nat)
char *which;
if (!nat)
return "???";
return("???");
switch (nat->nat_redir)
{
@ -65,5 +65,5 @@ getnattype(nat_t *nat)
which = unknownbuf;
break;
}
return which;
return(which);
}

View File

@ -22,17 +22,17 @@ getport(frentry_t *fr, char *name, u_short *port, char *proto)
s = getservbyname(name, proto);
if (s != NULL) {
*port = s->s_port;
return 0;
return(0);
}
if (ISDIGIT(*name)) {
int portval = atoi(name);
if (portval < 0 || portval > 65535)
return -1;
return(-1);
*port = htons((u_short)portval);
return 0;
return(0);
}
return -1;
return(-1);
}
/*
@ -51,15 +51,15 @@ getport(frentry_t *fr, char *name, u_short *port, char *proto)
s = getservbyname(name, "udp");
if (s != NULL) {
if (p1 != s->s_port)
return -1;
return(-1);
}
if ((p1 == 0) && (s == NULL))
return -1;
return(-1);
if (p1)
*port = p1;
else
*port = s->s_port;
return 0;
return(0);
}
if ((fr->fr_flx & FI_TCPUDP) != 0) {
@ -69,20 +69,20 @@ getport(frentry_t *fr, char *name, u_short *port, char *proto)
*/
s = getservbyname(name, "tcp");
if (s == NULL)
return -1;
return(-1);
p1 = s->s_port;
s = getservbyname(name, "udp");
if (s == NULL || s->s_port != p1)
return -1;
return(-1);
*port = p1;
return 0;
return(0);
}
p = getprotobynumber(fr->fr_proto);
s = getservbyname(name, p ? p->p_name : NULL);
if (s != NULL) {
*port = s->s_port;
return 0;
return(0);
}
return -1;
return(-1);
}

View File

@ -23,17 +23,17 @@ getportproto(char *name, int proto)
for (s = name; *s != '\0'; s++)
if (!ISDIGIT(*s))
return -1;
return(-1);
number = atoi(name);
if (number < 0 || number > 65535)
return -1;
return htons(number);
return(-1);
return(htons(number));
}
p = getprotobynumber(proto);
s = getservbyname(name, p ? p->p_name : NULL);
if (s != NULL)
return s->s_port;
return -1;
return(s->s_port);
return(-1);
}

View File

@ -23,13 +23,13 @@ getproto(char *name)
if (!ISDIGIT(*s))
break;
if (*s == '\0')
return atoi(name);
return(atoi(name));
if (!strcasecmp(name, "ip"))
return 0;
return(0);
p = getprotobyname(name);
if (p != NULL)
return p->p_proto;
return -1;
return(p->p_proto);
return(-1);
}

View File

@ -19,5 +19,5 @@ getsumd(u_32_t sum)
snprintf(sumdbuf, sizeof(sumdbuf), "hw(%#0x)", sum & 0xffff);
else
snprintf(sumdbuf, sizeof(sumdbuf), "%#0x", sum);
return sumdbuf;
return(sumdbuf);
}

View File

@ -23,7 +23,7 @@ hostname(int family, void *ip)
if (family == AF_INET) {
ipa.s_addr = *(u_32_t *)ip;
if (ipa.s_addr == htonl(0xfedcba98))
return ("test.host.dots");
return("test.host.dots");
}
if ((opts & OPT_NORESOLVE) == 0) {
@ -33,7 +33,7 @@ hostname(int family, void *ip)
*hp->h_name != '\0') {
strncpy(hostbuf, hp->h_name, sizeof(hostbuf));
hostbuf[sizeof(hostbuf) - 1] = '\0';
return (hostbuf);
return(hostbuf);
}
np = getnetbyaddr(ipa.s_addr, AF_INET);
@ -41,19 +41,19 @@ hostname(int family, void *ip)
*np->n_name != '\0') {
strncpy(hostbuf, np->n_name, sizeof(hostbuf));
hostbuf[sizeof(hostbuf) - 1] = '\0';
return (hostbuf);
return(hostbuf);
}
}
}
if (family == AF_INET) {
return (inet_ntoa(ipa));
return(inet_ntoa(ipa));
}
#ifdef USE_INET6
(void) inet_ntop(AF_INET6, ip, hostbuf, sizeof(hostbuf) - 1);
hostbuf[MAXHOSTNAMELEN] = '\0';
return (hostbuf);
return(hostbuf);
#else
return ("IPv6");
return("IPv6");
#endif
}

View File

@ -13,16 +13,16 @@ icmptypename(int family, int type)
icmptype_t *i;
if ((type < 0) || (type > 255))
return NULL;
return(NULL);
for (i = icmptypelist; i->it_name != NULL; i++) {
if ((family == AF_INET) && (i->it_v4 == type))
return i->it_name;
return(i->it_name);
#ifdef USE_INET6
if ((family == AF_INET6) && (i->it_v6 == type))
return i->it_name;
return(i->it_name);
#endif
}
return NULL;
return(NULL);
}

View File

@ -88,7 +88,7 @@ int inet_aton(const char *, struct in_addr *);
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
* This replaces inet_addr, the return value from which
* This replaces inet_addr, the return value from which
* cannot distinguish between failure and a local broadcast address.
*/
int
@ -108,7 +108,7 @@ inet_aton(register const char *cp, struct in_addr *addr)
* 0x=hex, 0=octal, isdigit=decimal.
*/
if (!ISDIGIT(c))
return (0);
return(0);
val = 0; base = 10;
if (c == '0') {
c = *++cp;
@ -136,7 +136,7 @@ inet_aton(register const char *cp, struct in_addr *addr)
* a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3)
return (0);
return(0);
*pp++ = val;
c = *++cp;
} else
@ -146,7 +146,7 @@ inet_aton(register const char *cp, struct in_addr *addr)
* Check for trailing characters.
*/
if (c != '\0' && (!ISASCII(c) || !ISSPACE(c)))
return (0);
return(0);
/*
* Concoct the address according to
* the number of parts specified.
@ -155,32 +155,32 @@ inet_aton(register const char *cp, struct in_addr *addr)
switch (n) {
case 0:
return (0); /* initial nondigit */
return(0); /* initial nondigit */
case 1: /* a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffff)
return (0);
return(0);
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffff)
return (0);
return(0);
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xff)
return (0);
return(0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
}
if (addr)
addr->s_addr = htonl(val);
return (1);
return(1);
}
/* these are compatibility routines, not needed on recent BSD releases */
@ -195,7 +195,7 @@ inet_addr(const char *cp)
struct in_addr val;
if (inet_aton(cp, &val))
return (val.s_addr);
return (0xffffffff);
return(val.s_addr);
return(0xffffffff);
}
#endif

View File

@ -530,7 +530,7 @@ find_error(int errnum)
while (step != 0) {
ie = ipf_errors + l + step;
if (ie->iee_number == errnum)
return ie;
return(ie);
step = l + step;
if (ie->iee_number > errnum)
r = step;
@ -539,7 +539,7 @@ find_error(int errnum)
step = (r - l) / 2;;
}
return NULL;
return(NULL);
}
char *
@ -553,12 +553,12 @@ ipf_geterror(int fd, ioctlfunc_t *func)
ie = find_error(errnum);
if (ie != NULL)
return ie->iee_text;
return(ie->iee_text);
snprintf(text, sizeof(text), "unknown error %d", errnum);
} else {
snprintf(text, sizeof(text), "retrieving error number failed (%d)", errno);
}
return text;
return(text);
}
@ -571,8 +571,8 @@ ipf_strerror(int errnum)
ie = find_error(errnum);
if (ie != NULL)
return ie->iee_text;
return(ie->iee_text);
snprintf(text, sizeof(text), "unknown error %d", errnum);
return text;
return(text);
}

View File

@ -24,7 +24,7 @@ ipf_perror_fd( int fd, ioctlfunc_t iocfunc, char *string)
errno = save;
fprintf(stderr, "%d:", realerr);
ipf_perror(realerr, string);
return realerr ? realerr : save;
return(realerr ? realerr : save);
}

View File

@ -32,7 +32,7 @@ hex_open(char *fname)
{
if (tfp && tfd != -1) {
rewind(tfp);
return tfd;
return(tfd);
}
if (!strcmp(fname, "-")) {
@ -43,7 +43,7 @@ hex_open(char *fname)
if (tfd != -1)
tfp = fdopen(tfd, "r");
}
return tfd;
return(tfd);
}
@ -53,7 +53,7 @@ hex_close(void)
int cfd = tfd;
tfd = -1;
return close(cfd);
return(close(cfd));
}
@ -79,7 +79,7 @@ hex_readip(mb_t *mb, char **ifn, int *dir)
if ((s = strchr(line, '\n'))) {
if (s == line) {
mb->mb_len = (char *)ip - buf;
return mb->mb_len;
return(mb->mb_len);
}
*s = '\0';
}
@ -147,8 +147,8 @@ hex_readip(mb_t *mb, char **ifn, int *dir)
}
}
if (feof(tfp))
return 0;
return -1;
return(0);
return(-1);
}
@ -178,5 +178,5 @@ static char
} else
break;
}
return dst;
return(dst);
}

View File

@ -85,20 +85,20 @@ ipcap_open(char *fname)
int fd, i;
if (pfd != -1)
return pfd;
return(pfd);
if (!strcmp(fname, "-"))
fd = 0;
else if ((fd = open(fname, O_RDONLY)) == -1)
return -1;
return(-1);
if (read(fd, (char *)&ph, sizeof(ph)) != sizeof(ph))
return -2;
return(-2);
if (ph.id != 0xa1b2c3d4) {
if (SWAPLONG(ph.id) != 0xa1b2c3d4) {
(void) close(fd);
return -2;
return(-2);
}
swapped = 1;
iswap_hdr(&ph);
@ -112,7 +112,7 @@ ipcap_open(char *fname)
if (llcp == NULL) {
(void) close(fd);
return -2;
return(-2);
}
pfd = fd;
@ -120,14 +120,14 @@ ipcap_open(char *fname)
printf("\tid: %08x version: %d.%d type: %d snap %d\n",
ph.id, ph.major, ph.minor, ph.type, ph.snaplen);
return fd;
return(fd);
}
static int
ipcap_close(void)
{
return close(pfd);
return(close(pfd));
}
@ -145,7 +145,7 @@ ipcap_read_rec(packetheader_t *rec)
while (n > 0) {
i = read(pfd, (char *)rec, sizeof(*rec));
if (i <= 0)
return -2;
return(-2);
n -= i;
}
@ -158,11 +158,11 @@ ipcap_read_rec(packetheader_t *rec)
p = rec->caplen;
n = MIN(p, rec->wirelen);
if (!n || n < 0)
return -3;
return(-3);
if (p < 0 || p > 65536)
return -4;
return p;
return(-4);
return(p);
}
@ -179,7 +179,7 @@ ipcap_read(char *buf, int cnt)
int i, n;
if ((i = ipcap_read_rec(&rec)) <= 0)
return i;
return(i);
if (!bufp)
bufp = malloc(i);
@ -187,17 +187,17 @@ ipcap_read(char *buf, int cnt)
bufp = realloc(bufp, i);
if (read(pfd, bufp, i) != i)
return -2;
return(-2);
n = MIN(i, cnt);
bcopy(bufp, buf, n);
return n;
return(n);
}
#endif
/*
* return only an IP packet read into buf
* return only an IP packet read into buf
*/
static int
ipcap_readip(mb_t *mb, char **ifn, int *dir)
@ -220,7 +220,7 @@ ipcap_readip(mb_t *mb, char **ifn, int *dir)
/* do { */
if ((i = ipcap_read_rec(&rec)) <= 0)
return i;
return(i);
if (!bufp)
bufp = malloc(i);
@ -231,7 +231,7 @@ ipcap_readip(mb_t *mb, char **ifn, int *dir)
for (j = i, n = 0; j > 0; ) {
n = read(pfd, s, j);
if (n <= 0)
return -2;
return(-2);
j -= n;
s += n;
}
@ -245,5 +245,5 @@ ipcap_readip(mb_t *mb, char **ifn, int *dir)
n = MIN(i, cnt);
bcopy(s, buf, n);
mb->mb_len = n;
return n;
return(n);
}

View File

@ -51,16 +51,16 @@ tx_hostnum(char *host, int *resolved)
*resolved = 0;
if (!strcasecmp("any", host))
return 0L;
return(0L);
if (ISDIGIT(*host))
return inet_addr(host);
return(inet_addr(host));
if (gethost(AF_INET, host, &ipa) == -1) {
*resolved = -1;
fprintf(stderr, "can't resolve hostname: %s\n", host);
return 0;
return(0);
}
return ipa.in4.s_addr;
return(ipa.in4.s_addr);
}
@ -74,12 +74,12 @@ tx_portnum(char *name)
struct servent *sp;
if (ISDIGIT(*name))
return (u_short)atoi(name);
return(u_short)atoi(name);
sp = getservbyname(name, tx_proto);
if (sp)
return ntohs(sp->s_port);
return(ntohs(sp->s_port));
(void) fprintf(stderr, "unknown service \"%s\".\n", name);
return 0;
return(0);
}
@ -88,7 +88,7 @@ text_open(char *fname)
{
if (tfp && tfd != -1) {
rewind(tfp);
return tfd;
return(tfd);
}
if (!strcmp(fname, "-")) {
@ -99,7 +99,7 @@ text_open(char *fname)
if (tfd != -1)
tfp = fdopen(tfd, "r");
}
return tfd;
return(tfd);
}
@ -109,7 +109,7 @@ text_close(void)
int cfd = tfd;
tfd = -1;
return close(cfd);
return(close(cfd));
}
@ -149,12 +149,12 @@ text_readip(mb_t *mb, char **ifn, int *dir)
} else {
mb->mb_len = ntohs(ip->ip_len);
}
return mb->mb_len;
return(mb->mb_len);
}
}
if (feof(tfp))
return 0;
return -1;
return(0);
return(-1);
}
static int
@ -179,32 +179,32 @@ parseline(char *line, ip_t *ip, char **ifn, int *out)
cpp = cps;
if (!*cpp)
return 1;
return(1);
c = **cpp;
if (!ISALPHA(c) || (TOLOWER(c) != 'o' && TOLOWER(c) != 'i')) {
fprintf(stderr, "bad direction \"%s\"\n", *cpp);
return 1;
return(1);
}
#ifdef USE_INET6
if (!strcasecmp(*cpp, "out6") || !strcasecmp(*cpp, "in6")) {
return parseipv6(cpp, (ip6_t *)ip, ifn, out);
return(parseipv6(cpp, (ip6_t *)ip, ifn, out));
}
#endif
*out = (TOLOWER(c) == 'o') ? 1 : 0;
cpp++;
if (!*cpp)
return 1;
return(1);
if (!strcasecmp(*cpp, "on")) {
cpp++;
if (!*cpp)
return 1;
return(1);
*ifn = strdup(*cpp++);
if (!*cpp)
return 1;
return(1);
}
c = **cpp;
@ -232,14 +232,14 @@ parseline(char *line, ip_t *ip, char **ifn, int *out)
ip->ip_p = IPPROTO_IP;
if (!*cpp)
return 1;
return(1);
if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP) {
char *last;
last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no source port\n");
return 1;
return(1);
}
*last++ = '\0';
tcp->th_sport = htons(tx_portnum(last));
@ -251,7 +251,7 @@ parseline(char *line, ip_t *ip, char **ifn, int *out)
ip->ip_src.s_addr = tx_hostnum(*cpp, &r);
cpp++;
if (!*cpp)
return 1;
return(1);
if (ip->ip_p == IPPROTO_TCP || ip->ip_p == IPPROTO_UDP) {
char *last;
@ -259,7 +259,7 @@ parseline(char *line, ip_t *ip, char **ifn, int *out)
last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no destination port\n");
return 1;
return(1);
}
*last++ = '\0';
tcp->th_dport = htons(tx_portnum(last));
@ -327,7 +327,7 @@ parseline(char *line, ip_t *ip, char **ifn, int *out)
bcopy((char *)ic, ((char *)ip) + (IP_HL(ip) << 2),
sizeof(*ic));
ip->ip_len = htons(ip->ip_len);
return 0;
return(0);
}
@ -346,15 +346,15 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
*out = (**cpp == 'o') ? 1 : 0;
cpp++;
if (!*cpp)
return 1;
return(1);
if (!strcasecmp(*cpp, "on")) {
cpp++;
if (!*cpp)
return 1;
return(1);
*ifn = strdup(*cpp++);
if (!*cpp)
return 1;
return(1);
}
if (!strcasecmp(*cpp, "tcp")) {
@ -376,7 +376,7 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
ip6->ip6_nxt = IPPROTO_IPV6;
if (!*cpp)
return 1;
return(1);
switch (ip6->ip6_nxt)
{
@ -399,7 +399,7 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no source port\n");
return 1;
return(1);
}
*last++ = '\0';
tcp->th_sport = htons(tx_portnum(last));
@ -411,12 +411,12 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
if (inet_pton(AF_INET6, *cpp, &ip6->ip6_src) != 1) {
fprintf(stderr, "cannot parse source address '%s'\n", *cpp);
return 1;
return(1);
}
cpp++;
if (!*cpp)
return 1;
return(1);
if (ip6->ip6_nxt == IPPROTO_TCP || ip6->ip6_nxt == IPPROTO_UDP) {
char *last;
@ -424,7 +424,7 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
last = strchr(*cpp, ',');
if (!last) {
fprintf(stderr, "tcp/udp with no destination port\n");
return 1;
return(1);
}
*last++ = '\0';
tcp->th_dport = htons(tx_portnum(last));
@ -433,7 +433,7 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
if (inet_pton(AF_INET6, *cpp, &ip6->ip6_dst) != 1) {
fprintf(stderr, "cannot parse destination address '%s'\n",
*cpp);
return 1;
return(1);
}
cpp++;
@ -495,6 +495,6 @@ parseipv6(char **cpp, ip6_t *ip6, char **ifn, int *out)
ip6->ip6_plen++;
}
ip6->ip6_plen = htons(ip6->ip6_plen);
return 0;
return(0);
}
#endif

View File

@ -30,7 +30,7 @@ seclevel(char *slevel)
struct ipopt_names *so;
if (slevel == NULL || *slevel == '\0')
return 0;
return(0);
for (so = secclass; so->on_name; so++)
if (!strcasecmp(slevel, so->on_name))
@ -38,9 +38,9 @@ seclevel(char *slevel)
if (!so->on_name) {
fprintf(stderr, "no such security level: '%s'\n", slevel);
return 0;
return(0);
}
return (u_char)so->on_value;
return(u_char)so->on_value;
}
@ -55,7 +55,7 @@ secbit(int class)
if (!so->on_name) {
fprintf(stderr, "no such security class: %d.\n", class);
return 0;
return(0);
}
return (u_char)so->on_bit;
return(u_char)so->on_bit;
}

View File

@ -47,9 +47,9 @@ openkmem(char *kern, char *core)
if (kvm_f == NULL)
{
perror("openkmem:open");
return -1;
return(-1);
}
return kvm_f != NULL;
return(kvm_f != NULL);
}
int
@ -58,18 +58,18 @@ kmemcpy(register char *buf, long pos, register int n)
register int r;
if (!n)
return 0;
return(0);
if (kvm_f == NULL)
if (openkmem(NULL, NULL) == -1)
return -1;
return(-1);
while ((r = kvm_read(kvm_f, pos, buf, n)) < n)
if (r <= 0)
{
fprintf(stderr, "pos=0x%lx ", (u_long)pos);
perror("kmemcpy:read");
return -1;
return(-1);
}
else
{
@ -77,7 +77,7 @@ kmemcpy(register char *buf, long pos, register int n)
pos += r;
n -= r;
}
return 0;
return(0);
}
int
@ -86,11 +86,11 @@ kstrncpy(register char *buf, long pos, register int n)
register int r;
if (!n)
return 0;
return(0);
if (kvm_f == NULL)
if (openkmem(NULL, NULL) == -1)
return -1;
return(-1);
while (n > 0)
{
@ -99,7 +99,7 @@ kstrncpy(register char *buf, long pos, register int n)
{
fprintf(stderr, "pos=0x%lx ", (u_long)pos);
perror("kmemcpy:read");
return -1;
return(-1);
}
else
{
@ -110,5 +110,5 @@ kstrncpy(register char *buf, long pos, register int n)
n--;
}
}
return 0;
return(0);
}

View File

@ -17,6 +17,6 @@ kmemcpywrap(void *from, void *to, size_t size)
int ret;
ret = kmemcpy((caddr_t)to, (u_long)from, size);
return ret;
return(ret);
}

View File

@ -27,12 +27,12 @@ kvatoname(ipfunc_t func, ioctlfunc_t iocfunc)
if ((opts & OPT_DONTOPEN) == 0) {
fd = open(IPL_NAME, O_RDONLY);
if (fd == -1)
return NULL;
return(NULL);
}
(void) (*iocfunc)(fd, SIOCFUNCL, &res);
if (fd >= 0)
close(fd);
strncpy(funcname, res.ipfu_name, sizeof(funcname));
funcname[sizeof(funcname) - 1] = '\0';
return funcname;
return(funcname);
}

View File

@ -21,10 +21,10 @@ load_dstlist(ippool_dst_t *dst, ioctlfunc_t iocfunc, ipf_dstnode_t *nodes)
ippool_dst_t dest;
if (dst->ipld_name[0] == '\0')
return -1;
return(-1);
if (pool_open() == -1)
return -1;
return(-1);
op.iplo_unit = dst->ipld_unit;
op.iplo_type = IPLT_DSTLIST;
@ -41,8 +41,8 @@ load_dstlist(ippool_dst_t *dst, ioctlfunc_t iocfunc, ipf_dstnode_t *nodes)
if ((opts & OPT_REMOVE) == 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op))
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"add destination list table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"add destination list table"));
}
}
@ -58,9 +58,9 @@ load_dstlist(ippool_dst_t *dst, ioctlfunc_t iocfunc, ipf_dstnode_t *nodes)
if ((opts & OPT_REMOVE) != 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"delete destination list table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"delete destination list table"));
}
}
return 0;
return(0);
}

View File

@ -23,11 +23,11 @@ load_dstlistnode(int role, char *name, ipf_dstnode_t *node,
int err;
if (pool_open() == -1)
return -1;
return(-1);
dst = calloc(1, sizeof(*dst) + node->ipfd_dest.fd_name);
if (dst == NULL)
return -1;
return(-1);
op.iplo_unit = role;
op.iplo_type = IPLT_DSTLIST;
@ -59,9 +59,9 @@ load_dstlistnode(int role, char *name, ipf_dstnode_t *node,
char msg[80];
(void) snprintf(msg, sizeof(msg), "%s lookup node", what);
return ipf_perror_fd(pool_fd(), iocfunc, msg);
return(ipf_perror_fd(pool_fd(), iocfunc, msg));
}
}
return 0;
return(0);
}

View File

@ -20,7 +20,7 @@ load_file(char *filename)
fp = fopen(filename + 7, "r");
if (fp == NULL) {
fprintf(stderr, "load_file cannot open '%s'\n", filename);
return NULL;
return(NULL);
}
a = NULL;
@ -40,7 +40,7 @@ load_file(char *filename)
linenum, filename);
fclose(fp);
alist_free(rtop);
return NULL;
return(NULL);
}
/*
@ -92,5 +92,5 @@ load_file(char *filename)
}
fclose(fp);
return rtop;
return(rtop);
}

View File

@ -25,7 +25,7 @@ load_hash(iphtable_t *iphp, iphtent_t *list, ioctlfunc_t iocfunc)
int n;
if (pool_open() == -1)
return -1;
return(-1);
for (n = 0, a = list; a != NULL; a = a->ipe_next)
n++;
@ -59,8 +59,8 @@ load_hash(iphtable_t *iphp, iphtent_t *list, ioctlfunc_t iocfunc)
if ((opts & OPT_REMOVE) == 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op))
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"add lookup hash table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"add lookup hash table"));
}
}
@ -71,7 +71,7 @@ load_hash(iphtable_t *iphp, iphtent_t *list, ioctlfunc_t iocfunc)
iph.iph_table = calloc(size, sizeof(*iph.iph_table));
if (iph.iph_table == NULL) {
perror("calloc(size, sizeof(*iph.iph_table))");
return -1;
return(-1);
}
iph.iph_list = list;
printhash(&iph, bcopywrap, iph.iph_name, opts, NULL);
@ -92,9 +92,9 @@ load_hash(iphtable_t *iphp, iphtent_t *list, ioctlfunc_t iocfunc)
if ((opts & OPT_REMOVE) != 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"delete lookup hash table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"delete lookup hash table"));
}
}
return 0;
return(0);
}

View File

@ -25,7 +25,7 @@ load_hashnode(int unit, char *name, iphtent_t *node, int ttl,
int err;
if (pool_open() == -1)
return -1;
return(-1);
op.iplo_type = IPLT_HASH;
op.iplo_unit = unit;
@ -57,7 +57,7 @@ load_hashnode(int unit, char *name, iphtent_t *node, int ttl,
char msg[80];
snprintf(msg, sizeof(msg), "%s node from lookup hash table", what);
return ipf_perror_fd(pool_fd(), iocfunc, msg);
return(ipf_perror_fd(pool_fd(), iocfunc, msg));
}
return 0;
return(0);
}

View File

@ -42,7 +42,7 @@ load_http(char *url)
if (strlen(url) > MAX_URL_LEN) {
fprintf(stderr, "load_http has a URL > %d bytes?!\n",
MAX_URL_LEN);
return NULL;
return(NULL);
}
fd = -1;
@ -67,7 +67,7 @@ load_http(char *url)
if (t == NULL) {
fprintf(stderr, "load_http has a malformed URL '%s'\n", url);
free(myurl);
return NULL;
return(NULL);
}
*t++ = '\0';
@ -77,7 +77,7 @@ load_http(char *url)
if (strlen(s) + strlen(buffer) + 10 > sizeof(buffer)) {
fprintf(stderr, "load_http has a malformed URL '%s'\n", url);
free(myurl);
return NULL;
return(NULL);
}
u = strchr(s, '@');
@ -204,5 +204,5 @@ load_http(char *url)
free(myurl);
if (fd != -1)
close(fd);
return rtop;
return(rtop);
}

View File

@ -23,7 +23,7 @@ load_pool(ip_pool_t *plp, ioctlfunc_t iocfunc)
ip_pool_t pool;
if (pool_open() == -1)
return -1;
return(-1);
op.iplo_unit = plp->ipo_unit;
op.iplo_type = IPLT_POOL;
@ -40,8 +40,8 @@ load_pool(ip_pool_t *plp, ioctlfunc_t iocfunc)
if ((opts & OPT_REMOVE) == 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPADDTABLE, &op)) {
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"add lookup table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"add lookup table"));
}
}
}
@ -62,9 +62,9 @@ load_pool(ip_pool_t *plp, ioctlfunc_t iocfunc)
if ((opts & OPT_REMOVE) != 0) {
if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op))
if ((opts & OPT_DONOTHING) == 0) {
return ipf_perror_fd(pool_fd(), iocfunc,
"delete lookup table");
return(ipf_perror_fd(pool_fd(), iocfunc,
"delete lookup table"));
}
}
return 0;
return(0);
}

View File

@ -25,7 +25,7 @@ load_poolnode(int role, char *name, ip_pool_node_t *node, int ttl,
int err;
if (pool_open() == -1)
return -1;
return(-1);
op.iplo_unit = role;
op.iplo_type = IPLT_POOL;
@ -58,9 +58,9 @@ load_poolnode(int role, char *name, ip_pool_node_t *node, int ttl,
snprintf(msg, sizeof(msg), "%s pool node(%s/", what,
inet_ntoa(pn.ipn_addr.adf_addr.in4));
strcat(msg, inet_ntoa(pn.ipn_mask.adf_addr.in4));
return ipf_perror_fd(pool_fd(), iocfunc, msg);
return(ipf_perror_fd(pool_fd(), iocfunc, msg));
}
}
return 0;
return(0);
}

View File

@ -27,5 +27,5 @@ load_url(char *url)
hosts = load_http(url);
}
return hosts;
return(hosts);
}

View File

@ -15,5 +15,5 @@ size_t msgdsize(mb_t *orig)
for (m = orig; m != NULL; m = m->mb_next)
sz += m->mb_len;
return sz;
return(sz);
}

View File

@ -26,12 +26,12 @@ nametokva(char *name, ioctlfunc_t iocfunc)
if ((opts & OPT_DONTOPEN) == 0) {
fd = open(IPL_NAME, O_RDONLY);
if (fd == -1)
return NULL;
return(NULL);
}
(void) (*iocfunc)(fd, SIOCFUNCL, &res);
if (fd >= 0)
close(fd);
if (res.ipfu_addr == NULL)
res.ipfu_addr = (ipfunc_t)-1;
return res.ipfu_addr;
return(res.ipfu_addr);
}

View File

@ -16,13 +16,13 @@ ntomask(int family, int nbits, u_32_t *ap)
u_32_t mask;
if (nbits < 0)
return -1;
return(-1);
switch (family)
{
case AF_INET :
if (nbits > 32 || use_inet6 == 1)
return -1;
return(-1);
if (nbits == 0) {
mask = 0;
} else {
@ -35,12 +35,12 @@ ntomask(int family, int nbits, u_32_t *ap)
case 0 :
case AF_INET6 :
if ((nbits > 128) || (use_inet6 == -1))
return -1;
return(-1);
fill6bits(nbits, ap);
break;
default :
return -1;
return(-1);
}
return 0;
return(0);
}

View File

@ -29,7 +29,7 @@ optname(char ***cp, u_short *sp, int linenum)
if (!io->on_name) {
fprintf(stderr, "%d: unknown IP option name %s\n",
linenum, s);
return 0;
return(0);
}
if (!strcasecmp(s, "sec-class"))
sec = 1;
@ -38,7 +38,7 @@ optname(char ***cp, u_short *sp, int linenum)
if (sec && !*(*cp + 1)) {
fprintf(stderr, "%d: missing security level after sec-class\n",
linenum);
return 0;
return(0);
}
if (sec) {
@ -53,11 +53,11 @@ optname(char ***cp, u_short *sp, int linenum)
fprintf(stderr,
"%d: no such security level: %s\n",
linenum, s);
return 0;
return(0);
}
}
if (smsk)
*sp = smsk;
}
return msk;
return(msk);
}

View File

@ -17,8 +17,8 @@ getoptbyname(char *optname)
for (io = ionames; io->on_name; io++)
if (!strcasecmp(optname, io->on_name))
return io->on_bit;
return -1;
return(io->on_bit);
return(-1);
}
@ -29,6 +29,6 @@ getoptbyvalue(int optval)
for (io = ionames; io->on_name; io++)
if (io->on_value == optval)
return io->on_bit;
return -1;
return(io->on_bit);
return(-1);
}

View File

@ -47,5 +47,5 @@ wordtab_t *parsefields(wordtab_t *table, char *arg)
fields[num].w_value = 0;
}
return fields;
return(fields);
}

View File

@ -268,7 +268,7 @@ parseipfexpr(char *line, char **errorptr)
oplist[0] = asize + 2;
oplist[asize + 1] = IPF_EXP_END;
return oplist;
return(oplist);
parseerror:
if (errorptr != NULL)
@ -277,5 +277,5 @@ parseipfexpr(char *line, char **errorptr)
free(oplist);
if (temp != NULL)
free(temp);
return NULL;
return(NULL);
}

View File

@ -19,7 +19,7 @@ parsewhoisline(char *line, addrfamily_t *addrp, addrfamily_t *maskp)
char *s = NULL;
if (line == NULL)
return -1;
return(-1);
while (*src != '\0') {
s = strchr(src, '(');
@ -33,7 +33,7 @@ parsewhoisline(char *line, addrfamily_t *addrp, addrfamily_t *maskp)
}
if (s == NULL)
return -1;
return(-1);
memset(addrp, 0x00, sizeof(*maskp));
memset(maskp, 0x00, sizeof(*maskp));
@ -44,20 +44,20 @@ parsewhoisline(char *line, addrfamily_t *addrp, addrfamily_t *maskp)
s = strchr(s, ')');
if (s == NULL || *++s != ' ')
return -1;
return(-1);
/*
* Parse the IPv6
*/
if (inet_pton(AF_INET6, s, &a61.in6) != 1)
return -1;
return(-1);
s = strchr(s, ' ');
if (s == NULL || strncmp(s, " - ", 3))
return -1;
return(-1);
s += 3;
if (inet_pton(AF_INET6, s, &a62) != 1)
return -1;
return(-1);
addrp->adf_addr = a61;
addrp->adf_family = AF_INET6;
@ -74,37 +74,37 @@ parsewhoisline(char *line, addrfamily_t *addrp, addrfamily_t *maskp)
* then we can't add it into a pool.
*/
if (count6bits(maskp->adf_addr.i6) == -1)
return -1;
return(-1);
maskp->adf_family = AF_INET6;
maskp->adf_len = addrp->adf_len;
if (IP6_MASKNEQ(&addrp->adf_addr.in6, &maskp->adf_addr.in6,
&addrp->adf_addr.in6)) {
return -1;
return(-1);
}
return 0;
return(0);
#else
return -1;
return(-1);
#endif
}
s = strchr(s, ')');
if (s == NULL || *++s != ' ')
return -1;
return(-1);
s++;
if (inet_aton(s, &a1) != 1)
return -1;
return(-1);
s = strchr(s, ' ');
if (s == NULL || strncmp(s, " - ", 3))
return -1;
return(-1);
s += 3;
if (inet_aton(s, &a2) != 1)
return -1;
return(-1);
addrp->adf_addr.in4 = a1;
addrp->adf_family = AF_INET;
@ -117,13 +117,13 @@ parsewhoisline(char *line, addrfamily_t *addrp, addrfamily_t *maskp)
* we can't add it into a pool.
*/
if (count4bits(maskp->adf_addr.in4.s_addr) == -1)
return -1;
return(-1);
maskp->adf_family = AF_INET;
maskp->adf_len = addrp->adf_len;
bzero((char *)maskp + maskp->adf_len, sizeof(*maskp) - maskp->adf_len);
if ((addrp->adf_addr.in4.s_addr & maskp->adf_addr.in4.s_addr) !=
addrp->adf_addr.in4.s_addr)
return -1;
return 0;
return(-1);
return(0);
}

View File

@ -20,11 +20,11 @@ pool_open(void)
{
if ((opts & OPT_DONTOPEN) != 0)
return 0;
return(0);
if (poolfd == -1)
poolfd = open(IPLOOKUP_NAME, O_RDWR);
return poolfd;
return(poolfd);
}
int
@ -33,7 +33,7 @@ pool_ioctl(iocfunc, cmd, ptr)
ioctlcmd_t cmd;
void *ptr;
{
return (*iocfunc)(poolfd, cmd, ptr);
return(*iocfunc)(poolfd, cmd, ptr);
}
@ -49,5 +49,5 @@ pool_close(void)
int
pool_fd(void)
{
return poolfd;
return(poolfd);
}

View File

@ -28,16 +28,16 @@ portname(int pr, int port)
NULL : sv1;
}
if (sv)
return (buf);
return(buf);
} else if ((pr != -2) && (p = getprotobynumber(pr))) {
if ((sv = getservbyport(htons(port), p->p_name))) {
strncpy(buf, sv->s_name, sizeof(buf)-1);
buf[sizeof(buf)-1] = '\0';
return (buf);
return(buf);
}
}
}
(void) snprintf(buf, sizeof(buf), "%d", port);
return (buf);
return(buf);
}

View File

@ -12,5 +12,5 @@ int prependmbt( fr_info_t *fin, mb_t *m)
{
m->mb_next = *fin->fin_mp;
*fin->fin_mp = m;
return 0;
return(0);
}

View File

@ -23,15 +23,15 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts,
ipfobj_t obj;
if ((name != NULL) && strncmp(name, d->ipld_name, FR_GROUPLEN))
return d->ipld_next;
return(d->ipld_next);
entry = calloc(1, sizeof(*entry) + 64);
if (entry == NULL)
return d->ipld_next;
return(d->ipld_next);
zero = calloc(1, sizeof(*zero) + 64);
if (zero == NULL) {
free(entry);
return d->ipld_next;
return(d->ipld_next);
}
if (fields == NULL)
@ -76,5 +76,5 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts,
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return d->ipld_next;
return(d->ipld_next);
}

View File

@ -15,10 +15,10 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
ippool_dst_t dst;
if ((*copyfunc)(pp, &dst, sizeof(dst)))
return NULL;
return(NULL);
if ((name != NULL) && strncmp(name, dst.ipld_name, FR_GROUPLEN))
return dst.ipld_next;
return(dst.ipld_next);
if (fields == NULL)
printdstlistdata(&dst, opts);
@ -39,7 +39,7 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
break;
if ((*copyfunc)(node, n, node->ipfd_size)) {
free(n);
return NULL;
return(NULL);
}
node = printdstlistnode(n, bcopywrap, opts, fields);
@ -51,5 +51,5 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return dst.ipld_next;
return(dst.ipld_next);
}

View File

@ -19,13 +19,13 @@ printdstlistnode(ipf_dstnode_t *inp, copyfunc_t copyfunc, int opts,
#endif
if ((*copyfunc)(inp, &node, sizeof(node)))
return NULL;
return(NULL);
np = calloc(1, node.ipfd_size);
if (np == NULL)
return node.ipfd_next;
return(node.ipfd_next);
if ((*copyfunc)(inp, np, node.ipfd_size))
return NULL;
return(NULL);
if (fields != NULL) {
for (i = 0; fields[i].w_value != 0; i++) {
@ -71,5 +71,5 @@ printdstlistnode(ipf_dstnode_t *inp, copyfunc_t copyfunc, int opts,
np->ipfd_names, np->ipfd_uid);
}
free(np);
return node.ipfd_next;
return(node.ipfd_next);
}

View File

@ -19,10 +19,10 @@ printhash( iphtable_t *hp, copyfunc_t copyfunc, char *name, int opts,
size_t sz;
if ((*copyfunc)((char *)hp, (char *)&iph, sizeof(iph)))
return NULL;
return(NULL);
if ((name != NULL) && strncmp(name, iph.iph_name, FR_GROUPLEN))
return iph.iph_next;
return(iph.iph_next);
if (fields == NULL)
printhashdata(hp, opts);
@ -36,7 +36,7 @@ printhash( iphtable_t *hp, copyfunc_t copyfunc, char *name, int opts,
sz = iph.iph_size * sizeof(*table);
table = malloc(sz);
if ((*copyfunc)((char *)iph.iph_table, (char *)table, sz))
return NULL;
return(NULL);
for (printed = 0, ipep = iph.iph_list; ipep != NULL; ) {
ipep = printhashnode(&iph, ipep, copyfunc, opts, fields);
@ -50,5 +50,5 @@ printhash( iphtable_t *hp, copyfunc_t copyfunc, char *name, int opts,
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return iph.iph_next;
return(iph.iph_next);
}

View File

@ -18,7 +18,7 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)
ipfobj_t obj;
if ((name != NULL) && strncmp(name, hp->iph_name, FR_GROUPLEN))
return hp->iph_next;
return(hp->iph_next);
if (fields == NULL)
printhashdata(hp, opts);
@ -61,5 +61,5 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return hp->iph_next;
return(hp->iph_next);
}

View File

@ -18,7 +18,7 @@ printhashnode(iphtable_t *iph, iphtent_t *ipep, copyfunc_t copyfunc, int opts,
int i;
if ((*copyfunc)(ipep, &ipe, sizeof(ipe)))
return NULL;
return(NULL);
hv = IPE_V4_HASH_FN(ipe.ipe_addr.i6[0], ipe.ipe_mask.i6[0],
iph->iph_size);
@ -90,5 +90,5 @@ printhashnode(iphtable_t *iph, iphtent_t *ipep, copyfunc_t copyfunc, int opts,
}
ipep = ipe.ipe_next;
return ipep;
return(ipep);
}

View File

@ -17,10 +17,10 @@ printpool(ip_pool_t *pp, copyfunc_t copyfunc, char *name, int opts,
ip_pool_t ipp;
if ((*copyfunc)(pp, &ipp, sizeof(ipp)))
return NULL;
return(NULL);
if ((name != NULL) && strncmp(name, ipp.ipo_name, FR_GROUPLEN))
return ipp.ipo_next;
return(ipp.ipo_next);
printpooldata(&ipp, opts);
@ -57,5 +57,5 @@ printpool(ip_pool_t *pp, copyfunc_t copyfunc, char *name, int opts,
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return ipp.ipo_next;
return(ipp.ipo_next);
}

View File

@ -19,7 +19,7 @@ printpool_live(ip_pool_t *pool, int fd, char *name, int opts,
ipfobj_t obj;
if ((name != NULL) && strncmp(name, pool->ipo_name, FR_GROUPLEN))
return pool->ipo_next;
return(pool->ipo_next);
if (fields == NULL)
printpooldata(pool, opts);
@ -63,5 +63,5 @@ printpool_live(ip_pool_t *pool, int fd, char *name, int opts,
(void) ioctl(fd,SIOCIPFDELTOK, &iter.ili_key);
return pool->ipo_next;
return(pool->ipo_next);
}

Some files were not shown because too many files have changed in this diff Show More