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