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