summaryrefslogtreecommitdiffstats
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2015-11-11 08:21:18 -0600
committerLuiz Otavio O Souza <luiz@netgate.com>2015-11-11 08:22:00 -0600
commit53be5c5f6ada07c03bef4582a9634e682f026892 (patch)
tree2a1f8a160585dcca0d212304dc5823c359782450 /sbin/pfctl
parent4119672798028ff673a738690b48575973689004 (diff)
downloadFreeBSD-src-53be5c5f6ada07c03bef4582a9634e682f026892.zip
FreeBSD-src-53be5c5f6ada07c03bef4582a9634e682f026892.tar.gz
Revert "Importing pfSense patch altq_codel.diff"
This reverts commit cf3bb1a7166bec431631defe01c8d4e706a99638. TAG: CODEL
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y128
-rw-r--r--sbin/pfctl/pfctl_altq.c43
-rw-r--r--sbin/pfctl/pfctl_parser.h1
-rw-r--r--sbin/pfctl/pfctl_qstats.c36
4 files changed, 34 insertions, 174 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 7e32d16..0805ecc 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <altq/altq_priq.h>
#include <altq/altq_hfsc.h>
#include <altq/altq_fairq.h>
-#include <altq/altq_codel.h>
#include <stdio.h>
#include <unistd.h>
@@ -320,7 +319,6 @@ struct pool_opts {
struct node_hfsc_opts hfsc_opts;
struct node_fairq_opts fairq_opts;
-struct codel_opts codel_opts;
struct node_state_opt *keep_state_defaults = NULL;
int disallow_table(struct node_host *, const char *);
@@ -445,7 +443,6 @@ typedef struct {
struct pool_opts pool_opts;
struct node_hfsc_opts hfsc_opts;
struct node_fairq_opts fairq_opts;
- struct codel_opts codel_opts;
} v;
int lineno;
} YYSTYPE;
@@ -470,8 +467,8 @@ int parseport(char *, struct range *r, int);
%token REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID
%token ANTISPOOF FOR INCLUDE
%token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY
-%token ALTQ CBQ PRIQ HFSC FAIRQ CODEL BANDWIDTH TBRSIZE LINKSHARE REALTIME UPPERLIMIT
-%token QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE INTERVAL
+%token ALTQ CBQ PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME UPPERLIMIT
+%token QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE
%token DNPIPE DNQUEUE
%token LOAD RULESET_OPTIMIZATION
%token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE
@@ -522,7 +519,6 @@ int parseport(char *, struct range *r, int);
%type <v.number> priqflags_list priqflags_item
%type <v.hfsc_opts> hfscopts_list hfscopts_item hfsc_opts
%type <v.fairq_opts> fairqopts_list fairqopts_item fairq_opts
-%type <v.codel_opts> codelopts_list codelopts_item codel_opts
%type <v.queue_bwspec> bandwidth
%type <v.filter_opts> filter_opts filter_opt filter_opts_l
%type <v.antispoof_opts> antispoof_opts antispoof_opt antispoof_opts_l
@@ -1504,7 +1500,7 @@ altqif : ALTQ interface queue_opts QUEUE qassign {
a.scheduler = $3.scheduler.qtype;
a.qlimit = $3.qlimit;
a.tbrsize = $3.tbrsize;
- if ($5 == NULL && $3.scheduler.qtype != ALTQT_CODEL) {
+ if ($5 == NULL) {
yyerror("no child queues specified");
YYERROR;
}
@@ -1714,15 +1710,6 @@ scheduler : CBQ {
$$.qtype = ALTQT_FAIRQ;
$$.data.fairq_opts = $3;
}
- | CODEL {
- $$.qtype = ALTQT_CODEL;
- bzero(&$$.data.codel_opts,
- sizeof(struct codel_opts));
- }
- | CODEL '(' codel_opts ')' {
- $$.qtype = ALTQT_CODEL;
- $$.data.codel_opts = $3;
- }
;
cbqflags_list : cbqflags_item { $$ |= $1; }
@@ -1740,8 +1727,6 @@ cbqflags_item : STRING {
$$ = CBQCLF_RED|CBQCLF_ECN;
else if (!strcmp($1, "rio"))
$$ = CBQCLF_RIO;
- else if (!strcmp($1, "codel"))
- $$ = CBQCLF_CODEL;
else {
yyerror("unknown cbq flag \"%s\"", $1);
free($1);
@@ -1764,8 +1749,6 @@ priqflags_item : STRING {
$$ = PRCF_RED|PRCF_ECN;
else if (!strcmp($1, "rio"))
$$ = PRCF_RIO;
- else if (!strcmp($1, "codel"))
- $$ = PRCF_CODEL;
else {
yyerror("unknown priq flag \"%s\"", $1);
free($1);
@@ -1866,8 +1849,6 @@ hfscopts_item : LINKSHARE bandwidth {
hfsc_opts.flags |= HFCF_RED|HFCF_ECN;
else if (!strcmp($1, "rio"))
hfsc_opts.flags |= HFCF_RIO;
- else if (!strcmp($1, "codel"))
- hfsc_opts.flags |= HFCF_CODEL;
else {
yyerror("unknown hfsc flag \"%s\"", $1);
free($1);
@@ -1923,8 +1904,6 @@ fairqopts_item : LINKSHARE bandwidth {
fairq_opts.flags |= FARF_RED|FARF_ECN;
else if (!strcmp($1, "rio"))
fairq_opts.flags |= FARF_RIO;
- else if (!strcmp($1, "codel"))
- fairq_opts.flags |= FARF_CODEL;
else {
yyerror("unknown fairq flag \"%s\"", $1);
free($1);
@@ -1934,45 +1913,6 @@ fairqopts_item : LINKSHARE bandwidth {
}
;
-codel_opts : {
- bzero(&codel_opts,
- sizeof(struct codel_opts));
- }
- codelopts_list {
- $$ = codel_opts;
- }
- ;
-
-codelopts_list : codelopts_item
- | codelopts_list comma codelopts_item
- ;
-
-codelopts_item : QLIMIT number {
- if (codel_opts.target) {
- yyerror("target already specified");
- YYERROR;
- }
- codel_opts.target = $2;
- }
- | INTERVAL number {
- if (codel_opts.interval) {
- yyerror("interval already specified");
- YYERROR;
- }
- codel_opts.interval = $2;
- }
- | STRING {
- if (!strcmp($1, "ecn"))
- codel_opts.ecn = 1;
- else {
- yyerror("unknown codel option \"%s\"", $1);
- free($1);
- YYERROR;
- }
- free($1);
- }
- ;
-
qassign : /* empty */ { $$ = NULL; }
| qassign_item { $$ = $1; }
| '{' optnl qassign_list '}' { $$ = $3; }
@@ -5142,8 +5082,7 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces,
if ((pf->loadopt & PFCTL_FLAG_ALTQ) == 0) {
FREE_LIST(struct node_if, interfaces);
- if (nqueues)
- FREE_LIST(struct node_queue, nqueues);
+ FREE_LIST(struct node_queue, nqueues);
return (0);
}
@@ -5205,40 +5144,37 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces,
errs++;
}
- if (nqueues) {
- LOOP_THROUGH(struct node_queue, queue, nqueues,
- n = calloc(1, sizeof(struct node_queue));
- if (n == NULL)
- err(1, "expand_altq: calloc");
- if (pa.scheduler == ALTQT_CBQ ||
- pa.scheduler == ALTQT_HFSC /* ||
- pa.scheduler == ALTQT_FAIRQ */)
- if (strlcpy(n->parent, qname,
- sizeof(n->parent)) >=
- sizeof(n->parent))
- errx(1, "expand_altq: strlcpy");
- if (strlcpy(n->queue, queue->queue,
- sizeof(n->queue)) >= sizeof(n->queue))
- errx(1, "expand_altq: strlcpy");
- if (strlcpy(n->ifname, interface->ifname,
- sizeof(n->ifname)) >= sizeof(n->ifname))
+ LOOP_THROUGH(struct node_queue, queue, nqueues,
+ n = calloc(1, sizeof(struct node_queue));
+ if (n == NULL)
+ err(1, "expand_altq: calloc");
+ if (pa.scheduler == ALTQT_CBQ ||
+ pa.scheduler == ALTQT_HFSC /* ||
+ pa.scheduler == ALTQT_FAIRQ */)
+ if (strlcpy(n->parent, qname,
+ sizeof(n->parent)) >=
+ sizeof(n->parent))
errx(1, "expand_altq: strlcpy");
- n->scheduler = pa.scheduler;
- n->next = NULL;
- n->tail = n;
- if (queues == NULL)
- queues = n;
- else {
- queues->tail->next = n;
- queues->tail = n;
- }
- );
- }
+ if (strlcpy(n->queue, queue->queue,
+ sizeof(n->queue)) >= sizeof(n->queue))
+ errx(1, "expand_altq: strlcpy");
+ if (strlcpy(n->ifname, interface->ifname,
+ sizeof(n->ifname)) >= sizeof(n->ifname))
+ errx(1, "expand_altq: strlcpy");
+ n->scheduler = pa.scheduler;
+ n->next = NULL;
+ n->tail = n;
+ if (queues == NULL)
+ queues = n;
+ else {
+ queues->tail->next = n;
+ queues->tail = n;
+ }
+ );
}
);
FREE_LIST(struct node_if, interfaces);
- if (nqueues)
- FREE_LIST(struct node_queue, nqueues);
+ FREE_LIST(struct node_queue, nqueues);
return (errs);
}
@@ -5652,7 +5588,6 @@ lookup(char *s)
{ "buckets", BUCKETS},
{ "cbq", CBQ},
{ "code", CODE},
- { "codelq", CODEL},
{ "crop", FRAGCROP},
{ "debug", DEBUG},
{ "divert-reply", DIVERTREPLY},
@@ -5687,7 +5622,6 @@ lookup(char *s)
{ "include", INCLUDE},
{ "inet", INET},
{ "inet6", INET6},
- { "interval", INTERVAL},
{ "keep", KEEP},
{ "label", LABEL},
{ "limit", LIMIT},
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index bd83dd5..adba457 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
#include <altq/altq_priq.h>
#include <altq/altq_hfsc.h>
#include <altq/altq_fairq.h>
-#include <altq/altq_codel.h>
#include "pfctl_parser.h"
#include "pfctl.h"
@@ -76,9 +75,6 @@ static int print_fairq_opts(const struct pf_altq *,
const struct node_queue_opt *);
static int check_commit_fairq(int, int, struct pf_altq *);
-static int print_codel_opts(const struct pf_altq *,
- const struct node_queue_opt *);
-
static void gsc_add_sc(struct gen_sc *, struct service_curve *);
static int is_gsc_under_sc(struct gen_sc *,
struct service_curve *);
@@ -190,10 +186,6 @@ print_altq(const struct pf_altq *a, unsigned int level,
if (!print_fairq_opts(a, qopts))
printf("fairq ");
break;
- case ALTQT_CODEL:
- if (!print_codel_opts(a, qopts))
- printf("codel ");
- break;
}
if (bw != NULL && bw->bw_percent > 0) {
@@ -596,8 +588,6 @@ print_cbq_opts(const struct pf_altq *a)
printf(" ecn");
if (opts->flags & CBQCLF_RIO)
printf(" rio");
- if (opts->flags & CBQCLF_CODEL)
- printf(" codel");
if (opts->flags & CBQCLF_CLEARDSCP)
printf(" cleardscp");
if (opts->flags & CBQCLF_FLOWVALVE)
@@ -685,8 +675,6 @@ print_priq_opts(const struct pf_altq *a)
printf(" ecn");
if (opts->flags & PRCF_RIO)
printf(" rio");
- if (opts->flags & PRCF_CODEL)
- printf(" codel");
if (opts->flags & PRCF_CLEARDSCP)
printf(" cleardscp");
if (opts->flags & PRCF_DEFAULTCLASS)
@@ -1012,8 +1000,6 @@ print_hfsc_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
printf(" ecn");
if (opts->flags & HFCF_RIO)
printf(" rio");
- if (opts->flags & HFCF_CODEL)
- printf(" codel");
if (opts->flags & HFCF_CLEARDSCP)
printf(" cleardscp");
if (opts->flags & HFCF_DEFAULTCLASS)
@@ -1036,28 +1022,6 @@ print_hfsc_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
}
static int
-print_codel_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
-{
- const struct codel_opts *opts;
-
- opts = &a->pq_u.codel_opts;
- if (opts->target || opts->interval || opts->ecn) {
- printf("codel(");
- if (opts->target)
- printf(" target %d", opts->target);
- if (opts->interval)
- printf(" interval %d", opts->interval);
- if (opts->ecn)
- printf("ecn");
- printf(") ");
-
- return (1);
- }
-
- return (0);
-}
-
-static int
print_fairq_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
{
const struct fairq_opts *opts;
@@ -1079,8 +1043,6 @@ print_fairq_opts(const struct pf_altq *a, const struct node_queue_opt *qopts)
printf(" ecn");
if (opts->flags & FARF_RIO)
printf(" rio");
- if (opts->flags & FARF_CODEL)
- printf(" codel");
if (opts->flags & FARF_CLEARDSCP)
printf(" cleardscp");
if (opts->flags & FARF_DEFAULTCLASS)
@@ -1432,11 +1394,6 @@ eval_queue_opts(struct pf_altq *pa, struct node_queue_opt *opts,
opts->data.fairq_opts.linkshare.d;
}
break;
- case ALTQT_CODEL:
- pa->pq_u.codel_opts.target = opts->data.codel_opts.target;
- pa->pq_u.codel_opts.interval = opts->data.codel_opts.interval;
- pa->pq_u.codel_opts.ecn = opts->data.codel_opts.ecn;
- break;
default:
warnx("eval_queue_opts: unknown scheduler type %u",
opts->qtype);
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index 74a6a25..8a4e84e 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -169,7 +169,6 @@ struct node_queue_opt {
union {
struct cbq_opts cbq_opts;
struct priq_opts priq_opts;
- struct codel_opts codel_opts;
struct node_hfsc_opts hfsc_opts;
struct node_fairq_opts fairq_opts;
} data;
diff --git a/sbin/pfctl/pfctl_qstats.c b/sbin/pfctl/pfctl_qstats.c
index 5530572..4087d71 100644
--- a/sbin/pfctl/pfctl_qstats.c
+++ b/sbin/pfctl/pfctl_qstats.c
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include <altq/altq_priq.h>
#include <altq/altq_hfsc.h>
#include <altq/altq_fairq.h>
-#include <altq/altq_codel.h>
#include "pfctl.h"
#include "pfctl_parser.h"
@@ -49,7 +48,6 @@ union class_stats {
struct priq_classstats priq_stats;
struct hfsc_classstats hfsc_stats;
struct fairq_classstats fairq_stats;
- struct codel_ifstats codel_stats;
};
#define AVGN_MAX 8
@@ -80,7 +78,6 @@ void pfctl_print_altq_node(int, const struct pf_altq_node *,
unsigned, int);
void print_cbqstats(struct queue_stats);
void print_priqstats(struct queue_stats);
-void print_codelstats(struct queue_stats);
void print_hfscstats(struct queue_stats);
void print_fairqstats(struct queue_stats);
void pfctl_free_altq_node(struct pf_altq_node *);
@@ -168,7 +165,7 @@ pfctl_update_qstats(int dev, struct pf_altq_node **root)
return (-1);
}
#ifdef __FreeBSD__
- if ((pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) &&
+ if (pa.altq.qid > 0 &&
!(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) {
#else
if (pa.altq.qid > 0) {
@@ -306,7 +303,7 @@ pfctl_print_altq_node(int dev, const struct pf_altq_node *node,
void
pfctl_print_altq_nodestat(int dev, const struct pf_altq_node *a)
{
- if (a->altq.qid == 0 && a->altq.scheduler != ALTQT_CODEL)
+ if (a->altq.qid == 0)
return;
#ifdef __FreeBSD__
@@ -326,9 +323,6 @@ pfctl_print_altq_nodestat(int dev, const struct pf_altq_node *a)
case ALTQT_FAIRQ:
print_fairqstats(a->qstats);
break;
- case ALTQT_CODEL:
- print_codelstats(a->qstats);
- break;
}
}
@@ -374,26 +368,6 @@ print_priqstats(struct queue_stats cur)
}
void
-print_codelstats(struct queue_stats cur)
-{
- printf(" [ pkts: %10llu bytes: %10llu "
- "dropped pkts: %6llu bytes: %6llu ]\n",
- (unsigned long long)cur.data.codel_stats.cl_xmitcnt.packets,
- (unsigned long long)cur.data.codel_stats.cl_xmitcnt.bytes,
- (unsigned long long)cur.data.codel_stats.cl_dropcnt.packets + cur.data.codel_stats.stats.drop_cnt.packets,
- (unsigned long long)cur.data.codel_stats.cl_dropcnt.bytes + cur.data.codel_stats.stats.drop_cnt.bytes);
- printf(" [ qlength: %3d/%3d ]\n",
- cur.data.codel_stats.qlength, cur.data.codel_stats.qlimit);
-
- if (cur.avgn < 2)
- return;
-
- printf(" [ measured: %7.1f packets/s, %s/s ]\n",
- cur.avg_packets / STAT_INTERVAL,
- rate2str((8 * cur.avg_bytes) / STAT_INTERVAL));
-}
-
-void
print_hfscstats(struct queue_stats cur)
{
printf(" [ pkts: %10llu bytes: %10llu "
@@ -454,7 +428,7 @@ update_avg(struct pf_altq_node *a)
u_int64_t b, p;
int n;
- if (a->altq.qid == 0 && a->altq.scheduler != ALTQT_CODEL)
+ if (a->altq.qid == 0)
return;
qs = &a->qstats;
@@ -477,10 +451,6 @@ update_avg(struct pf_altq_node *a)
b = qs->data.fairq_stats.xmit_cnt.bytes;
p = qs->data.fairq_stats.xmit_cnt.packets;
break;
- case ALTQT_CODEL:
- b = qs->data.codel_stats.cl_xmitcnt.bytes;
- p = qs->data.codel_stats.cl_xmitcnt.packets;
- break;
default:
b = 0;
p = 0;
OpenPOWER on IntegriCloud