xref: /dflybsd-src/sys/netgraph/NOTES (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino$FreeBSD: src/sys/netgraph/NOTES,v 1.1 1999/10/21 09:05:51 julian Exp $
286d7f5d3SJohn Marino$DragonFly: src/sys/netgraph/NOTES,v 1.2 2003/06/17 04:28:49 dillon Exp $
386d7f5d3SJohn MarinoDevelopment ideas..
486d7f5d3SJohn Marino
586d7f5d3SJohn MarinoArchie's suggestions... :-)
686d7f5d3SJohn Marino
786d7f5d3SJohn Marino - There should be a new malloc type: M_NETGRAPH
886d7f5d3SJohn Marino	[DONE]
986d7f5d3SJohn Marino	- all mallocs/frees now changed to use this.. JRE
1086d7f5d3SJohn Marino	- might further split them out some time.
1186d7f5d3SJohn Marino
1286d7f5d3SJohn Marino - Use MALLOC and FREE macros instead of direct function calls
1386d7f5d3SJohn Marino	[DONE]
1486d7f5d3SJohn Marino	- They allow conditional compilation which keeps
1586d7f5d3SJohn Marino	  statistics & counters on various memory allocation
1686d7f5d3SJohn Marino	  (or so it seems)
1786d7f5d3SJohn Marino
1886d7f5d3SJohn Marino - In struct ng_mesg: at least make "header" into "hdr", if not
1986d7f5d3SJohn Marino   getting rid of it altogether. It doesn't seem necessary and
2086d7f5d3SJohn Marino   makes all my C code lines too long.
2186d7f5d3SJohn Marino
2286d7f5d3SJohn Marino	- I understand.. one thought however.. consider..
2386d7f5d3SJohn Marino	  if char data[0] were not legal,  so that data[1] needed to be
2486d7f5d3SJohn Marino	  used instead, then the only way to get the size of the header
2586d7f5d3SJohn Marino	  would be sizeof(msg.header) as sizeof(msg) would include the dummy
2686d7f5d3SJohn Marino	  following bytes. this is a portability issue and I hope
2786d7f5d3SJohn Marino	  it will be ported eventually :)
2886d7f5d3SJohn Marino
2986d7f5d3SJohn Marino	- Baloney! you can use sizeof(msg) - 1 then.. or just
3086d7f5d3SJohn Marino	  make it a macro, then its always portable:
3186d7f5d3SJohn Marino
3286d7f5d3SJohn Marino	  #ifdef __GNU_C__
3386d7f5d3SJohn Marino	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message))
3486d7f5d3SJohn Marino	  #else
3586d7f5d3SJohn Marino	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message) - 1)
3686d7f5d3SJohn Marino	  #endif
3786d7f5d3SJohn Marino
3886d7f5d3SJohn Marino - Have a user level program to print out and manipulate nodes, etc.
3986d7f5d3SJohn Marino	- [DONE]
4086d7f5d3SJohn Marino		see ngctl
4186d7f5d3SJohn Marino
4286d7f5d3SJohn Marino - "Netgraph global" flags to turn on tracing, etc.
4386d7f5d3SJohn Marino
4486d7f5d3SJohn Marino - ngctl needs to be rewritten using libnetgraph. Also it needs a
4586d7f5d3SJohn Marino   command to list all existing nodes (in case you don't know the
4686d7f5d3SJohn Marino   name of what you're looking for).
4786d7f5d3SJohn Marino	[DONE]
4886d7f5d3SJohn Marino
4986d7f5d3SJohn Marino - Need a way to get a list of ALL nodes.
5086d7f5d3SJohn Marino	[DONE]
5186d7f5d3SJohn Marino	- see NGM_LISTNODES
5286d7f5d3SJohn Marino
5386d7f5d3SJohn Marino - Enhance "netstat" to display all netgraph nodes -- or at least
5486d7f5d3SJohn Marino   all netgraph socket nodes.
5586d7f5d3SJohn Marino	[DONE]
5686d7f5d3SJohn Marino
5786d7f5d3SJohn Marino - BUG FIX: bind() on a socket should neither require nor allow a
5886d7f5d3SJohn Marino   colon character at the end of the name. Note ngctl allows you
5986d7f5d3SJohn Marino   to do it either way!
6086d7f5d3SJohn Marino	[DONE] (I think)
6186d7f5d3SJohn Marino
6286d7f5d3SJohn Marino - Need to implement passing meta information through socket nodes
6386d7f5d3SJohn Marino   using sendmsg() and recvmsg().
6486d7f5d3SJohn Marino
6586d7f5d3SJohn Marino - Stuff needing to be added to manual:
6686d7f5d3SJohn Marino
6786d7f5d3SJohn Marino   - Awareness of SPL level, use ng_queue*() functions when necessary.
6886d7f5d3SJohn Marino   - Malloc all memory with type M_NETGRAPH.
6986d7f5d3SJohn Marino   - Write code so it can be an LKM or built into the kernel.. this means
7086d7f5d3SJohn Marino     be careful with things like #ifdef INET.
7186d7f5d3SJohn Marino   - All nodes assume that all data mbufs have the M_PKTHDR flag set!
7286d7f5d3SJohn Marino     The ng_send_data() and related functions should have an
7386d7f5d3SJohn Marino     #ifdef DIAGNOSTICS check to check this assumption for every mbuf.
7486d7f5d3SJohn Marino   - More generally, netgraph code should make liberal use of the
7586d7f5d3SJohn Marino     #ifdef DIAGNOSTICS definition.
7686d7f5d3SJohn Marino   - Since data and messages are sent functionally, programmers need
7786d7f5d3SJohn Marino     to watch out for infinite feedback loops. Should ng_base.c detect
7886d7f5d3SJohn Marino     this automatically?
7986d7f5d3SJohn Marino      - I've been thinking about this. each node could have a 'colour'
8086d7f5d3SJohn Marino	which is set to the colour of the packet as you pass through.
8186d7f5d3SJohn Marino	hitting a node already of your colour would abort. Each packet
8286d7f5d3SJohn Marino	has another (incremented) colour.
83