OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [net-common-configuring-ip-addresses.html] - Blame information for rev 232

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>Configuring IP Addresses</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="TCP/IP Stack Support for eCos"
23
HREF="net-common-tcpip.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Sample Code"
26
HREF="net-common-sample-code.html"><LINK
27
REL="NEXT"
28
TITLE="Tests and Demonstrations"
29
HREF="net-common-tests-and-demonstrations.html"></HEAD
30
><BODY
31
CLASS="CHAPTER"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="net-common-sample-code.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
></TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="net-common-tests-and-demonstrations.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="CHAPTER"
82
><H1
83
><A
84
NAME="NET-COMMON-CONFIGURING-IP-ADDRESSES">Chapter 35. Configuring IP Addresses</H1
85
><P
86
>Each interface (&#8220;eth0&#8221; and &#8220;eth1&#8221;)
87
has independent configuration of its setup.  Each can be set up
88
manually (in which case you must write code to do this), or by using
89
<SPAN
90
CLASS="ACRONYM"
91
>BOOTP/DHCP</SPAN
92
>,
93
or explicitly, with configured values. If additional
94
interfaces are added, these must be configured manually.</P
95
><P
96
>The configurable values are: </P
97
><P
98
></P
99
><UL
100
><LI
101
><P
102
>IP address</P
103
></LI
104
><LI
105
><P
106
>netmask</P
107
></LI
108
><LI
109
><P
110
>broadcast address</P
111
></LI
112
><LI
113
><P
114
>gateway/router</P
115
></LI
116
><LI
117
><P
118
>server address.</P
119
></LI
120
></UL
121
><P
122
>Server address is the DHCP server if applicable, but in addition,
123
many test cases use it as &#8220;the machine to talk to&#8221; in
124
whatever manner the test exercises the protocol stack.</P
125
><P
126
>The initialization is invoked by calling the C routine
127
<TABLE
128
BORDER="5"
129
BGCOLOR="#E0E0F0"
130
WIDTH="70%"
131
><TR
132
><TD
133
><PRE
134
CLASS="PROGRAMLISTING"
135
>void <TT
136
CLASS="FUNCTION"
137
>init_all_network_interfaces</TT
138
>(void);</PRE
139
></TD
140
></TR
141
></TABLE
142
></P
143
><P
144
>Additionally, if the system is configured to support IPv6 then each
145
interface may have an address assigned which is a composite of a 64 bit
146
prefix and the 32 bit IPv4 address for that interface.
147
The prefix is controlled by the CDL setting
148
CYGHWR_NET_DRIVER_ETH0_IPV6_PREFIX for &#8220;eth0&#8221;, etc.
149
This is a CDL booldata type, allowing this address to be suppressed if
150
not desired.</P
151
><P
152
>Refer to the test cases,
153
<TT
154
CLASS="FILENAME"
155
>&#8230;/packages/net/common/<TT
156
CLASS="REPLACEABLE"
157
><I
158
>VERSION</I
159
></TT
160
>/tests/ftp_test.c</TT
161
>
162
for example usage, and the source files in
163
<TT
164
CLASS="FILENAME"
165
>&#8230;/packages/net/common/<TT
166
CLASS="REPLACEABLE"
167
><I
168
>VERSION</I
169
></TT
170
>/src/bootp_support.c</TT
171
>
172
and
173
<TT
174
CLASS="FILENAME"
175
>network_support.c</TT
176
>
177
to see what that call does.</P
178
><P
179
>This assumes that the MAC address (also known as
180
<SPAN
181
CLASS="ACRONYM"
182
>ESA</SPAN
183
> or Ethernet Station Address)
184
is already defined in the
185
serial EEPROM or however the particular target implements this;
186
support for setting the MAC address is hardware dependent.</P
187
><P
188
>DHCP support is active by default, and there are configuration
189
options to control it.  Firstly, in the top level of the
190
&#8220;Networking&#8221; configuration
191
tree, &#8220;Use full DHCP instead of BOOTP&#8221; enables
192
DHCP, and it contains an option to have the system provide a thread
193
to renew DHCP leases and manage lease expiry. Secondly, the individual
194
interfaces &#8220;eth0&#8221; and &#8220;eth1&#8221; each
195
have new options within the &#8220;Use BOOTP/DHCP to
196
initialize &#8216;<SPAN
197
CLASS="emphasis"
198
><I
199
CLASS="EMPHASIS"
200
>ethX</I
201
></SPAN
202
>&#8217;&#8221; to
203
select whether to use DHCP rather than BOOTP.</P
204
><P
205
>Note that you are completely at liberty to ignore this startup code and its
206
configuration in building your application.
207
<TT
208
CLASS="FUNCTION"
209
>init_all_network_interfaces()</TT
210
>
211
is provided for three main purposes:
212
<P
213
></P
214
><UL
215
><LI
216
><P
217
>For use by Red Hat's own test programs.</P
218
></LI
219
><LI
220
><P
221
>As an easy &#8220;get you going&#8221; utility for
222
newcomers to <SPAN
223
CLASS="PRODUCTNAME"
224
>eCos</SPAN
225
>.</P
226
></LI
227
><LI
228
><P
229
>As readable example code from which further development
230
might start.</P
231
></LI
232
></UL
233
></P
234
><P
235
>If your application has different requirements for bringing up
236
available network interfaces, setting up routes, determining IP addresses
237
and the like from the defaults that the example code provides, you can
238
write your own initialization code to use whatever sequence of
239
<TT
240
CLASS="FUNCTION"
241
>ioctl()</TT
242
> function
243
calls carries out the desired setup.  Analogously, in larger systems,
244
a sequence of &#8220;ifconfig&#8221; invocations is used; these mostly
245
map to <TT
246
CLASS="FUNCTION"
247
>ioctl()</TT
248
> calls to manipulate the state of
249
the interface in question.</P
250
></DIV
251
><DIV
252
CLASS="NAVFOOTER"
253
><HR
254
ALIGN="LEFT"
255
WIDTH="100%"><TABLE
256
SUMMARY="Footer navigation table"
257
WIDTH="100%"
258
BORDER="0"
259
CELLPADDING="0"
260
CELLSPACING="0"
261
><TR
262
><TD
263
WIDTH="33%"
264
ALIGN="left"
265
VALIGN="top"
266
><A
267
HREF="net-common-sample-code.html"
268
ACCESSKEY="P"
269
>Prev</A
270
></TD
271
><TD
272
WIDTH="34%"
273
ALIGN="center"
274
VALIGN="top"
275
><A
276
HREF="ecos-ref.html"
277
ACCESSKEY="H"
278
>Home</A
279
></TD
280
><TD
281
WIDTH="33%"
282
ALIGN="right"
283
VALIGN="top"
284
><A
285
HREF="net-common-tests-and-demonstrations.html"
286
ACCESSKEY="N"
287
>Next</A
288
></TD
289
></TR
290
><TR
291
><TD
292
WIDTH="33%"
293
ALIGN="left"
294
VALIGN="top"
295
>Sample Code</TD
296
><TD
297
WIDTH="34%"
298
ALIGN="center"
299
VALIGN="top"
300
><A
301
HREF="net-common-tcpip.html"
302
ACCESSKEY="U"
303
>Up</A
304
></TD
305
><TD
306
WIDTH="33%"
307
ALIGN="right"
308
VALIGN="top"
309
>Tests and Demonstrations</TD
310
></TR
311
></TABLE
312
></DIV
313
></BODY
314
></HTML
315
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.