<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Configuring eCos</TITLE
|
>Configuring eCos</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="SNMP for eCos"
|
TITLE="SNMP for eCos"
|
HREF="net-snmp-ecos-port.html"><LINK
|
HREF="net-snmp-ecos-port.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="Starting the SNMP Agent"
|
TITLE="Starting the SNMP Agent"
|
HREF="net-snmp-starting-the-snmp-agent.html"><LINK
|
HREF="net-snmp-starting-the-snmp-agent.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Test cases"
|
TITLE="Test cases"
|
HREF="net-snmp-test-cases.html"></HEAD
|
HREF="net-snmp-test-cases.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECT1"
|
CLASS="SECT1"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-snmp-starting-the-snmp-agent.html"
|
HREF="net-snmp-starting-the-snmp-agent.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 47. SNMP for <SPAN
|
>Chapter 47. SNMP for <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>eCos</I
|
>eCos</I
|
></SPAN
|
></SPAN
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-snmp-test-cases.html"
|
HREF="net-snmp-test-cases.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="NET-SNMP-CONFIGURING-ECOS">Configuring eCos</H1
|
NAME="NET-SNMP-CONFIGURING-ECOS">Configuring eCos</H1
|
><P
|
><P
|
>To use the SNMP agent, the SNMP library and agent packages must be
|
>To use the SNMP agent, the SNMP library and agent packages must be
|
included in your configuration. To incorporate the stack into your
|
included in your configuration. To incorporate the stack into your
|
configuration select the SNMP library and SNMP agent packages in the
|
configuration select the SNMP library and SNMP agent packages in the
|
eCos Configuration Tool, or at the command line type:
|
eCos Configuration Tool, or at the command line type:
|
<TABLE
|
<TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>$ <TT
|
>$ <TT
|
CLASS="USERINPUT"
|
CLASS="USERINPUT"
|
><B
|
><B
|
>ecosconfig add snmplib snmpagent</B
|
>ecosconfig add snmplib snmpagent</B
|
></TT
|
></TT
|
></PRE
|
></PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></P
|
></P
|
><P
|
><P
|
>After adding the networking, common ethernet device drivers,
|
>After adding the networking, common ethernet device drivers,
|
snmp library and snmp agent packages, there is no configuration
|
snmp library and snmp agent packages, there is no configuration
|
required. However there are a number of configuration options
|
required. However there are a number of configuration options
|
that can be set such as some details for the System MIB, and
|
that can be set such as some details for the System MIB, and
|
disabling SNMPv3 support (see below).</P
|
disabling SNMPv3 support (see below).</P
|
><P
|
><P
|
>Starting the SNMP agent is not integrated into network
|
>Starting the SNMP agent is not integrated into network
|
tests other than <TT
|
tests other than <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>snmpping</TT
|
>snmpping</TT
|
> below, nor is it
|
> below, nor is it
|
started automatically in normal eCos startup -
|
started automatically in normal eCos startup -
|
it is up to the application to start the agent when it is ready,
|
it is up to the application to start the agent when it is ready,
|
at least after the network interfaces are both ‘up’.</P
|
at least after the network interfaces are both ‘up’.</P
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="NET-SNMP-VERSION-USAGE">Version usage (v1, v2 or v3)</H2
|
NAME="NET-SNMP-VERSION-USAGE">Version usage (v1, v2 or v3)</H2
|
><P
|
><P
|
>The default build supports all three versions of the SNMP protocol, but without
|
>The default build supports all three versions of the SNMP protocol, but without
|
any dispatcher functionality (rfc 2571, section 3.1.1.2). This has the
|
any dispatcher functionality (rfc 2571, section 3.1.1.2). This has the
|
following implications :</P
|
following implications :</P
|
><P
|
><P
|
> 1. There is no community authentication for v1 and v2c.</P
|
> 1. There is no community authentication for v1 and v2c.</P
|
><P
|
><P
|
>2. Security provided by v3 can be bypassed by using v1/v2c protocol.</P
|
>2. Security provided by v3 can be bypassed by using v1/v2c protocol.</P
|
><P
|
><P
|
>To provide the dispatcher with rfc 2571 type functionality, it is required to
|
>To provide the dispatcher with rfc 2571 type functionality, it is required to
|
set up security models and access profiles. This can be provided in the normal
|
set up security models and access profiles. This can be provided in the normal
|
Unix style by writing the required configurations in <TT
|
Unix style by writing the required configurations in <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>snmpd.conf</TT
|
>snmpd.conf</TT
|
>
|
>
|
file. Application code may setup profiles in <TT
|
file. Application code may setup profiles in <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>snmpd.conf</TT
|
>snmpd.conf</TT
|
> and
|
> and
|
optionally set the environment variable <TT
|
optionally set the environment variable <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>SNMPCONFPATH</TT
|
>SNMPCONFPATH</TT
|
> to
|
> to
|
point to the file if it is not in the usual location. The whole concept works
|
point to the file if it is not in the usual location. The whole concept works
|
in the usual way as with the standard UCD-SNMP distribution.</P
|
in the usual way as with the standard UCD-SNMP distribution.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="TRAPS">Traps</H2
|
NAME="TRAPS">Traps</H2
|
><P
|
><P
|
>The support of the <TT
|
>The support of the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>trapsink</TT
|
>trapsink</TT
|
> command in the
|
> command in the
|
<A
|
<A
|
HREF="net-snmp-agent-manpages-snmpd.conf.html"
|
HREF="net-snmp-agent-manpages-snmpd.conf.html"
|
>snmpd.conf</A
|
>snmpd.conf</A
|
> file is not tested
|
> file is not tested
|
and there may be problems for it working as expected. Moreover, in systems that do not
|
and there may be problems for it working as expected. Moreover, in systems that do not
|
have filesystem support, there is no way to configure a trap-session in the
|
have filesystem support, there is no way to configure a trap-session in the
|
conventional way.</P
|
conventional way.</P
|
><P
|
><P
|
>For reasons mentioned above, applications need to initialize their own trap
|
>For reasons mentioned above, applications need to initialize their own trap
|
sessions and pass it the details of trap-sink. The following is a small sample
|
sessions and pass it the details of trap-sink. The following is a small sample
|
for initializing a v1 trap session :</P
|
for initializing a v1 trap session :</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>typedef struct trap {
|
>typedef struct trap {
|
unsigned char ip [4];
|
unsigned char ip [4];
|
unsigned int port;
|
unsigned int port;
|
unsigned char community [256];
|
unsigned char community [256];
|
}
|
}
|
|
|
trap trapsink;
|
trap trapsink;
|
unsinged char sink [16];
|
unsinged char sink [16];
|
|
|
...
|
...
|
...
|
...
|
|
|
if (trapsink.ip != 0) {
|
if (trapsink.ip != 0) {
|
sprintf (sink, "%d.%d.%d.%d",
|
sprintf (sink, "%d.%d.%d.%d",
|
trapsink[0], trapsink[1], trapsink[2], trapsink[3]);
|
trapsink[0], trapsink[1], trapsink[2], trapsink[3]);
|
if (create_trap_session (sink,
|
if (create_trap_session (sink,
|
trapsink.port,
|
trapsink.port,
|
(char *)trapsink.community,
|
(char *)trapsink.community,
|
SNMP_VERSION_1,
|
SNMP_VERSION_1,
|
SNMP_MSG_TRAP) == 0) {
|
SNMP_MSG_TRAP) == 0) {
|
log_error ("Creation of trap session failed \n");
|
log_error ("Creation of trap session failed \n");
|
}
|
}
|
}</PRE
|
}</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="NET-SNMP-SNMPD-CONF"><TT
|
NAME="NET-SNMP-SNMPD-CONF"><TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>snmpd.conf</TT
|
>snmpd.conf</TT
|
> file</H2
|
> file</H2
|
><P
|
><P
|
>Using snmpd.conf requires the inclusion of one of the file-system packages
|
>Using snmpd.conf requires the inclusion of one of the file-system packages
|
(eg. CYGPKG_RAMFS) and CYGPKG_FILEIO. With these two packages included, the
|
(eg. CYGPKG_RAMFS) and CYGPKG_FILEIO. With these two packages included, the
|
SNMP sub-system will read the snmpd.conf file from the location specified in
|
SNMP sub-system will read the snmpd.conf file from the location specified in
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>SNMPCONFPATH</TT
|
>SNMPCONFPATH</TT
|
>, or the standard builtin locations, and use
|
>, or the standard builtin locations, and use
|
these profiles. Only the profiles specified in the <TT
|
these profiles. Only the profiles specified in the <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>ACCESS-CONTROL</TT
|
>ACCESS-CONTROL</TT
|
>
|
>
|
section of <A
|
section of <A
|
HREF="net-snmp-agent-manpages-snmpd.conf.html"
|
HREF="net-snmp-agent-manpages-snmpd.conf.html"
|
>snmpd.conf</A
|
>snmpd.conf</A
|
> file have
|
> file have
|
been tested and shown to work. Other profiles which have been implemented in
|
been tested and shown to work. Other profiles which have been implemented in
|
<TT
|
<TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>UCD-SNMP-4.1.2</TT
|
>UCD-SNMP-4.1.2</TT
|
>'s <TT
|
>'s <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>snmpd.conf</TT
|
>snmpd.conf</TT
|
> may not work
|
> may not work
|
because the sole purpose of adding support for the snmpd.conf file has been to
|
because the sole purpose of adding support for the snmpd.conf file has been to
|
set up <TT
|
set up <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>ACCESS-CONTROL</TT
|
>ACCESS-CONTROL</TT
|
> models.</P
|
> models.</P
|
><P
|
><P
|
>At startup, the SNMP module tries to look for file <TT
|
>At startup, the SNMP module tries to look for file <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>snmp.conf</TT
|
>snmp.conf</TT
|
>.
|
>.
|
If this file is not available, the module successively looks for files
|
If this file is not available, the module successively looks for files
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>snmpd.conf</TT
|
>snmpd.conf</TT
|
>, <TT
|
>, <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>snmp.local.conf</TT
|
>snmp.local.conf</TT
|
> and
|
> and
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>snmpd.local.conf</TT
|
>snmpd.local.conf</TT
|
> at the locations pointed to by <TT
|
> at the locations pointed to by <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>SNMPCONFPATH</TT
|
>SNMPCONFPATH</TT
|
> environment variable. In case <TT
|
> environment variable. In case <TT
|
CLASS="LITERAL"
|
CLASS="LITERAL"
|
>SNMPCONFPATH</TT
|
>SNMPCONFPATH</TT
|
> is not defined, the search sequence is carried out in default directories.
|
> is not defined, the search sequence is carried out in default directories.
|
The default directories are :<TT
|
The default directories are :<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>/usr/share/snmp</TT
|
>/usr/share/snmp</TT
|
>, <TT
|
>, <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>/usr/local/share/snmp</TT
|
>/usr/local/share/snmp</TT
|
> and <TT
|
> and <TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>$(HOME)/.snmp</TT
|
>$(HOME)/.snmp</TT
|
>.
|
>.
|
The configurations read from these files are used to control both, SNMP
|
The configurations read from these files are used to control both, SNMP
|
applications and the SNMP agent; in the usual UNIX fashion.</P
|
applications and the SNMP agent; in the usual UNIX fashion.</P
|
><P
|
><P
|
>The inclusion of snmpd.conf support is enabled by default when suitable
|
>The inclusion of snmpd.conf support is enabled by default when suitable
|
filesystems and FILEIO packages are active.</P
|
filesystems and FILEIO packages are active.</P
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-snmp-starting-the-snmp-agent.html"
|
HREF="net-snmp-starting-the-snmp-agent.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-snmp-test-cases.html"
|
HREF="net-snmp-test-cases.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>Starting the SNMP Agent</TD
|
>Starting the SNMP Agent</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-snmp-ecos-port.html"
|
HREF="net-snmp-ecos-port.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Test cases</TD
|
>Test cases</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|