Changes between Initial Version and Version 1 of TBR/UserManual/Controlling_ICMP_ECHO_(PING)_requests


Ignore:
Timestamp:
05/31/06 14:54:45 (18 years ago)
Author:
StevenJ
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TBR/UserManual/Controlling_ICMP_ECHO_(PING)_requests

    v1 v1  
     1= Controlling ICMP ECHO (PING) requests =
     2
     3
     4Note: The "allecho" sysctl feature discussed here is only available in RTEMS CVS, and versions after 4.6.99.3.
     5
     6RTEMS provides 2 methods for controlling replies generated to ICMP ECHO requests (known as a '''PING''').
     7
     8By default, the RTEMS network stack will reply to a "'''PING"''' directed both to the IP address of the device running RTEMS and to the broadcast address.
     9
     10The standard "BSD" way to prevent a ping to a broadcast/multicast address being echoed is to use the '''''bmcastecho''''' sysctl.  Setting this sysctl to 0 will prevent any ping to a broadcast/multicast address being echoed.
     11
     12However, some applications also require that ANY ping directed to the device not be echoed.  The BSD network stack utilised by RTEM has no standard feature to allow this.  RTEMS has implemented a non-portable "Extension" to allow all Pings recieved by a device to not be echoed.  This feature is controlled by the '''''allecho''''' sysctl.  Setting this sysctl to 0 will prevent any "ping" to the device to be not echoed.  As this extension is specific to RTEMS, code that uses it will not function as expected on other systems, use with caution if portability is desired.
     13
     14'''''allecho''''' set to 0 - prevents all echo's.[[BR]]
     15'''''allecho''''' set to 1, '''''bmcastecho''''' set to 0 - only prevents all broadcast/multcast echo's.[[BR]]
     16'''''allecho''''' set to 1, '''''bmcastecho''''' set to 1 - allows all echo's (default state).
     17
     18For details on setting sysctl's in the network stack, refer to [wiki:TCP-IP_Setup_Using_SYSCTL TCP-IP Setup Using SYSCTL]
     19
     20Both of these sysctl's are of the OID_AUTO type.  '''sysctlbyname''' is the most convenient way to modify these values.
     21
     22Examples:
     23
     24Prevent icmp echo replies to a broadcast/multicast address:
     25{{{
     26int    value = 0;
     27size_t len   = sizeof(value);
     28
     29result = sysctlbyname ("bmcastecho", NULL, 0, &value, len);
     30}}}
     31
     32Allow icmp echo replies to a broadcast/multicast address:
     33{{{
     34int    value = 1;
     35size_t len   = sizeof(value);
     36
     37result = sysctlbyname ("bmcastecho", NULL, 0, &value, len);
     38}}}
     39
     40Prevent all echo replies:
     41{{{
     42int    value = 0;
     43size_t len   = sizeof(value);
     44
     45result = sysctlbyname ("allecho", NULL, 0, &value, len);
     46}}}
     47
     48Allow all echo replies, broadcast/multicast echo's may still be blocked by '''''bmcastecho''''':
     49{{{
     50int    value = 1;
     51size_t len   = sizeof(value);
     52
     53result = sysctlbyname ("allecho", NULL, 0, &value, len);
     54}}}