#!/bin/sh
# Discover nanostation using CDPv1 packets
# Credits: http://sidewynder.blogspot.com/2005/07/tcpdump-filter-for-capturing-only.html

if [ "x$1" = "x" ]; then
  echo "Usage: $0 <iface> [count]" 1>&2
  echo "Find (lost) Nanostation IP using 'count' CDPv1 packet(s)"
  echo "Normally CDPv1 packets get send every minute" 1>&2
  echo "Interface hints: `ifconfig -l`" 1>&2
  exit 1
fi
IFACE=$1
# By default the local and remote will announce a broadcast.
COUNT=${2-2}


tcpdump -nn -v -i $IFACE -s 1500 -c $COUNT 'ether[18:4] == 0x000c2000'
