Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4759 | mejdrech | 1 | /** |
2 | |||
3 | \mainpage Networking and TCP/IP Stack for HelenOS system |
||
4 | |||
5 | \section introduction Introduction |
||
6 | |||
7 | <p> |
||
8 | For the microkernel HelenOS a completely new networking stack was designed. |
||
9 | The networking stack was intended to implement current basic standards of the TCP/IP Stack. |
||
10 | Only the minimalistic functionality allowing the stack to function was to be implemented. |
||
11 | The networking stack is written in C. |
||
12 | </p> |
||
13 | <p> |
||
14 | Please see |
||
15 | </p> |
||
16 | <ul> |
||
17 | <li>\ref build</li> |
||
18 | <li>\ref software</li> |
||
19 | <li>\ref running</li> |
||
20 | <li>\ref testing</li> |
||
21 | </ul> |
||
22 | |||
23 | \page build Build from sources |
||
24 | |||
25 | <p> |
||
26 | To compile the HelenOS from sources (the cross compilers from the <code>build/</code> directory are recommended): |
||
27 | </p> |
||
28 | <ol> |
||
29 | <li>change the working directory to the HelenOS source directory</li> |
||
30 | <li>run <code># make config</code></li> |
||
31 | <li>check/change the configuration</li> |
||
32 | <li>save and exit the configuration tool</li> |
||
33 | <li>run <code># make</code></li> |
||
34 | </ol> |
||
35 | <p> |
||
36 | The <code>image.iso</code> should be created on success. |
||
37 | </p> |
||
38 | |||
39 | \page running Running the HelenOS with networking |
||
40 | |||
41 | \section netstart Starting the networking |
||
42 | |||
43 | <p> |
||
44 | After starting the HelenOS boot image in <em>Qemu</em>, the command line appears. |
||
45 | To run <em>Qemu</em> a script <code>contrib/conf/qemu.sh</code> for Linux or <code>contrib/conf/qemu.bat</code> for Windows in the HelenOS source directory can be used. |
||
46 | The provided scripts set the needed arguments: |
||
47 | <br><code>-vga std -M isapc -net nic,model=ne2k_isa -net user -redir udp:8080::8080 -redir udp:8081::8081 -boot d -cdrom image.iso</code><br> |
||
48 | Additional arguments may be specified on the command line, they override these set. |
||
49 | </p> |
||
50 | |||
51 | <p> |
||
52 | The networking stack is started and initialized by running a command |
||
53 | <br><code># netstart</code><br> |
||
54 | The networking stack is then started and configured network interfaces are enabled. |
||
55 | The current configuration is printed out. |
||
56 | Since that networking applications can be run using the command line as well. |
||
57 | </p> |
||
58 | |||
59 | \section network Qemu network |
||
60 | |||
61 | <p> |
||
62 | In the common mode <em>Qemu</em> creates a simple network with a gateway and settles the guest system in. |
||
63 | The network is 10.0.2.*, the gateway's address 10.0.2.2 and the guest system has 10.0.2.15. |
||
64 | %Even this simple setting was a bit hard to find in the documentation. |
||
65 | Therefore a static configuration is possible and no additional DHCP nor BOOTP implementations are necessary. |
||
66 | On the other hand the guest system is behind a firewall. |
||
67 | <em>Qemu</em> may be configured to forward some ports to the guest system and allows all outgoing traffic except ICMP and ARP protocols, so you can ping only the gateway. |
||
68 | </p> |
||
69 | |||
70 | \section applications Applications |
||
71 | |||
72 | <p> |
||
73 | A few networking applications are located in the app/ directory. |
||
74 | Common functions for parsing command line arguments and printing textual networking error messages are located in that directory as well. |
||
75 | The networking applications should be built with the libsocket library located in the socket/libsocket.a file. |
||
76 | They can use functions and definitions from the include/socket.h header file which contains socket API and further includes: |
||
77 | </p> |
||
78 | <ul> |
||
79 | <li>include/byteorder.h containing byte order manipulation,</li> |
||
80 | <li>include/in.h containing IPv4 socket address structure,</li> |
||
81 | <li>include/in6.h containing IPv6 socket address structure,</li> |
||
82 | <li>include/inet.h containing socket address structure and parsing functions,</li> |
||
83 | <li>include/socket codes.h containing address and protocol families and socket types and option levels, and</li> |
||
84 | <li>include/socket errno.h containing socket and general error codes.</li> |
||
85 | </ul> |
||
86 | |||
87 | \page software Software prerequisites |
||
88 | |||
89 | <p> |
||
90 | The networking and TCP/IP stack is implemented for the ia32 architecture on top of HelenOS 0.4.1 (Escalopino), the most current stable release of HelenOS. |
||
91 | So far the only one operational network interface supported is in Qemu 0.10.2 and newer. |
||
92 | To run <em>Qemu</em> a script contrib/conf/qemu.sh for Linux or contrib/conf/qemu.bat for Windows in the HelenOS source directory can be used. |
||
93 | The qemu and its libraries have to be installed and in the path. |
||
94 | These scripts set all the necessary parameters |
||
95 | with some ports redirected from the local host to the guest system. |
||
96 | For testing purposes at least a low level communication application is recommended, N.E.T., netcat etc. |
||
97 | </p> |
||
98 | <p> |
||
99 | In order to build HelenOS and the networking stack from sources a few tools are |
||
100 | required: |
||
101 | <ul> |
||
102 | <li>binutils in version 2.19.1,</li> |
||
103 | <li>gcc–core in version 4.3.3 11,</li> |
||
104 | <li>gcc–objc in version 4.3.3, and</li> |
||
105 | <li>gcc–g++ in version 4.3.3.</li> |
||
106 | </ul> |
||
107 | <p> |
||
108 | All these can be downloaded and installed as cross–compilers on Linux using a script contrib/toolchain.sh in the HelenOS source directory. |
||
109 | In addition rats, a static source code analyzer, and Doxygen, a documentation generator, were used. |
||
110 | All development was tracked in the HelenOS subversion repository. |
||
111 | </p> |
||
112 | <ul> |
||
113 | <li>HelenOS website: <a href="http://www.helenos.org/" title="HelenOS website">http://www.helenos.org/</a></li> |
||
114 | <li><em>Qemu</em> website: <a href="http://www.qemu.org/" title="Qemu website">http://www.qemu.org/</a></li> |
||
115 | <li><em>binutils</em> website: <a href="http://www.gnu.org/software/binutils/" title="binutils website">http://www.gnu.org/software/binutils/</a></li> |
||
116 | <li><em>GCC</em> website: <a href="http://gcc.gnu.org/" title="GCC website">http://gcc.gnu.org/</a></li> |
||
117 | <li><em>RATS</em> website: <a href="http://www.fortify.com/security-resources/rats.jsp" title="RATS website">http://www.fortify.com/security-resources/rats.jsp</a></li> |
||
118 | <li><em>Doxygen</em> website: <a href="http://www.stack.nl/ dimitri/doxygen/index.html" title="Doxygen website">http://www.stack.nl/ dimitri/doxygen/index.html</a></li> |
||
119 | <li><em>Subversion</em> website: <a href="http://subversion.tigris.org/" title="Subversion website">http://subversion.tigris.org/</a></li> |
||
120 | </ul> |
||
121 | |||
122 | \page testing Testing scenarios |
||
123 | |||
124 | <p> |
||
125 | The scenarios contain the following shortcuts: |
||
126 | </p> |
||
127 | <ul> |
||
128 | <li>g for the quest system, HelenOS in <em>Qemu</em></li> |
||
129 | <li>h for the host system</li> |
||
130 | <li>n for the <em>NET</em> application</li> |
||
131 | <li>e for echo echo application run in HelenOS</li> |
||
132 | </ul> |
||
133 | |||
134 | \section scenarios Testing scenarios |
||
135 | <ul> |
||
136 | <li>UDP |
||
137 | <ol> |
||
138 | <li>g #netstart</li> |
||
139 | <li>h wine net.exe (->n) (or net.exe)</li> |
||
140 | <li>n set 127.0.0.1:8080 address and port, BuiltinUDP protocol</li> |
||
141 | <li>n send some data (an ARP will be generated and the original packet gets lost)</li> |
||
142 | <li>n send some data (the port is unreachable and the packet is discarded)</li> |
||
143 | <li>g #echo -p 8080 -c 3 -v (->e)</li> |
||
144 | <li>g prints Listening</li> |
||
145 | <li>n send some data</li> |
||
146 | <li>e prints received data</li> |
||
147 | <li>h prints reply</li> |
||
148 | <li>n click disconnect</li> |
||
149 | <li>n set :8081 port</li> |
||
150 | <li>n send some data</li> |
||
151 | <li>n click disconnect</li> |
||
152 | <li>n set :8080 port</li> |
||
153 | <li>count-1 times: |
||
154 | <ol> |
||
155 | <li>n send some data</li> |
||
156 | <li>e prints received data</li> |
||
157 | <li>h prints reply</li> |
||
158 | </ol> |
||
159 | </li> |
||
160 | <li>e prints Exiting</li> |
||
161 | <li>e quits</li> |
||
162 | <li>n send some data (the port is unreachable and the packet is discarded)</li> |
||
163 | </ol> |
||
164 | </li> |
||
165 | <li>ICMP echo to 10.0.2.2 |
||
166 | <ol> |
||
167 | <li>g #netstart</li> |
||
168 | <li>g #ping 10.0.2.2 (->p)</li> |
||
169 | <li>g prints ARP request for 10.0.2.2</li> |
||
170 | <li>g prints ARP reply from 10.0.2.2</li> |
||
171 | <li>p prints timeouted</li> |
||
172 | <li>p prints round trip time</li> |
||
173 | <li>p prints round trip time</li> |
||
174 | <li>p quits</li> |
||
175 | </ol> |
||
176 | </li> |
||
177 | <li>ICMP echo to 127.0.0.1 |
||
178 | <ol> |
||
179 | <li>g #netstart</li> |
||
180 | <li>g #ping 127.0.0.1 (->p)</li> |
||
181 | <li>p prints round trip time</li> |
||
182 | <li>p prints round trip time</li> |
||
183 | <li>p prints round trip time</li> |
||
184 | <li>p quits</li> |
||
185 | </ol> |
||
186 | </li> |
||
187 | <li>ICMP with no internet on the host system (!) |
||
188 | <ol> |
||
189 | <li>g #netstart</li> |
||
190 | <li>g #ping 123.123.123.3 (->p)</li> |
||
191 | <li>g prints ARP request for 10.0.2.2</li> |
||
192 | <li>g prints ARP reply from 10.0.2.2</li> |
||
193 | <li>p prints timeouted</li> |
||
194 | <li>p prints destination unreachable</li> |
||
195 | <li>p prints destination unreachable</li> |
||
196 | <li>p quits</li> |
||
197 | </ol> |
||
198 | </li> |
||
199 | </ul> |
||
200 | |||
201 | */ |