Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npfreview - ALTQ integration in NPF #41

Open
wants to merge 51 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d9c7834
Compile-time error fix in altq
Emmankoko Jun 23, 2024
ffcb3f9
Plain grammar for ALTQ configuration in /etc/npf.conf
Emmankoko Dec 13, 2024
2fd15e9
Integrate NPF into ALTQ: might be a goodbye for PF & ALTQ
Emmankoko Dec 13, 2024
e129664
kernel component that loads altq configurations into altq framework
Emmankoko Dec 13, 2024
fe498ea
Userland code parses the altq configurations and sends to kernel
Emmankoko Dec 13, 2024
f76fd61
userland code to append queue to rule
Emmankoko Dec 13, 2024
fd84198
kernel code to append queue to a rule
Emmankoko Dec 13, 2024
4a5b362
flushing config with altq
Emmankoko Dec 13, 2024
5cc7846
starting ALTQ in npf
Emmankoko Dec 13, 2024
6cbbed7
stop queueing
Emmankoko Dec 13, 2024
2f2f046
print statistics on queueing and filtering
Emmankoko Dec 14, 2024
9599712
show altq using npfctl show -q
Emmankoko Dec 14, 2024
d9ba839
fix err, return parens, sizeof args, and copyright issues
Emmankoko Dec 27, 2024
7f07037
proper spacing between functions
Emmankoko Dec 27, 2024
cbfff41
fix whitespaces
Emmankoko Dec 27, 2024
e7216e7
fix copyright
Emmankoko Dec 27, 2024
86cd137
Revert "Compile-time error fix in altq" and return 0
Emmankoko Dec 28, 2024
ebae4b6
fix whitespaces
Emmankoko Dec 30, 2024
7051f34
use right copyright details
Emmankoko Dec 30, 2024
a899c77
fix whitespace in scanner
Emmankoko Dec 30, 2024
e80bde5
fix whitespace in scanner
Emmankoko Dec 30, 2024
60ebc66
align bw spec whitespace
Emmankoko Dec 30, 2024
403fe9a
use sized types for queue opts
Emmankoko Dec 30, 2024
8f35381
put everything in ALTQ defined block
Emmankoko Dec 30, 2024
40efed2
fix whitespace in npftest Makefile
Emmankoko Dec 30, 2024
7733e69
proper spacing in rule queue
Emmankoko Dec 30, 2024
0273dcc
full stop in copyright detail
Emmankoko Dec 30, 2024
f8014a9
clear verbosity
Emmankoko Dec 30, 2024
7bd6cea
fix whitespace: put comments beside
Emmankoko Dec 30, 2024
70646c2
rightly align fields
Emmankoko Dec 30, 2024
c1d4d29
use right comment indennt
Emmankoko Dec 30, 2024
52e2d09
no cast in malloc, use sizeof(dest), and uintX_t
Emmankoko Dec 30, 2024
7018fa1
single responsibility principle: expand_altq
Emmankoko Dec 31, 2024
1c55bfd
quest for shorter functions: extract queue appending from expand queue
Emmankoko Dec 31, 2024
ea45bd1
misc: fix missing return type on setqueue
Emmankoko Dec 31, 2024
8ea898a
add npf stuff to expected symbols
Emmankoko Dec 31, 2024
77dffed
single responsibility principle: extract scheduler check from expand …
Emmankoko Dec 31, 2024
48a3a26
fix sizeof and err in npfctl_qstats
Emmankoko Dec 31, 2024
1f609c7
terminating #ifndef in npf_altq.h
Emmankoko Dec 31, 2024
552e5f3
rename opts to use right objs
Emmankoko Dec 31, 2024
85c7657
define opt in kernel option
Emmankoko Dec 31, 2024
eba2b11
terminate kernelndef
Emmankoko Dec 31, 2024
61e41c9
minor fix in npfaltq func prototype
Emmankoko Dec 31, 2024
0c6caed
provide def for npf_qid_unref
Emmankoko Jan 1, 2025
4c26bec
fix bad *
Emmankoko Jan 1, 2025
1442253
comment space
Emmankoko Jan 1, 2025
70df3d0
remove comment
Emmankoko Jan 1, 2025
a2b3961
use right open_dev sig
Emmankoko Jan 1, 2025
bcb24ec
match build rule sig
Emmankoko Jan 1, 2025
3b9f162
fis minors spell and copyright
Emmankoko Jan 1, 2025
0cb00a6
define struct segment
Emmankoko Jan 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions sys/altq/altq_cbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.41 2024/09/26 02:39:09 ozaki-r Exp $"
#include <net/if.h>
#include <netinet/in.h>

#if NPF > 0
#include <net/pfvar.h>
#endif
#include <net/npf/npf_altq.h>
#include <altq/altq.h>
#include <altq/altq_cbq.h>
#ifdef ALTQ3_COMPAT
Expand Down Expand Up @@ -242,9 +240,8 @@ get_class_stats(class_stats_t *statsp, struct rm_class *cl)
#endif
}

#if NPF > 0
int
cbq_pfattach(struct pf_altq *a)
cbq_npfattach(struct npf_altq *a)
{
struct ifnet *ifp;
int s, error;
Expand All @@ -259,7 +256,7 @@ cbq_pfattach(struct pf_altq *a)
}

int
cbq_add_altq(struct pf_altq *a)
cbq_add_altq(struct npf_altq *a)
{
cbq_state_t *cbqp;
struct ifnet *ifp;
Expand All @@ -278,14 +275,14 @@ cbq_add_altq(struct pf_altq *a)
cbqp->cbq_qlen = 0;
cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */

/* keep the state in pf_altq */
/* keep the state in npf_altq */
a->altq_disc = cbqp;

return (0);
}

int
cbq_remove_altq(struct pf_altq *a)
cbq_remove_altq(struct npf_altq *a)
{
cbq_state_t *cbqp;

Expand All @@ -308,7 +305,7 @@ cbq_remove_altq(struct pf_altq *a)

#define NSEC_TO_PSEC(s) ((uint64_t)(s) * 1000)
int
cbq_add_queue(struct pf_altq *a)
cbq_add_queue(struct npf_altq *a)
{
struct rm_class *borrow, *parent;
cbq_state_t *cbqp;
Expand Down Expand Up @@ -415,7 +412,7 @@ cbq_add_queue(struct pf_altq *a)
}

int
cbq_remove_queue(struct pf_altq *a)
cbq_remove_queue(struct npf_altq *a)
{
struct rm_class *cl;
cbq_state_t *cbqp;
Expand Down Expand Up @@ -451,7 +448,7 @@ cbq_remove_queue(struct pf_altq *a)
}

int
cbq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
cbq_getqstats(struct npf_altq *a, void *ubuf, int *nbytes)
{
cbq_state_t *cbqp;
struct rm_class *cl;
Expand All @@ -475,7 +472,6 @@ cbq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
*nbytes = sizeof(stats);
return (0);
}
#endif /* NPF > 0 */

/*
* int
Expand Down
25 changes: 13 additions & 12 deletions sys/altq/altq_hfsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ __KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.30 2021/09/21 14:30:15 christos Exp
#include "pf.h"
#endif

#ifndef NPF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

#define NPF 1
#endif


#ifdef ALTQ_HFSC /* hfsc is enabled by ALTQ_HFSC option in opt_altq.h */

#include <sys/param.h>
Expand All @@ -70,9 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.30 2021/09/21 14:30:15 christos Exp
#include <net/if.h>
#include <netinet/in.h>

#if NPF > 0
#include <net/pfvar.h>
#endif
#include <net/npf/npf_altq.h>
#include <altq/altq.h>
#include <altq/altq_hfsc.h>
#ifdef ALTQ3_COMPAT
Expand Down Expand Up @@ -173,9 +176,8 @@ altqdev_decl(hfsc);
static struct hfsc_if *hif_list = NULL;
#endif /* ALTQ3_COMPAT */

#if NPF > 0
int
hfsc_pfattach(struct pf_altq *a)
hfsc_npfattach(struct npf_altq *a)
{
struct ifnet *ifp;
int s, error;
Expand All @@ -190,7 +192,7 @@ hfsc_pfattach(struct pf_altq *a)
}

int
hfsc_add_altq(struct pf_altq *a)
hfsc_add_altq(struct npf_altq *a)
{
struct hfsc_if *hif;
struct ifnet *ifp;
Expand All @@ -212,14 +214,14 @@ hfsc_add_altq(struct pf_altq *a)

hif->hif_ifq = &ifp->if_snd;

/* keep the state in pf_altq */
/* keep the state in npf_altq */
a->altq_disc = hif;

return (0);
}

int
hfsc_remove_altq(struct pf_altq *a)
hfsc_remove_altq(struct npf_altq *a)
{
struct hfsc_if *hif;

Expand All @@ -238,7 +240,7 @@ hfsc_remove_altq(struct pf_altq *a)
}

int
hfsc_add_queue(struct pf_altq *a)
hfsc_add_queue(struct npf_altq *a)
{
struct hfsc_if *hif;
struct hfsc_class *cl, *parent;
Expand Down Expand Up @@ -281,7 +283,7 @@ hfsc_add_queue(struct pf_altq *a)
}

int
hfsc_remove_queue(struct pf_altq *a)
hfsc_remove_queue(struct npf_altq *a)
{
struct hfsc_if *hif;
struct hfsc_class *cl;
Expand All @@ -296,7 +298,7 @@ hfsc_remove_queue(struct pf_altq *a)
}

int
hfsc_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
hfsc_getqstats(struct npf_altq *a, void *ubuf, int *nbytes)
{
struct hfsc_if *hif;
struct hfsc_class *cl;
Expand All @@ -320,7 +322,6 @@ hfsc_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
*nbytes = sizeof(stats);
return (0);
}
#endif /* NPF > 0 */

/*
* bring the interface back to the initial state by discarding
Expand Down
25 changes: 13 additions & 12 deletions sys/altq/altq_priq.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ __KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.28 2021/09/21 14:30:15 christos Exp
#include "pf.h"
#endif

#ifndef NPF
#define NPF 1
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?



#ifdef ALTQ_PRIQ /* priq is enabled by ALTQ_PRIQ option in opt_altq.h */

#include <sys/param.h>
Expand All @@ -56,9 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.28 2021/09/21 14:30:15 christos Exp
#include <net/if.h>
#include <netinet/in.h>

#if NPF > 0
#include <net/pfvar.h>
#endif
#include <net/npf/npf_altq.h>
#include <altq/altq.h>
#include <altq/altq_conf.h>
#include <altq/altq_priq.h>
Expand Down Expand Up @@ -105,9 +108,8 @@ altqdev_decl(priq);
static struct priq_if *pif_list = NULL;
#endif /* ALTQ3_COMPAT */

#if NPF > 0
int
priq_pfattach(struct pf_altq *a)
priq_npfattach(struct npf_altq *a)
{
struct ifnet *ifp;
int s, error;
Expand All @@ -122,7 +124,7 @@ priq_pfattach(struct pf_altq *a)
}

int
priq_add_altq(struct pf_altq *a)
priq_add_altq(struct npf_altq *a)
{
struct priq_if *pif;
struct ifnet *ifp;
Expand All @@ -139,14 +141,14 @@ priq_add_altq(struct pf_altq *a)
pif->pif_maxpri = -1;
pif->pif_ifq = &ifp->if_snd;

/* keep the state in pf_altq */
/* keep the state in npf_altq */
a->altq_disc = pif;

return (0);
}

int
priq_remove_altq(struct pf_altq *a)
priq_remove_altq(struct npf_altq *a)
{
struct priq_if *pif;

Expand All @@ -161,7 +163,7 @@ priq_remove_altq(struct pf_altq *a)
}

int
priq_add_queue(struct pf_altq *a)
priq_add_queue(struct npf_altq *a)
{
struct priq_if *pif;
struct priq_class *cl;
Expand All @@ -188,7 +190,7 @@ priq_add_queue(struct pf_altq *a)
}

int
priq_remove_queue(struct pf_altq *a)
priq_remove_queue(struct npf_altq *a)
{
struct priq_if *pif;
struct priq_class *cl;
Expand All @@ -203,7 +205,7 @@ priq_remove_queue(struct pf_altq *a)
}

int
priq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
priq_getqstats(struct npf_altq *a, void *ubuf, int *nbytes)
{
struct priq_if *pif;
struct priq_class *cl;
Expand All @@ -227,7 +229,6 @@ priq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
*nbytes = sizeof(stats);
return (0);
}
#endif /* NPF > 0 */

/*
* bring the interface back to the initial state by discarding
Expand Down
Loading