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