Home | History | Annotate | Download | only in iputils
      1 #! /bin/bash
      2 
      3 if [ -e /proc/modules ] ; then
      4 	modprobe pg3 >& /dev/null
      5 	modprobe pktgen >& /dev/null
      6 fi
      7 
      8 for PGDEV in /proc/net/pg /proc/net/pktgen/pg0 / ; do
      9 	[ -e ${PGDEV} ] && break
     10 done
     11 if [ "${PGDEV}" = "/" ] ; then
     12 	echo "Could not locate pg in /proc/net" 1>&2
     13 	exit 1
     14 fi
     15 
     16 function pgset() {
     17     local result
     18 
     19     echo $1 > ${PGDEV}
     20 
     21     result=`cat ${PGDEV} | fgrep "Result: OK:"`
     22     if [ "$result" = "" ]; then
     23          cat ${PGDEV} | fgrep Result:
     24     fi
     25 }
     26 
     27 function pg() {
     28     echo inject > ${PGDEV}
     29     cat ${PGDEV}
     30 }
     31 
     32 pgset "odev eth0"
     33 pgset "dst 0.0.0.0"
     34 
     35