Page MenuHomeFreeBSD

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

Authored by donner on Oct 10 2019, 1:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 4:44 AM
Unknown Object (File)
Wed, Nov 13, 7:42 PM
Unknown Object (File)
Fri, Nov 8, 9:51 PM
Unknown Object (File)
Thu, Nov 7, 5:13 AM
Unknown Object (File)
Mon, Nov 4, 8:59 AM
Unknown Object (File)
Thu, Oct 31, 9:41 AM
Unknown Object (File)
Sat, Oct 26, 8:01 AM
Unknown Object (File)
Oct 5 2024, 9:24 AM

Details

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.

kp added a subscriber: kp.

Other than the date in the man page this looks sane to me.

Approved by: kp (mentor)

share/man/man4/ng_source.4
35

Remember to update the date

This revision is now accepted and ready to land.Jan 17 2021, 8:01 PM

Bump the date in the man page.

This revision now requires review to proceed.Jan 17 2021, 8:40 PM
This revision is now accepted and ready to land.Jan 17 2021, 8:41 PM