xref: /f-stack/freebsd/netgraph/NOTES (revision a1fd9364)
1*a1fd9364Slogwang$FreeBSD$
2*a1fd9364SlogwangDevelopment ideas..
3*a1fd9364Slogwang
4*a1fd9364SlogwangArchie's suggestions... :-)
5*a1fd9364Slogwang
6*a1fd9364Slogwang - There should be a new malloc type: M_NETGRAPH
7*a1fd9364Slogwang	[DONE]
8*a1fd9364Slogwang	- all mallocs/frees now changed to use this.. JRE
9*a1fd9364Slogwang	- might further split them out some time.
10*a1fd9364Slogwang
11*a1fd9364Slogwang - Use MALLOC and FREE macros instead of direct function calls
12*a1fd9364Slogwang	[DONE]
13*a1fd9364Slogwang	- They allow conditional compilation which keeps
14*a1fd9364Slogwang	  statistics & counters on various memory allocation
15*a1fd9364Slogwang	  (or so it seems)
16*a1fd9364Slogwang	   - Now tend to have NG_FREE_XX() macros. they
17*a1fd9364Slogwang	     allow better debugging
18*a1fd9364Slogwang
19*a1fd9364Slogwang - In struct ng_mesg: at least make "header" into "hdr", if not
20*a1fd9364Slogwang   getting rid of it altogether. It doesn't seem necessary and
21*a1fd9364Slogwang   makes all my C code lines too long.
22*a1fd9364Slogwang
23*a1fd9364Slogwang	- I understand.. one thought however.. consider..
24*a1fd9364Slogwang	  if char data[0] were not legal,  so that data[1] needed to be
25*a1fd9364Slogwang	  used instead, then the only way to get the size of the header
26*a1fd9364Slogwang	  would be sizeof(msg.header) as sizeof(msg) would include the dummy
27*a1fd9364Slogwang	  following bytes. this is a portability issue and I hope
28*a1fd9364Slogwang	  it will be ported eventually :)
29*a1fd9364Slogwang
30*a1fd9364Slogwang	- Baloney! you can use sizeof(msg) - 1 then.. or just
31*a1fd9364Slogwang	  make it a macro, then its always portable:
32*a1fd9364Slogwang
33*a1fd9364Slogwang	  #ifdef __GNU_C__
34*a1fd9364Slogwang	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message))
35*a1fd9364Slogwang	  #else
36*a1fd9364Slogwang	    #define NG_MSG_HDR_SIZE	(sizeof(struct ng_message) - 1)
37*a1fd9364Slogwang	  #endif
38*a1fd9364Slogwang
39*a1fd9364Slogwang	  - inertia rules :-b
40*a1fd9364Slogwang
41*a1fd9364Slogwang
42*a1fd9364Slogwang - Have a user level program to print out and manipulate nodes, etc.
43*a1fd9364Slogwang	- [DONE]
44*a1fd9364Slogwang		see ngctl, nghook
45*a1fd9364Slogwang
46*a1fd9364Slogwang - "Netgraph global" flags to turn on tracing, etc.
47*a1fd9364Slogwang
48*a1fd9364Slogwang - ngctl needs to be rewritten using libnetgraph. Also it needs a
49*a1fd9364Slogwang   command to list all existing nodes (in case you don't know the
50*a1fd9364Slogwang   name of what you're looking for).
51*a1fd9364Slogwang	[DONE]
52*a1fd9364Slogwang
53*a1fd9364Slogwang - Need a way to get a list of ALL nodes.
54*a1fd9364Slogwang	[DONE]
55*a1fd9364Slogwang	- see NGM_LISTNODES
56*a1fd9364Slogwang
57*a1fd9364Slogwang - Enhance "netstat" to display all netgraph nodes -- or at least
58*a1fd9364Slogwang   all netgraph socket nodes.
59*a1fd9364Slogwang	[DONE]
60*a1fd9364Slogwang
61*a1fd9364Slogwang - BUG FIX: bind() on a socket should neither require nor allow a
62*a1fd9364Slogwang   colon character at the end of the name. Note ngctl allows you
63*a1fd9364Slogwang   to do it either way!
64*a1fd9364Slogwang	[DONE] (I think)
65*a1fd9364Slogwang	- bind on a control socket has been disabled
66*a1fd9364Slogwang	  it was a bad idea.
67*a1fd9364Slogwang
68*a1fd9364Slogwang - Need to implement passing meta information through socket nodes
69*a1fd9364Slogwang   using sendmsg() and recvmsg().
70*a1fd9364Slogwang
71*a1fd9364Slogwang - Stuff needing to be added to manual:
72*a1fd9364Slogwang
73*a1fd9364Slogwang   - Awareness of SPL level, use ng_queue*() functions when necessary.
74*a1fd9364Slogwang   - Malloc all memory with type M_NETGRAPH. -DONE
75*a1fd9364Slogwang   - Write code so it can be an LKM or built into the kernel.. this means
76*a1fd9364Slogwang     be careful with things like #ifdef INET.
77*a1fd9364Slogwang   - All nodes assume that all data mbufs have the M_PKTHDR flag set!
78*a1fd9364Slogwang     The ng_send_data() and related functions should have an
79*a1fd9364Slogwang     #ifdef DIAGNOSTIC check to check this assumption for every mbuf.
80*a1fd9364Slogwang     -DONE with INVARIANTS. Framework should test this more.
81*a1fd9364Slogwang   - More generally, netgraph code should make liberal use of the
82*a1fd9364Slogwang     #ifdef DIAGNOSTIC definition.
83*a1fd9364Slogwang     -INVARIANTS.
84*a1fd9364Slogwang   - Since data and messages are sent functionally, programmers need
85*a1fd9364Slogwang     to watch out for infinite feedback loops. Should ng_base.c detect
86*a1fd9364Slogwang     this automatically?
87*a1fd9364Slogwang      - I've been thinking about this. each node could have a 'colour'
88*a1fd9364Slogwang	which is set to the colour of the packet as you pass through.
89*a1fd9364Slogwang	hitting a node already of your colour would abort. Each packet
90*a1fd9364Slogwang	has another (incremented) colour.
91*a1fd9364Slogwang	-new 'item' type can hold a hopcount...
92*a1fd9364Slogwang
93*a1fd9364SlogwangNEW in 2001
94*a1fd9364SlogwangAll piggyback responses have gone away.
95*a1fd9364Slogwanguse the node ID in the return address field for quick response delivery.
96*a1fd9364Slogwang
97*a1fd9364SlogwangEvery node has a queue, plus there is a list of nodes that have queued work.
98*a1fd9364SlogwangExtensive use of Mutexes. Getting in shape for SMP.
99*a1fd9364Slogwang
100*a1fd9364SlogwangMessages and data are deliverd in a new form. An Item now has
101*a1fd9364Slogwangall information needed to queue such a request and deliver it later, so
102*a1fd9364Slogwangit is now the basis of all data transfer since any transfer may need to
103*a1fd9364Slogwangbe queued.
104