summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-09-09 12:20:21 -0400
committerWolfgang Denk <wd@denx.de>2009-09-15 22:55:45 +0200
commit1c20e4a9fbc531e2149ae061e8583f5fad82f163 (patch)
tree91ddbbefae4e11424e8e8d0f8be60031a789b501 /tools
parent770931805d292908a57a3d2c5f9a4fcde888b5a2 (diff)
tools/netconsole: use ncb automatically if available
The standard netcat, while ubiquitous, doesn't handle broadcast udp packets properly. The local ncb util does however. So if ncb can be located in the standard locations, automatically use that instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/netconsole17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/netconsole b/tools/netconsole
index 6ef2723f584..c8109bb0956 100755
--- a/tools/netconsole
+++ b/tools/netconsole
@@ -39,9 +39,20 @@ echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
stty -icanon -echo intr ^T
(
-while ${nc} -u -l -p ${port} < /dev/null ; do
- :
-done
+if type ncb 2>/dev/null ; then
+ # see if ncb is in $PATH
+ exec ncb ${port}
+
+elif [ -x ${0%/*}/ncb ] ; then
+ # maybe it's in the same dir as the netconsole script
+ exec ${0%/*}/ncb ${port}
+
+else
+ # blah, just use regular netcat
+ while ${nc} -u -l -p ${port} < /dev/null ; do
+ :
+ done
+fi
) &
pid=$!
${nc} -u ${ip} ${port}