[patch] handle pktgen setup in newer kernels in iputils/ipg

2006-12-20 Thread Mike Frysinger
the ipg script only works with the old pg3 module and not the new pktgen 
module ... attached patch updates the ipg script to support both
-mike


pgpDCI0UbHEoD.pgp
Description: PGP signature
Only load modules if kernel supports modules and try a little bit
harder to locate the pg directory in /proc with newer kernels.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]

--- a/ipg
+++ b/ipg
@@ -1,21 +1,32 @@
 #! /bin/bash
 
-modprobe pg3
+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 12
+	exit 1
+fi
 
 function pgset() {
 local result
 
-echo $1  /proc/net/pg
+echo $1  ${PGDEV}
 
-result=`cat /proc/net/pg | fgrep Result: OK:`
+result=`cat ${PGDEV} | fgrep Result: OK:`
 if [ $result =  ]; then
- cat /proc/net/pg | fgrep Result:
+ cat ${PGDEV} | fgrep Result:
 fi
 }
 
 function pg() {
-echo inject  /proc/net/pg
-cat /proc/net/pg
+echo inject  ${PGDEV}
+cat ${PGDEV}
 }
 
 pgset odev eth0


Re: [patch] handle pktgen setup in newer kernels in iputils/ipg

2006-12-20 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Wed, 20 Dec 2006 10:09:03 -0500), Mike 
Frysinger [EMAIL PROTECTED] says:

 the ipg script only works with the old pg3 module and not the new pktgen 
 module ... attached patch updates the ipg script to support both

Applied.  Thanks.

--yoshfuji
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html