= Controlling ICMP ECHO (PING) requests = Note: The '''''allecho''''' sysctl feature discussed here is only available in RTEMS CVS, and versions after 4.6.99.3. RTEMS provides 2 methods for controlling replies generated to ICMP ECHO requests (known as a '''PING'''). By 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. The 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. However, 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. '''''allecho''''' set to 0 - prevents all echo's.[[BR]] '''''allecho''''' set to 1, '''''bmcastecho''''' set to 0 - only prevents all broadcast/multcast echo's.[[BR]] '''''allecho''''' set to 1, '''''bmcastecho''''' set to 1 - allows all echo's (default state). For details on setting sysctl's in the network stack, refer to [wiki:TCP-IP_Setup_Using_SYSCTL TCP-IP Setup Using SYSCTL] Both of these sysctl's are of the OID_AUTO type. '''sysctlbyname''' is the most convenient way to modify these values. Examples: Prevent icmp echo replies to a broadcast/multicast address: {{{ int value = 0; size_t len = sizeof(value); result = sysctlbyname ("bmcastecho", NULL, 0, &value, len); }}} Allow icmp echo replies to a broadcast/multicast address: {{{ int value = 1; size_t len = sizeof(value); result = sysctlbyname ("bmcastecho", NULL, 0, &value, len); }}} Prevent all echo replies: {{{ int value = 0; size_t len = sizeof(value); result = sysctlbyname ("allecho", NULL, 0, &value, len); }}} Allow all echo replies, broadcast/multicast echo's may still be blocked by '''''bmcastecho''''': {{{ int value = 1; size_t len = sizeof(value); result = sysctlbyname ("allecho", NULL, 0, &value, len); }}}