Upon receiving a perimeter-mode packet for forwarding, GPSR first compares the location Lp in a perimeter-mode packet with the forwarding node’s location. GPSR returns a packet to greedy mode if the distance from the forwarding node to D is less than that from Lp to D. 3 Perimeter forwarding is only intended to recover from a local maximum; once the packet reaches a location closer than where greedy forwarding previously failed for that packet, thepacket can continue greedy progress toward the destination without danger of returning to the prior local maximum.