Apply diff from the port.
Rather small diff for the userland (in contrast to the kernel): - Some header file location/differences - Clean compilation on 64bit arch (identified by bento a long time ago) - ALTQ not (yet) available. Leave a switch for patchsets and future ... - most files can be used from the vendor branch Approved by: bms(in general)
This commit is contained in:
parent
bfc3fb6cc2
commit
8c8618f5e8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126355
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: authpf.c,v 1.68 2003/08/21 19:13:23 frantzen Exp $ */
|
/* $OpenBSD: authpf.c,v 1.68 2003/08/21 19:13:23 frantzen Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -49,6 +50,9 @@
|
|||||||
|
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#define __dead __volatile
|
||||||
|
#endif
|
||||||
extern int symset(const char *, const char *, int);
|
extern int symset(const char *, const char *, int);
|
||||||
|
|
||||||
static int read_config(FILE *);
|
static int read_config(FILE *);
|
||||||
@ -285,6 +289,9 @@ main(int argc, char *argv[])
|
|||||||
sleep(180); /* them lusers read reaaaaal slow */
|
sleep(180); /* them lusers read reaaaaal slow */
|
||||||
die:
|
die:
|
||||||
do_death(0);
|
do_death(0);
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
return 0; /* gcc hack to prevent warning */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: ftp-proxy.c,v 1.33 2003/08/22 21:50:34 david Exp $ */
|
/* $OpenBSD: ftp-proxy.c,v 1.33 2003/08/22 21:50:34 david Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -67,6 +68,7 @@
|
|||||||
* - per-user rules perhaps.
|
* - per-user rules perhaps.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl.c,v 1.188 2003/08/29 21:47:36 cedric Exp $ */
|
/* $OpenBSD: pfctl.c,v 1.188 2003/08/29 21:47:36 cedric Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -36,6 +37,12 @@
|
|||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <net/route.h>
|
||||||
|
#else
|
||||||
|
#define PRIu64 "llu"
|
||||||
|
#endif
|
||||||
#include <net/pfvar.h>
|
#include <net/pfvar.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <altq/altq.h>
|
#include <altq/altq.h>
|
||||||
@ -194,6 +201,10 @@ pfctl_enable(int dev, int opts)
|
|||||||
if (ioctl(dev, DIOCSTART)) {
|
if (ioctl(dev, DIOCSTART)) {
|
||||||
if (errno == EEXIST)
|
if (errno == EEXIST)
|
||||||
errx(1, "pf already enabled");
|
errx(1, "pf already enabled");
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
else if (errno == ESRCH)
|
||||||
|
errx(1, "pfil registeration failed");
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
err(1, "DIOCSTART");
|
err(1, "DIOCSTART");
|
||||||
}
|
}
|
||||||
@ -543,8 +554,8 @@ pfctl_print_rule_counters(struct pf_rule *rule, int opts)
|
|||||||
rule->qname, rule->qid, rule->pqname, rule->pqid);
|
rule->qname, rule->qid, rule->pqname, rule->pqid);
|
||||||
}
|
}
|
||||||
if (opts & PF_OPT_VERBOSE)
|
if (opts & PF_OPT_VERBOSE)
|
||||||
printf(" [ Evaluations: %-8llu Packets: %-8llu "
|
printf(" [ Evaluations: %-8"PRIu64" Packets: %-8"PRIu64" "
|
||||||
"Bytes: %-10llu States: %-6u]\n",
|
"Bytes: %-10"PRIu64" States: %-6u]\n",
|
||||||
rule->evaluations, rule->packets,
|
rule->evaluations, rule->packets,
|
||||||
rule->bytes, rule->states);
|
rule->bytes, rule->states);
|
||||||
}
|
}
|
||||||
@ -608,7 +619,7 @@ pfctl_show_rules(int dev, int opts, int format, char *anchorname,
|
|||||||
case 1:
|
case 1:
|
||||||
if (pr.rule.label[0]) {
|
if (pr.rule.label[0]) {
|
||||||
printf("%s ", pr.rule.label);
|
printf("%s ", pr.rule.label);
|
||||||
printf("%llu %llu %llu\n",
|
printf("%"PRIu64" %"PRIu64" %"PRIu64"\n",
|
||||||
pr.rule.evaluations, pr.rule.packets,
|
pr.rule.evaluations, pr.rule.packets,
|
||||||
pr.rule.bytes);
|
pr.rule.bytes);
|
||||||
}
|
}
|
||||||
@ -640,7 +651,7 @@ pfctl_show_rules(int dev, int opts, int format, char *anchorname,
|
|||||||
case 1:
|
case 1:
|
||||||
if (pr.rule.label[0]) {
|
if (pr.rule.label[0]) {
|
||||||
printf("%s ", pr.rule.label);
|
printf("%s ", pr.rule.label);
|
||||||
printf("%llu %llu %llu\n",
|
printf("%"PRIu64" %"PRIu64" %"PRIu64"\n",
|
||||||
pr.rule.evaluations, pr.rule.packets,
|
pr.rule.evaluations, pr.rule.packets,
|
||||||
pr.rule.bytes);
|
pr.rule.bytes);
|
||||||
}
|
}
|
||||||
@ -1222,6 +1233,9 @@ pfctl_clear_rule_counters(int dev, int opts)
|
|||||||
int
|
int
|
||||||
pfctl_test_altqsupport(int dev, int opts)
|
pfctl_test_altqsupport(int dev, int opts)
|
||||||
{
|
{
|
||||||
|
#if defined(__FreeBSD__) && !defined(ENABLE_ALTQ)
|
||||||
|
return (0);
|
||||||
|
#else
|
||||||
struct pfioc_altq pa;
|
struct pfioc_altq pa;
|
||||||
|
|
||||||
if (ioctl(dev, DIOCGETALTQS, &pa)) {
|
if (ioctl(dev, DIOCGETALTQS, &pa)) {
|
||||||
@ -1234,6 +1248,7 @@ pfctl_test_altqsupport(int dev, int opts)
|
|||||||
err(1, "DIOCGETALTQS");
|
err(1, "DIOCGETALTQS");
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1476,7 +1491,11 @@ main(int argc, char *argv[])
|
|||||||
/* turn off options */
|
/* turn off options */
|
||||||
opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
|
opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
|
||||||
clearopt = showopt = debugopt = NULL;
|
clearopt = showopt = debugopt = NULL;
|
||||||
|
#if defined(__FreeBSD__) && !defined(ENABLE_ALTQ)
|
||||||
|
altqsupport = 0;
|
||||||
|
#else
|
||||||
altqsupport = 1;
|
altqsupport = 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts & PF_OPT_DISABLE)
|
if (opts & PF_OPT_DISABLE)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl.h,v 1.25 2003/08/29 21:47:36 cedric Exp $ */
|
/* $OpenBSD: pfctl.h,v 1.25 2003/08/29 21:47:36 cedric Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -82,6 +83,10 @@ int pfctl_command_tables(int, char *[], char *, const char *, char *,
|
|||||||
int pfctl_show_altq(int, int, int);
|
int pfctl_show_altq(int, int, int);
|
||||||
void warn_namespace_collision(const char *);
|
void warn_namespace_collision(const char *);
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
extern int altqsupport;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_PRIORITY
|
#ifndef DEFAULT_PRIORITY
|
||||||
#define DEFAULT_PRIORITY 1
|
#define DEFAULT_PRIORITY 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl_altq.c,v 1.77 2003/08/22 21:50:34 david Exp $ */
|
/* $OpenBSD: pfctl_altq.c,v 1.77 2003/08/22 21:50:34 david Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -21,7 +22,9 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#if !defined(__FreeBSD__)
|
||||||
#include <sys/limits.h>
|
#include <sys/limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@ -74,7 +77,11 @@ static int gsc_add_seg(struct gen_sc *, double, double, double,
|
|||||||
double);
|
double);
|
||||||
static double sc_x2y(struct service_curve *, double);
|
static double sc_x2y(struct service_curve *, double);
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
u_int32_t getifspeed(int, char *);
|
||||||
|
#else
|
||||||
u_int32_t getifspeed(char *);
|
u_int32_t getifspeed(char *);
|
||||||
|
#endif
|
||||||
u_long getifmtu(char *);
|
u_long getifmtu(char *);
|
||||||
int eval_queue_opts(struct pf_altq *, struct node_queue_opt *,
|
int eval_queue_opts(struct pf_altq *, struct node_queue_opt *,
|
||||||
u_int32_t);
|
u_int32_t);
|
||||||
@ -239,7 +246,11 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, struct node_queue_bw *bw,
|
|||||||
if (bw->bw_absolute > 0)
|
if (bw->bw_absolute > 0)
|
||||||
pa->ifbandwidth = bw->bw_absolute;
|
pa->ifbandwidth = bw->bw_absolute;
|
||||||
else
|
else
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
if ((rate = getifspeed(pf->dev, pa->ifname)) == 0) {
|
||||||
|
#else
|
||||||
if ((rate = getifspeed(pa->ifname)) == 0) {
|
if ((rate = getifspeed(pa->ifname)) == 0) {
|
||||||
|
#endif
|
||||||
fprintf(stderr, "cannot determine interface bandwidth "
|
fprintf(stderr, "cannot determine interface bandwidth "
|
||||||
"for %s, specify an absolute bandwidth\n",
|
"for %s, specify an absolute bandwidth\n",
|
||||||
pa->ifname);
|
pa->ifname);
|
||||||
@ -869,7 +880,14 @@ print_hfsc_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
|
|||||||
/*
|
/*
|
||||||
* admission control using generalized service curve
|
* admission control using generalized service curve
|
||||||
*/
|
*/
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#if defined(INFINITY)
|
||||||
|
#undef INFINITY
|
||||||
|
#endif
|
||||||
#define INFINITY HUGE_VAL /* positive infinity defined in <math.h> */
|
#define INFINITY HUGE_VAL /* positive infinity defined in <math.h> */
|
||||||
|
#else
|
||||||
|
#define INFINITY HUGE_VAL /* positive infinity defined in <math.h> */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* add a new service curve to a generalized service curve */
|
/* add a new service curve to a generalized service curve */
|
||||||
static void
|
static void
|
||||||
@ -1070,6 +1088,26 @@ rate2str(double rate)
|
|||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
/*
|
||||||
|
* XXX
|
||||||
|
* FreeBSD do not have SIOCGIFDATA.
|
||||||
|
* To emulate this, DIOCGIFSPEED ioctl added to pf.
|
||||||
|
*/
|
||||||
|
u_int32_t
|
||||||
|
getifspeed(int pfdev, char *ifname)
|
||||||
|
{
|
||||||
|
struct pf_ifspeed io;
|
||||||
|
|
||||||
|
bzero(&io, sizeof io);
|
||||||
|
if (strlcpy(io.ifname, ifname, IFNAMSIZ) >=
|
||||||
|
sizeof(io.ifname))
|
||||||
|
errx(1, "getifspeed: strlcpy");
|
||||||
|
if (ioctl(pfdev, DIOCGIFSPEED, &io) == -1)
|
||||||
|
err(1, "DIOCGIFSPEED");
|
||||||
|
return ((u_int32_t)io.baudrate);
|
||||||
|
}
|
||||||
|
#else
|
||||||
u_int32_t
|
u_int32_t
|
||||||
getifspeed(char *ifname)
|
getifspeed(char *ifname)
|
||||||
{
|
{
|
||||||
@ -1091,6 +1129,7 @@ getifspeed(char *ifname)
|
|||||||
err(1, "close");
|
err(1, "close");
|
||||||
return ((u_int32_t)ifrdat.ifi_baudrate);
|
return ((u_int32_t)ifrdat.ifi_baudrate);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
u_long
|
u_long
|
||||||
getifmtu(char *ifname)
|
getifmtu(char *ifname)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl_parser.c,v 1.175 2003/09/18 20:27:58 cedric Exp $ */
|
/* $OpenBSD: pfctl_parser.c,v 1.175 2003/09/18 20:27:58 cedric Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,6 +52,13 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
#define PRIu64 "llu"
|
||||||
|
#define PRId64 "lld"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pfctl_parser.h"
|
#include "pfctl_parser.h"
|
||||||
#include "pfctl.h"
|
#include "pfctl.h"
|
||||||
|
|
||||||
@ -503,30 +511,30 @@ print_status(struct pf_status *s)
|
|||||||
if (s->ifname[0] != 0) {
|
if (s->ifname[0] != 0) {
|
||||||
printf("Interface Stats for %-16s %5s %16s\n",
|
printf("Interface Stats for %-16s %5s %16s\n",
|
||||||
s->ifname, "IPv4", "IPv6");
|
s->ifname, "IPv4", "IPv6");
|
||||||
printf(" %-25s %14llu %16llu\n", "Bytes In",
|
printf(" %-25s %14"PRIu64" %16"PRIu64"\n", "Bytes In",
|
||||||
s->bcounters[0][0], s->bcounters[1][0]);
|
s->bcounters[0][0], s->bcounters[1][0]);
|
||||||
printf(" %-25s %14llu %16llu\n", "Bytes Out",
|
printf(" %-25s %14"PRIu64" %16"PRIu64"\n", "Bytes Out",
|
||||||
s->bcounters[0][1], s->bcounters[1][1]);
|
s->bcounters[0][1], s->bcounters[1][1]);
|
||||||
printf(" Packets In\n");
|
printf(" Packets In\n");
|
||||||
printf(" %-23s %14llu %16llu\n", "Passed",
|
printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Passed",
|
||||||
s->pcounters[0][0][PF_PASS],
|
s->pcounters[0][0][PF_PASS],
|
||||||
s->pcounters[1][0][PF_PASS]);
|
s->pcounters[1][0][PF_PASS]);
|
||||||
printf(" %-23s %14llu %16llu\n", "Blocked",
|
printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Blocked",
|
||||||
s->pcounters[0][0][PF_DROP],
|
s->pcounters[0][0][PF_DROP],
|
||||||
s->pcounters[1][0][PF_DROP]);
|
s->pcounters[1][0][PF_DROP]);
|
||||||
printf(" Packets Out\n");
|
printf(" Packets Out\n");
|
||||||
printf(" %-23s %14llu %16llu\n", "Passed",
|
printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Passed",
|
||||||
s->pcounters[0][1][PF_PASS],
|
s->pcounters[0][1][PF_PASS],
|
||||||
s->pcounters[1][1][PF_PASS]);
|
s->pcounters[1][1][PF_PASS]);
|
||||||
printf(" %-23s %14llu %16llu\n\n", "Blocked",
|
printf(" %-23s %14"PRIu64" %16"PRIu64"\n\n", "Blocked",
|
||||||
s->pcounters[0][1][PF_DROP],
|
s->pcounters[0][1][PF_DROP],
|
||||||
s->pcounters[1][1][PF_DROP]);
|
s->pcounters[1][1][PF_DROP]);
|
||||||
}
|
}
|
||||||
printf("%-27s %14s %16s\n", "State Table", "Total", "Rate");
|
printf("%-27s %14s %16s\n", "State Table", "Total", "Rate");
|
||||||
printf(" %-25s %14u %14s\n", "current entries", s->states, "");
|
printf(" %-25s %14u %14s\n", "current entries", s->states, "");
|
||||||
for (i = 0; i < FCNT_MAX; i++) {
|
for (i = 0; i < FCNT_MAX; i++) {
|
||||||
printf(" %-25s %14llu", pf_fcounters[i],
|
printf(" %-25s %14"PRIu64" ", pf_fcounters[i],
|
||||||
(unsigned long long)s->fcounters[i]);
|
s->fcounters[i]);
|
||||||
if (runtime > 0)
|
if (runtime > 0)
|
||||||
printf("%14.1f/s\n",
|
printf("%14.1f/s\n",
|
||||||
(double)s->fcounters[i] / (double)runtime);
|
(double)s->fcounters[i] / (double)runtime);
|
||||||
@ -535,8 +543,8 @@ print_status(struct pf_status *s)
|
|||||||
}
|
}
|
||||||
printf("Counters\n");
|
printf("Counters\n");
|
||||||
for (i = 0; i < PFRES_MAX; i++) {
|
for (i = 0; i < PFRES_MAX; i++) {
|
||||||
printf(" %-25s %14llu ", pf_reasons[i],
|
printf(" %-25s %14"PRIu64" ", pf_reasons[i],
|
||||||
(unsigned long long)s->counters[i]);
|
s->counters[i]);
|
||||||
if (runtime > 0)
|
if (runtime > 0)
|
||||||
printf("%14.1f/s\n",
|
printf("%14.1f/s\n",
|
||||||
(double)s->counters[i] / (double)runtime);
|
(double)s->counters[i] / (double)runtime);
|
||||||
@ -1124,6 +1132,12 @@ host_v4(const char *s, int mask)
|
|||||||
h->ifname = NULL;
|
h->ifname = NULL;
|
||||||
h->af = AF_INET;
|
h->af = AF_INET;
|
||||||
h->addr.v.a.addr.addr32[0] = ina.s_addr;
|
h->addr.v.a.addr.addr32[0] = ina.s_addr;
|
||||||
|
#if defined(__FreeBSD__) && (__FreeBSD_version <= 501106)
|
||||||
|
/* inet_net_pton acts strange w/ multicast addresses, RFC1112 */
|
||||||
|
if (mask == -1 && h->addr.v.a.addr.addr8[0] >= 224 &&
|
||||||
|
h->addr.v.a.addr.addr8[0] < 240)
|
||||||
|
bits = 32;
|
||||||
|
#endif
|
||||||
set_ipmask(h, bits);
|
set_ipmask(h, bits);
|
||||||
h->next = NULL;
|
h->next = NULL;
|
||||||
h->tail = h;
|
h->tail = h;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl_parser.h,v 1.67 2003/08/21 19:12:09 frantzen Exp $ */
|
/* $OpenBSD: pfctl_parser.h,v 1.67 2003/08/21 19:12:09 frantzen Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -134,6 +135,30 @@ struct node_queue_opt {
|
|||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
/*
|
||||||
|
* XXX
|
||||||
|
* Absolutely this is not correct location to define this.
|
||||||
|
* Should we use an another sperate header file?
|
||||||
|
*/
|
||||||
|
#define SIMPLEQ_HEAD STAILQ_HEAD
|
||||||
|
#define SIMPLEQ_HEAD_INITIALIZER STAILQ_HEAD_INITIALIZER
|
||||||
|
#define SIMPLEQ_ENTRY STAILQ_ENTRY
|
||||||
|
#define SIMPLEQ_FIRST STAILQ_FIRST
|
||||||
|
#define SIMPLEQ_END(head) NULL
|
||||||
|
#define SIMPLEQ_EMPTY STAILQ_EMPTY
|
||||||
|
#define SIMPLEQ_NEXT STAILQ_NEXT
|
||||||
|
/*#define SIMPLEQ_FOREACH STAILQ_FOREACH*/
|
||||||
|
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||||
|
for((var) = SIMPLEQ_FIRST(head); \
|
||||||
|
(var) != SIMPLEQ_END(head); \
|
||||||
|
(var) = SIMPLEQ_NEXT(var, field))
|
||||||
|
#define SIMPLEQ_INIT STAILQ_INIT
|
||||||
|
#define SIMPLEQ_INSERT_HEAD STAILQ_INSERT_HEAD
|
||||||
|
#define SIMPLEQ_INSERT_TAIL STAILQ_INSERT_TAIL
|
||||||
|
#define SIMPLEQ_INSERT_AFTER STAILQ_INSERT_AFTER
|
||||||
|
#define SIMPLEQ_REMOVE_HEAD STAILQ_REMOVE_HEAD
|
||||||
|
#endif
|
||||||
SIMPLEQ_HEAD(node_tinithead, node_tinit);
|
SIMPLEQ_HEAD(node_tinithead, node_tinit);
|
||||||
struct node_tinit { /* table initializer */
|
struct node_tinit { /* table initializer */
|
||||||
SIMPLEQ_ENTRY(node_tinit) entries;
|
SIMPLEQ_ENTRY(node_tinit) entries;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl_qstats.c,v 1.24 2003/07/31 09:46:08 kjc Exp $ */
|
/* $OpenBSD: pfctl_qstats.c,v 1.24 2003/07/31 09:46:08 kjc Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -36,6 +37,12 @@
|
|||||||
#include <altq/altq_priq.h>
|
#include <altq/altq_priq.h>
|
||||||
#include <altq/altq_hfsc.h>
|
#include <altq/altq_hfsc.h>
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
#define PRIu64 "llu"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pfctl.h"
|
#include "pfctl.h"
|
||||||
#include "pfctl_parser.h"
|
#include "pfctl_parser.h"
|
||||||
|
|
||||||
@ -85,6 +92,10 @@ pfctl_show_altq(int dev, int opts, int verbose2)
|
|||||||
{
|
{
|
||||||
struct pf_altq_node *root = NULL, *node;
|
struct pf_altq_node *root = NULL, *node;
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
if (!altqsupport)
|
||||||
|
return (-1);
|
||||||
|
#endif
|
||||||
if (pfctl_update_qstats(dev, &root))
|
if (pfctl_update_qstats(dev, &root))
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
@ -275,8 +286,8 @@ pfctl_print_altq_nodestat(int dev, const struct pf_altq_node *a)
|
|||||||
void
|
void
|
||||||
print_cbqstats(struct queue_stats cur)
|
print_cbqstats(struct queue_stats cur)
|
||||||
{
|
{
|
||||||
printf(" [ pkts: %10llu bytes: %10llu "
|
printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
|
||||||
"dropped pkts: %6llu bytes: %6llu ]\n",
|
"dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
|
||||||
cur.data.cbq_stats.xmit_cnt.packets,
|
cur.data.cbq_stats.xmit_cnt.packets,
|
||||||
cur.data.cbq_stats.xmit_cnt.bytes,
|
cur.data.cbq_stats.xmit_cnt.bytes,
|
||||||
cur.data.cbq_stats.drop_cnt.packets,
|
cur.data.cbq_stats.drop_cnt.packets,
|
||||||
@ -296,8 +307,8 @@ print_cbqstats(struct queue_stats cur)
|
|||||||
void
|
void
|
||||||
print_priqstats(struct queue_stats cur)
|
print_priqstats(struct queue_stats cur)
|
||||||
{
|
{
|
||||||
printf(" [ pkts: %10llu bytes: %10llu "
|
printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
|
||||||
"dropped pkts: %6llu bytes: %6llu ]\n",
|
"dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
|
||||||
cur.data.priq_stats.xmitcnt.packets,
|
cur.data.priq_stats.xmitcnt.packets,
|
||||||
cur.data.priq_stats.xmitcnt.bytes,
|
cur.data.priq_stats.xmitcnt.bytes,
|
||||||
cur.data.priq_stats.dropcnt.packets,
|
cur.data.priq_stats.dropcnt.packets,
|
||||||
@ -316,8 +327,8 @@ print_priqstats(struct queue_stats cur)
|
|||||||
void
|
void
|
||||||
print_hfscstats(struct queue_stats cur)
|
print_hfscstats(struct queue_stats cur)
|
||||||
{
|
{
|
||||||
printf(" [ pkts: %10llu bytes: %10llu "
|
printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
|
||||||
"dropped pkts: %6llu bytes: %6llu ]\n",
|
"dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
|
||||||
cur.data.hfsc_stats.xmit_cnt.packets,
|
cur.data.hfsc_stats.xmit_cnt.packets,
|
||||||
cur.data.hfsc_stats.xmit_cnt.bytes,
|
cur.data.hfsc_stats.xmit_cnt.bytes,
|
||||||
cur.data.hfsc_stats.drop_cnt.packets,
|
cur.data.hfsc_stats.drop_cnt.packets,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pfctl_table.c,v 1.50 2003/08/29 21:47:36 cedric Exp $ */
|
/* $OpenBSD: pfctl_table.c,v 1.50 2003/08/29 21:47:36 cedric Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,6 +49,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
#define PRIu64 "llu"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pfctl_parser.h"
|
#include "pfctl_parser.h"
|
||||||
#include "pfctl.h"
|
#include "pfctl.h"
|
||||||
|
|
||||||
@ -347,11 +354,11 @@ print_tstats(struct pfr_tstats *ts, int debug)
|
|||||||
printf("\tReferences: [ Anchors: %-18d Rules: %-18d ]\n",
|
printf("\tReferences: [ Anchors: %-18d Rules: %-18d ]\n",
|
||||||
ts->pfrts_refcnt[PFR_REFCNT_ANCHOR],
|
ts->pfrts_refcnt[PFR_REFCNT_ANCHOR],
|
||||||
ts->pfrts_refcnt[PFR_REFCNT_RULE]);
|
ts->pfrts_refcnt[PFR_REFCNT_RULE]);
|
||||||
printf("\tEvaluations: [ NoMatch: %-18llu Match: %-18llu ]\n",
|
printf("\tEvaluations: [ NoMatch: %-18"PRIu64" Match: %-18"PRIu64" ]\n",
|
||||||
ts->pfrts_nomatch, ts->pfrts_match);
|
ts->pfrts_nomatch, ts->pfrts_match);
|
||||||
for (dir = 0; dir < PFR_DIR_MAX; dir++)
|
for (dir = 0; dir < PFR_DIR_MAX; dir++)
|
||||||
for (op = 0; op < PFR_OP_TABLE_MAX; op++)
|
for (op = 0; op < PFR_OP_TABLE_MAX; op++)
|
||||||
printf("\t%-12s [ Packets: %-18llu Bytes: %-18llu ]\n",
|
printf("\t%-12s [ Packets: %-18"PRIu64" Bytes: %-18"PRIu64" ]\n",
|
||||||
stats_text[dir][op],
|
stats_text[dir][op],
|
||||||
ts->pfrts_packets[dir][op],
|
ts->pfrts_packets[dir][op],
|
||||||
ts->pfrts_bytes[dir][op]);
|
ts->pfrts_bytes[dir][op]);
|
||||||
@ -429,7 +436,7 @@ print_astats(struct pfr_astats *as, int dns)
|
|||||||
printf("\tCleared: %s", ctime(&time));
|
printf("\tCleared: %s", ctime(&time));
|
||||||
for (dir = 0; dir < PFR_DIR_MAX; dir++)
|
for (dir = 0; dir < PFR_DIR_MAX; dir++)
|
||||||
for (op = 0; op < PFR_OP_ADDR_MAX; op++)
|
for (op = 0; op < PFR_OP_ADDR_MAX; op++)
|
||||||
printf("\t%-12s [ Packets: %-18llu Bytes: %-18llu ]\n",
|
printf("\t%-12s [ Packets: %-18"PRIu64" Bytes: %-18"PRIu64" ]\n",
|
||||||
stats_text[dir][op],
|
stats_text[dir][op],
|
||||||
as->pfras_packets[dir][op],
|
as->pfras_packets[dir][op],
|
||||||
as->pfras_bytes[dir][op]);
|
as->pfras_bytes[dir][op]);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
/* $OpenBSD: pflogd.c,v 1.21 2003/08/22 21:50:34 david Exp $ */
|
/* $OpenBSD: pflogd.c,v 1.21 2003/08/22 21:50:34 david Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,7 +45,15 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include "pidfile.h"
|
||||||
|
#else
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#define __dead __volatile
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEF_SNAPLEN 116 /* default plus allow for larger header of pflog */
|
#define DEF_SNAPLEN 116 /* default plus allow for larger header of pflog */
|
||||||
#define PCAP_TO_MS 500 /* pcap read timeout (ms) */
|
#define PCAP_TO_MS 500 /* pcap read timeout (ms) */
|
||||||
@ -79,7 +88,11 @@ int reset_dump(void);
|
|||||||
void sig_alrm(int);
|
void sig_alrm(int);
|
||||||
void sig_close(int);
|
void sig_close(int);
|
||||||
void sig_hup(int);
|
void sig_hup(int);
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
__volatile void usage(void);
|
||||||
|
#else
|
||||||
void usage(void);
|
void usage(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
Reference in New Issue
Block a user