You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
571 B
35 lines
571 B
#! /bin/bash
|
|
|
|
if [ -e /proc/modules ] ; then
|
|
modprobe pg3 >& /dev/null
|
|
modprobe pktgen >& /dev/null
|
|
fi
|
|
|
|
for PGDEV in /proc/net/pg /proc/net/pktgen/pg0 / ; do
|
|
[ -e ${PGDEV} ] && break
|
|
done
|
|
if [ "${PGDEV}" = "/" ] ; then
|
|
echo "Could not locate pg in /proc/net" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
function pgset() {
|
|
local result
|
|
|
|
echo $1 > ${PGDEV}
|
|
|
|
result=`cat ${PGDEV} | fgrep "Result: OK:"`
|
|
if [ "$result" = "" ]; then
|
|
cat ${PGDEV} | fgrep Result:
|
|
fi
|
|
}
|
|
|
|
function pg() {
|
|
echo inject > ${PGDEV}
|
|
cat ${PGDEV}
|
|
}
|
|
|
|
pgset "odev eth0"
|
|
pgset "dst 0.0.0.0"
|
|
|