Files | |
file | arp.h |
ARP Module for Modtronix TCP/IP Stack. | |
file | icmp.h |
ICMP Module for Modtronix TCP/IP Stack. |
IP Gleaning does not require any additional software modules. Instead, it uses the ARP and ICMP modules. To use it, the file "icmp.c" must be included in the project, and the compiler define STACK_USE_IP_GLEANING must be uncommented in the StackTsh.h header file.
With IP Gleaning enabled, the Microchip Stack enters into a special "IP Configuration" mode on RESET. During this mode, it accepts any ICMP (ping) message that is destined to this node, and sets the node’s IP address to that of the ping message’s destination. Once a valid ping packet is received, the stack exits from "Configuration" and enters into normal mode.
During configuration, the user application must not attempt to communicate; it may call the function StackIsInConfigMode() to determine whether or not the stack is in Configuration mode. StackIsInConfigMode() == TRUE indicates that Stack is in Configuration mode.
To remotely set the IP address of stack node, it is necessary to issue a sequence of commands from a remote machine. For this example, assume that a node running the Microchip Stack needs to be assigned an IP address of 10.10.5.106. The MAC address of this node (hexadecimal) is 0a-0a-0a-0a-0a-0a. After resetting the node, another system on the network (we will assume a computer running Microsoft Windows) issues the commands:
> arp -s 10.10.5.106 0a-0a-0a-0a-0a-0a > ping 10.10.5.106
This should generate a standard series of ping responses from 10.10.5.106, indicating the node has been successfully assigned the IP address.