netgraph/ng_source: Allow ng_source to inject into any netgraph network

PR:		240530
Reviewed by:	kp
Approved by:	kp (mentor)
MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D21968
This commit is contained in:
Lutz Donnerhacke 2021-01-17 21:35:28 +01:00
parent 74935ce881
commit 75e7ef74df
2 changed files with 11 additions and 4 deletions

View File

@ -32,7 +32,7 @@
.\" Author: Dave Chapeskie
.\" $FreeBSD$
.\"
.Dd March 1, 2007
.Dd January 18, 2021
.Dt NG_SOURCE 4
.Os
.Sh NAME
@ -91,7 +91,14 @@ should be turned off on
.Xr ng_ether 4
node manually.
.Pp
Once interface is configured, upon receipt of a
If the node is connected to a netgraph network, which does not
terminate in a real
.Xr ng_ether 4
interface, limit the packet injection rate explicitly with the
.Va NGM_SOURCE_SETPPS
control message.
.Pp
Upon receipt of a
.Dv NGM_SOURCE_START
control message the node starts sending
the previously queued packets out the

View File

@ -683,8 +683,8 @@ ng_source_clr_data (sc_p sc)
static int
ng_source_start(sc_p sc, uint64_t packets)
{
if (sc->output_ifp == NULL) {
printf("ng_source: start without iface configured\n");
if (sc->output_ifp == NULL && sc->stats.maxPps == 0) {
printf("ng_source: start without iface or pps configured\n");
return (ENXIO);
}