xref: /freebsd/sys/netgraph/NOTES (revision 78d146160dc5339c9cdf7799551bcc442a6eb95b)
14cf49a43SJulian ElischerDevelopment ideas..
24cf49a43SJulian Elischer
34cf49a43SJulian ElischerArchie's suggestions... :-)
44cf49a43SJulian Elischer
54cf49a43SJulian Elischer - There should be a new malloc type: M_NETGRAPH
64cf49a43SJulian Elischer	[DONE]
74cf49a43SJulian Elischer	- all mallocs/frees now changed to use this.. JRE
84cf49a43SJulian Elischer	- might further split them out some time.
94cf49a43SJulian Elischer
104cf49a43SJulian Elischer - Use MALLOC and FREE macros instead of direct function calls
114cf49a43SJulian Elischer	[DONE]
124cf49a43SJulian Elischer	- They allow conditional compilation which keeps
134cf49a43SJulian Elischer	  statistics & counters on various memory allocation
144cf49a43SJulian Elischer	  (or so it seems)
15069154d5SJulian Elischer	   - Now tend to have NG_FREE_XX() macros. they
16069154d5SJulian Elischer	     allow better debugging
174cf49a43SJulian Elischer
184cf49a43SJulian Elischer - In struct ng_mesg: at least make "header" into "hdr", if not
194cf49a43SJulian Elischer   getting rid of it altogether. It doesn't seem necessary and
204cf49a43SJulian Elischer   makes all my C code lines too long.
214cf49a43SJulian Elischer
224cf49a43SJulian Elischer	- I understand.. one thought however.. consider..
234cf49a43SJulian Elischer	  if char data[0] were not legal,  so that data[1] needed to be
244cf49a43SJulian Elischer	  used instead, then the only way to get the size of the header
254cf49a43SJulian Elischer	  would be sizeof(msg.header) as sizeof(msg) would include the dummy
264cf49a43SJulian Elischer	  following bytes. this is a portability issue and I hope
274cf49a43SJulian Elischer	  it will be ported eventually :)
284cf49a43SJulian Elischer
294cf49a43SJulian Elischer	- Baloney! you can use sizeof(msg) - 1 then.. or just
304cf49a43SJulian Elischer	  make it a macro, then its always portable:
314cf49a43SJulian Elischer
324cf49a43SJulian Elischer	  #ifdef __GNU_C__
334cf49a43SJulian Elischer	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message))
344cf49a43SJulian Elischer	  #else
354cf49a43SJulian Elischer	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message) - 1)
364cf49a43SJulian Elischer	  #endif
374cf49a43SJulian Elischer
38069154d5SJulian Elischer	  - inertia rules :-b
39069154d5SJulian Elischer
40069154d5SJulian Elischer
414cf49a43SJulian Elischer - Have a user level program to print out and manipulate nodes, etc.
424cf49a43SJulian Elischer	- [DONE]
43069154d5SJulian Elischer		see ngctl, nghook
444cf49a43SJulian Elischer
454cf49a43SJulian Elischer - "Netgraph global" flags to turn on tracing, etc.
464cf49a43SJulian Elischer
474cf49a43SJulian Elischer - ngctl needs to be rewritten using libnetgraph. Also it needs a
484cf49a43SJulian Elischer   command to list all existing nodes (in case you don't know the
494cf49a43SJulian Elischer   name of what you're looking for).
504cf49a43SJulian Elischer	[DONE]
514cf49a43SJulian Elischer
524cf49a43SJulian Elischer - Need a way to get a list of ALL nodes.
534cf49a43SJulian Elischer	[DONE]
544cf49a43SJulian Elischer	- see NGM_LISTNODES
554cf49a43SJulian Elischer
564cf49a43SJulian Elischer - Enhance "netstat" to display all netgraph nodes -- or at least
574cf49a43SJulian Elischer   all netgraph socket nodes.
584cf49a43SJulian Elischer	[DONE]
594cf49a43SJulian Elischer
604cf49a43SJulian Elischer - BUG FIX: bind() on a socket should neither require nor allow a
614cf49a43SJulian Elischer   colon character at the end of the name. Note ngctl allows you
624cf49a43SJulian Elischer   to do it either way!
634cf49a43SJulian Elischer	[DONE] (I think)
64069154d5SJulian Elischer	- bind on a control socket has been disabled
65069154d5SJulian Elischer	  it was a bad idea.
664cf49a43SJulian Elischer
674cf49a43SJulian Elischer - Need to implement passing meta information through socket nodes
684cf49a43SJulian Elischer   using sendmsg() and recvmsg().
694cf49a43SJulian Elischer
704cf49a43SJulian Elischer - Stuff needing to be added to manual:
714cf49a43SJulian Elischer
724cf49a43SJulian Elischer   - Awareness of SPL level, use ng_queue*() functions when necessary.
73069154d5SJulian Elischer   - Malloc all memory with type M_NETGRAPH. -DONE
744cf49a43SJulian Elischer   - Write code so it can be an LKM or built into the kernel.. this means
754cf49a43SJulian Elischer     be careful with things like #ifdef INET.
764cf49a43SJulian Elischer   - All nodes assume that all data mbufs have the M_PKTHDR flag set!
774cf49a43SJulian Elischer     The ng_send_data() and related functions should have an
7890147b75SRuslan Ermilov     #ifdef DIAGNOSTIC check to check this assumption for every mbuf.
79069154d5SJulian Elischer     -DONE with INVARIANTS. Framework should test this more.
804cf49a43SJulian Elischer   - More generally, netgraph code should make liberal use of the
8190147b75SRuslan Ermilov     #ifdef DIAGNOSTIC definition.
82069154d5SJulian Elischer     -INVARIANTS.
834cf49a43SJulian Elischer   - Since data and messages are sent functionally, programmers need
844cf49a43SJulian Elischer     to watch out for infinite feedback loops. Should ng_base.c detect
854cf49a43SJulian Elischer     this automatically?
864cf49a43SJulian Elischer      - I've been thinking about this. each node could have a 'colour'
874cf49a43SJulian Elischer	which is set to the colour of the packet as you pass through.
884cf49a43SJulian Elischer	hitting a node already of your colour would abort. Each packet
894cf49a43SJulian Elischer	has another (incremented) colour.
90069154d5SJulian Elischer	-new 'item' type can hold a hopcount...
91069154d5SJulian Elischer
92069154d5SJulian ElischerNEW in 2001
93069154d5SJulian ElischerAll piggyback responses have gone away.
94069154d5SJulian Elischeruse the node ID in the return address field for quick response delivery.
95069154d5SJulian Elischer
96069154d5SJulian ElischerEvery node has a queue, plus there is a list of nodes that have queued work.
97069154d5SJulian ElischerExtensive use of Mutexes. Getting in shape for SMP.
98069154d5SJulian Elischer
99069154d5SJulian ElischerMessages and data are deliverd in a new form. An Item now has
100069154d5SJulian Elischerall information needed to queue such a request and deliver it later, so
101069154d5SJulian Elischerit is now the basis of all data transfer since any transfer may need to
102069154d5SJulian Elischerbe queued.
103