From: Mike Frysinger <vapier@gentoo.org>
To: netdev@vger.kernel.org
Subject: [patch] handle pktgen setup in newer kernels in iputils/ipg
Date: Wed, 20 Dec 2006 10:09:03 -0500 [thread overview]
Message-ID: <200612201009.04138.vapier@gentoo.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 152 bytes --]
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
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: iputils-ipg-tweaks.patch --]
[-- Type: text/x-diff, Size: 993 bytes --]
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 <vapier@gentoo.org>
--- 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" 1>&2
+ 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"
next reply other threads:[~2006-12-20 15:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-20 15:09 Mike Frysinger [this message]
2006-12-20 15:23 ` [patch] handle pktgen setup in newer kernels in iputils/ipg YOSHIFUJI Hideaki / 吉藤英明
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200612201009.04138.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).