Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / netgraph / NOTES
1 $FreeBSD: src/sys/netgraph/NOTES,v 1.1 1999/10/21 09:05:51 julian Exp $
2 Development ideas..
3
4 Archie'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
17  - In struct ng_mesg: at least make "header" into "hdr", if not
18    getting rid of it altogether. It doesn't seem necessary and
19    makes all my C code lines too long.
20
21         - I understand.. one thought however.. consider..
22           if char data[0] were not legal,  so that data[1] needed to be
23           used instead, then the only way to get the size of the header
24           would be sizeof(msg.header) as sizeof(msg) would include the dummy
25           following bytes. this is a portability issue and I hope
26           it will be ported eventually :)
27
28         - Baloney! you can use sizeof(msg) - 1 then.. or just
29           make it a macro, then its always portable:
30
31           #ifdef __GNU_C__
32             #define NG_MSG_HDR_SIZE     (sizeof(struct ng_message))
33           #else
34             #define NG_MSG_HDR_SIZE     (sizeof(struct ng_message) - 1)
35           #endif
36
37  - Have a user level program to print out and manipulate nodes, etc.
38         - [DONE]
39                 see ngctl
40
41  - "Netgraph global" flags to turn on tracing, etc.
42
43  - ngctl needs to be rewritten using libnetgraph. Also it needs a
44    command to list all existing nodes (in case you don't know the
45    name of what you're looking for).
46         [DONE]
47
48  - Need a way to get a list of ALL nodes.
49         [DONE]
50         - see NGM_LISTNODES
51
52  - Enhance "netstat" to display all netgraph nodes -- or at least
53    all netgraph socket nodes.
54         [DONE]
55
56  - BUG FIX: bind() on a socket should neither require nor allow a
57    colon character at the end of the name. Note ngctl allows you
58    to do it either way!
59         [DONE] (I think)
60
61  - Need to implement passing meta information through socket nodes
62    using sendmsg() and recvmsg().
63
64  - Stuff needing to be added to manual:
65
66    - Awareness of SPL level, use ng_queue*() functions when necessary.
67    - Malloc all memory with type M_NETGRAPH.
68    - Write code so it can be an LKM or built into the kernel.. this means
69      be careful with things like #ifdef INET.
70    - All nodes assume that all data mbufs have the M_PKTHDR flag set!
71      The ng_send_data() and related functions should have an
72      #ifdef DIAGNOSTICS check to check this assumption for every mbuf.
73    - More generally, netgraph code should make liberal use of the
74      #ifdef DIAGNOSTICS definition.
75    - Since data and messages are sent functionally, programmers need
76      to watch out for infinite feedback loops. Should ng_base.c detect
77      this automatically?
78       - I've been thinking about this. each node could have a 'colour'
79         which is set to the colour of the packet as you pass through.
80         hitting a node already of your colour would abort. Each packet
81         has another (incremented) colour.