Download raw body.
bump pf/hfsc queue bandwidth
On Mon, Oct 28, 2024 at 10:30:24PM +1000, David Gwynne wrote:
> i think this is enough to be able to specify high queue bandwidths in
> pf.conf. the hfsc code looks like it already works in 64bit, so it's
> just about getting the pfctl and the ioctls to also carry that around.
>
> this doesnt provide any compat for the old ioctls, it just bumps with
> the expectation that if you care about this you'll upgrade the kernel
> and pfctl (and systat) at the same time.
>
> i live in australia, so i don't have high bandwidth connectivity to test
> this out with. anyone willing to kick it around?
unless anyone objects, i'm going to go ahead and commit this in a day or
two. it is an abi break, but using snaps to upgrade is so easy these
days i dont think that's actually going to be a problem in practice.
>
> Index: sbin/pfctl/parse.y
> ===================================================================
> RCS file: /cvs/src/sbin/pfctl/parse.y,v
> diff -u -p -r1.717 parse.y
> --- sbin/pfctl/parse.y 20 Sep 2024 02:00:46 -0000 1.717
> +++ sbin/pfctl/parse.y 28 Oct 2024 12:16:53 -0000
> @@ -1540,10 +1540,14 @@ bandwidth : STRING {
> }
> }
> free($1);
> - $$.bw_absolute = (u_int32_t)bps;
> + if (bps < 0 || bps > (double)LLONG_MAX) {
> + yyerror("bandwidth number too big");
> + YYERROR;
> + }
> + $$.bw_absolute = (u_int64_t)bps;
> }
> | NUMBER {
> - if ($1 < 0 || $1 > UINT_MAX) {
> + if ($1 < 0 || $1 > LLONG_MAX) {
> yyerror("bandwidth number too big");
> YYERROR;
> }
> Index: sbin/pfctl/pfctl_parser.c
> ===================================================================
> RCS file: /cvs/src/sbin/pfctl/pfctl_parser.c,v
> diff -u -p -r1.351 pfctl_parser.c
> --- sbin/pfctl/pfctl_parser.c 22 Apr 2024 13:30:22 -0000 1.351
> +++ sbin/pfctl/pfctl_parser.c 28 Oct 2024 12:16:53 -0000
> @@ -1213,7 +1213,7 @@ print_tabledef(const char *name, int fla
> void
> print_bwspec(const char *prefix, struct pf_queue_bwspec *bw)
> {
> - u_int rate;
> + uint64_t rate;
> int i;
> static const char unit[] = " KMG";
>
> @@ -1223,7 +1223,7 @@ print_bwspec(const char *prefix, struct
> rate = bw->absolute;
> for (i = 0; rate >= 1000 && i <= 3 && (rate % 1000 == 0); i++)
> rate /= 1000;
> - printf("%s%u%c", prefix, rate, unit[i]);
> + printf("%s%llu%c", prefix, rate, unit[i]);
> }
> }
>
> Index: sbin/pfctl/pfctl_parser.h
> ===================================================================
> RCS file: /cvs/src/sbin/pfctl/pfctl_parser.h,v
> diff -u -p -r1.120 pfctl_parser.h
> --- sbin/pfctl/pfctl_parser.h 14 Jul 2024 19:51:08 -0000 1.120
> +++ sbin/pfctl/pfctl_parser.h 28 Oct 2024 12:16:53 -0000
> @@ -142,7 +142,7 @@ struct node_os {
> };
>
> struct node_queue_bw {
> - u_int32_t bw_absolute;
> + u_int64_t bw_absolute;
> u_int16_t bw_percent;
> };
>
> Index: sys/net/pfvar.h
> ===================================================================
> RCS file: /cvs/src/sys/net/pfvar.h,v
> diff -u -p -r1.540 pfvar.h
> --- sys/net/pfvar.h 12 Oct 2024 23:31:14 -0000 1.540
> +++ sys/net/pfvar.h 28 Oct 2024 12:16:54 -0000
> @@ -1241,7 +1241,7 @@ struct pf_status {
> #define PF_PRIO_ZERO 0xff /* match "prio 0" packets */
>
> struct pf_queue_bwspec {
> - u_int absolute;
> + uint64_t absolute;
> u_int percent;
> };
>
bump pf/hfsc queue bandwidth