Page MenuHomeFreeBSD

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

Authored by lutz_donnerhacke.de on Oct 10 2019, 1:11 PM.

Details

Reviewers
koobs
linimon
Group Reviewers
network
manpages
Summary

ng_source is a module for debugging and performance measurement within netgraph.

The current implementation is designed to emit packets to an physical ethernet interface and tries to maximize the hardware throughput. There is already code to limit the packet rate injected (maxpps) further.

The whole code is able to inject any netgraph messages into any netgraph network, despite the dependency to a physical interface prohibits this at the moment.

This patch allows to use the ng_source module to be used in arbitary netgraph network. In order to limit the rate of packets injected, the maxpps part needs to be enforced if there is no assigned ethernet interface available.

I personally use this patch to profile somewhat complex netgraph networks, which terminate in i.e. in eiface nodes.

PR:240530

Test Plan
$ ngctl
+ mkpeer . eiface a
+ mkpeer . eiface b
+ mkpeer a.ether source input
+ name a.ether.input s
+ connect s b output ether

The old code would not allow to start sourcing, because there is no physical ethernet to deal with for rate limiting.

Now send some IP packets to the eiface a and ...

+ msg s setpps 1000
+ msg s start 10

... shout them out at a given rate. This is observable by i.e tcpdump.

Diff Detail

Repository
rS FreeBSD src repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 33828
Build 31045: arc lint + arc unit

Event Timeline

I'm afraid I don't know anything about this code.

Added documentation for the new behavior in the man page.

Do you have any performance measurements?
Is it have advantages over injecting packets through ng_socket(4) or ng_device(4)?

Do you have any performance measurements?
Is it have advantages over injecting packets through ng_socket(4) or ng_device(4)?

I used it with a ng_tee node. The left2right hook was connected to the input hook of ng_source and the output hook injects back into the right2left hook. This allows me to capture a real world sequence of traffic inside the netgraph network and then reuse this traffic for stress tests.