1 .\" Copyright 2002 Sandvine Inc.
2 .\" All rights reserved.
4 .\" Subject to the following obligations and disclaimer of warranty, use and
5 .\" redistribution of this software, in source or object code forms, with or
6 .\" without modifications are expressly permitted by Sandvine Inc.; provided,
8 .\" 1. Any and all reproductions of the source or object code must include the
9 .\" copyright notice above and the following disclaimer of warranties; and
10 .\" 2. No rights are granted, in any manner or form, to use Sandvine Inc.
11 .\" trademarks, including the mark "SANDVINE" on advertising, endorsements,
12 .\" or otherwise except as such appears in the above copyright notice or in
15 .\" THIS SOFTWARE IS BEING PROVIDED BY SANDVINE "AS IS", AND TO THE MAXIMUM
16 .\" EXTENT PERMITTED BY LAW, SANDVINE MAKES NO REPRESENTATIONS OR WARRANTIES,
17 .\" EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, INCLUDING WITHOUT LIMITATION,
18 .\" ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 .\" PURPOSE, OR NON-INFRINGEMENT. SANDVINE DOES NOT WARRANT, GUARANTEE, OR
20 .\" MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE
21 .\" USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY
22 .\" OR OTHERWISE. IN NO EVENT SHALL SANDVINE BE LIABLE FOR ANY DAMAGES
23 .\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
24 .\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25 .\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
26 .\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
27 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 .\" THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH
32 .\" Author: Dave Chapeskie <dchapeskie@sandvine.com>
40 .Nd netgraph node for traffic generation
43 .In netgraph/ng_source.h
47 node acts as a source of packets according to the parameters set up
48 using control messages and input packets.
51 node type is used primarily for testing and benchmarking.
61 hook must remain connected, its disconnection will shutdown the node.
63 The operation of the node is as follows.
64 Packets received on the
66 hook are queued internally.
71 node assumes that its neighbour node is of
74 The neighbour is queried for its interface name.
77 node then uses queue of the interface for its evil purposes.
85 If interface name cannot be obtained automatically, it should
86 be configured explicitly with the
87 .Dv NGM_SOURCE_SETIFACE
90 should be turned off on
94 Once interface is configured, upon receipt of a
96 control message the node starts sending
97 the previously queued packets out the
99 hook on every clock tick as fast
100 as the connected interface will take them.
101 While active, on every clock tick the node checks the available space
102 in the interface queue and sends that many packets out its
105 Once the number of packets indicated in the start message has been
106 sent, or upon receipt of a
108 message, the node stops sending data.
110 This node type supports the generic control messages as well as the following,
111 which must be sent with the
112 .Dv NGM_SOURCE_COOKIE
114 .Bl -tag -width indent
115 .It Dv NGM_SOURCE_GET_STATS Pq Ic getstats
116 Returns a structure containing the following fields:
117 .Bl -tag -width indent
119 The number of octets/bytes sent out the
123 The number of frames/packets sent out the
127 The number of octets queued from the
131 The number of frames queued from the
135 The time the last start message was received.
137 The time the last end message was received or
138 the output packet count was reached.
141 .Va endTime Li \- Va startTime
146 .It Dv NGM_SOURCE_CLR_STATS Pq Ic clrstats
147 Clears and resets the statistics returned by
153 .It Dv NGM_SOURCE_GETCLR_STATS Pq Ic getclrstats
156 but clears the statistics at the same time.
157 .It Dv NGM_SOURCE_START Pq Ic start
158 This message requires a single
160 parameter which is the number of packets to
161 send before stopping.
162 Node starts sending the queued packets out the
167 hook must be connected and node must have
168 interface configured.
169 .It Dv NGM_SOURCE_STOP Pq Ic stop
170 Stops the node if it is active.
171 .It Dv NGM_SOURCE_CLR_DATA Pq Ic clrdata
172 Clears the packets queued from the
175 .It Dv NGM_SOURCE_SETIFACE Pq Ic setiface
176 This message requires the name of the interface
177 to be configured as an argument.
180 This node shuts down upon receipt of a
182 control message, when all hooks have been disconnected, or when the
184 hook has been disconnected.
186 Attach the node to an
188 node for an interface.
192 not already loaded you will need to do so.
193 For example, these commands
196 module and attach the
206 .Bd -literal -offset indent
208 ngctl mkpeer bge0: source orphans output
211 At this point the new node can be referred to as
212 .Dq Li bge0:orphans .
214 node can be given its own name like this:
216 .Dl "ngctl name bge0:orphans src0"
218 After which it can be referred to as
221 Once created, packets need to be sent to the node, the TCL net package
222 can be used to generate these packets:
224 [Sandvine specific TCL code example omitted]
226 To feed the output of the above TCL script to the
233 .Dl "tcl genPacket | nghook bge0:orphans input"
235 To check that the node has queued these packets you can get the node
237 .Bd -literal -offset indent
238 ngctl msg bge0:orphans getstats
239 Args: { queueOctets=64 queueFrames=1 }
242 Send as many packets as required out the
246 .Dl "ngctl msg bge0:orphans start 16"
248 Either wait for them to be sent (periodically fetching stats if desired)
249 or send the stop message:
251 .Dl "ngctl msg bge0:orphans stop"
253 Check the statistics (here we use
255 to also clear the statistics):
256 .Bd -literal -offset indent
257 ngctl msg bge0:orphans getclrstats
258 Args: { outOctets=1024 outFrames=16 queueOctets=64 queueFrames=1
259 startTime={ tv_sec=1035305880 tv_usec=758036 } endTime={ tv_sec=1035305880
260 tv_usec=759041 } elapsedTime={ tv_usec=1005 } }
264 .Vt "struct timeval" Ns s ,
267 field is seconds since
268 the Epoch and can be converted into a date string via TCL's [clock
272 .Bd -literal -offset indent
274 Tue Oct 22 12:58:00 EDT 2002
286 node type was implemented in
289 .An Dave Chapeskie Aq dchapeskie@SANDVINE.com