* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
@ 2009-01-09 9:38 Mike Frysinger
2009-01-16 8:37 ` Wolfgang Denk
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Mike Frysinger @ 2009-01-09 9:38 UTC (permalink / raw)
To: u-boot
The netcat utility likes to exit when it receives an empty packet (as it
thinks this means EOF). This can easily occur when working with command
line editing as this behavior will be triggered when using backspace. Or
with tabs and command line completion. Since the local ncb util does not
have this "feature" and it supports broadcast udp, default to using that
rather than netcat.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
tools/netconsole | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/netconsole b/tools/netconsole
index 09c8981..aa30d9b 100755
--- a/tools/netconsole
+++ b/tools/netconsole
@@ -31,12 +31,24 @@ if [ -z "${ip}" ] || [ -n "$3" ] ; then
fi
for nc in netcat nc ; do
- type ${nc} >/dev/null && break
+ type ${nc} >/dev/null 2>&1 && break
done
trap "stty icanon echo intr ^C" 0 2 3 5 10 13 15
echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
stty -icanon -echo intr ^T
-${nc} -u -l -p ${port} < /dev/null &
-exec ${nc} -u ${ip} ${port}
+(
+if [ -x ./ncb ] ; then
+ exec ./ncb ${port}
+elif [ -x ${0%/*}/ncb ] ; then
+ exec ${0%/*}/ncb ${port}
+else
+ while ${nc} -u -l -p ${port} < /dev/null ; do
+ :
+ done
+fi
+) &
+pid=$!
+${nc} -u ${ip} ${port}
+kill $pid 2>/dev/null
--
1.6.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-09 9:38 [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible Mike Frysinger
@ 2009-01-16 8:37 ` Wolfgang Denk
2009-01-16 19:07 ` Mike Frysinger
2009-09-09 12:46 ` Mike Frysinger
` (2 subsequent siblings)
3 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2009-01-16 8:37 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <1231493902-7043-1-git-send-email-vapier@gentoo.org> you wrote:
> The netcat utility likes to exit when it receives an empty packet (as it
> thinks this means EOF). This can easily occur when working with command
> line editing as this behavior will be triggered when using backspace. Or
> with tabs and command line completion. Since the local ncb util does not
> have this "feature" and it supports broadcast udp, default to using that
> rather than netcat.
When would "ncb" not be available?
What else are the implications when using ncb versus netcat?
Why does your script tools/netconsole so far use netcat only, when we
have the (as I read it) much better ncb anyway?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Is the glass half empty, half full, or twice as large as it needs to
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-16 8:37 ` Wolfgang Denk
@ 2009-01-16 19:07 ` Mike Frysinger
2009-01-21 20:13 ` Wolfgang Denk
0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-01-16 19:07 UTC (permalink / raw)
To: u-boot
On Friday 16 January 2009 03:37:40 Wolfgang Denk wrote:
> In message <1231493902-7043-1-git-send-email-vapier@gentoo.org> you wrote:
> > The netcat utility likes to exit when it receives an empty packet (as it
> > thinks this means EOF). This can easily occur when working with command
> > line editing as this behavior will be triggered when using backspace. Or
> > with tabs and command line completion. Since the local ncb util does not
> > have this "feature" and it supports broadcast udp, default to using that
> > rather than netcat.
>
> When would "ncb" not be available?
>
> What else are the implications when using ncb versus netcat?
>
> Why does your script tools/netconsole so far use netcat only, when we
> have the (as I read it) much better ncb anyway?
people have to manually build ncb, plus ncb is a listen-only daemon. you
still need nc to do the transmission.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090116/31b018ff/attachment.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-16 19:07 ` Mike Frysinger
@ 2009-01-21 20:13 ` Wolfgang Denk
2009-01-21 20:39 ` Mike Frysinger
0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2009-01-21 20:13 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <200901161407.57150.vapier@gentoo.org> you wrote:
>
> > > have this "feature" and it supports broadcast udp, default to using that
> > > rather than netcat.
> >
> > When would "ncb" not be available?
> >
> > What else are the implications when using ncb versus netcat?
> >
> > Why does your script tools/netconsole so far use netcat only, when we
> > have the (as I read it) much better ncb anyway?
>
> people have to manually build ncb, plus ncb is a listen-only daemon. you
> still need nc to do the transmission.
You did not answer my other questions:
- When would "ncb" not be available?
- What else are the implications when using ncb versus netcat?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can observe a lot just by watching. - Yogi Berra
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-21 20:13 ` Wolfgang Denk
@ 2009-01-21 20:39 ` Mike Frysinger
2009-01-21 20:57 ` Wolfgang Denk
0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-01-21 20:39 UTC (permalink / raw)
To: u-boot
On Wednesday 21 January 2009 15:13:51 Wolfgang Denk wrote:
> Dear Mike Frysinger,
>
> In message <200901161407.57150.vapier@gentoo.org> you wrote:
> > > > have this "feature" and it supports broadcast udp, default to using
> > > > that rather than netcat.
> > >
> > > When would "ncb" not be available?
> > >
> > > What else are the implications when using ncb versus netcat?
> > >
> > > Why does your script tools/netconsole so far use netcat only, when we
> > > have the (as I read it) much better ncb anyway?
> >
> > people have to manually build ncb, plus ncb is a listen-only daemon. you
> > still need nc to do the transmission.
>
> You did not answer my other questions:
then i really have no idea what you're asking/talking about
> - When would "ncb" not be available?
ncb is specific to u-boot: tools/ncb.c. most people will not bother to
compile it as they'll just run the netconsole script. it certainly isnt
compiled by default or integrated into the build system.
> - What else are the implications when using ncb versus netcat?
ncb is looser with receiving udp packets so it works with broadcast packets.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090121/cc001705/attachment.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-21 20:39 ` Mike Frysinger
@ 2009-01-21 20:57 ` Wolfgang Denk
2009-01-21 21:06 ` Mike Frysinger
0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2009-01-21 20:57 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <200901211539.26445.vapier@gentoo.org> you wrote:
>
> > - When would "ncb" not be available?
>
> ncb is specific to u-boot: tools/ncb.c. most people will not bother to
> compile it as they'll just run the netconsole script. it certainly isnt
> compiled by default or integrated into the build system.
>
> > - What else are the implications when using ncb versus netcat?
>
> ncb is looser with receiving udp packets so it works with broadcast packets.
This sounds like arguments for NOT applying your patch which depends
on ncb, or am I missing something?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Dear Lord: I just want *one* one-armed manager so I never have to
hear "On the other hand", again.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-21 20:57 ` Wolfgang Denk
@ 2009-01-21 21:06 ` Mike Frysinger
0 siblings, 0 replies; 16+ messages in thread
From: Mike Frysinger @ 2009-01-21 21:06 UTC (permalink / raw)
To: u-boot
On Wednesday 21 January 2009 15:57:56 Wolfgang Denk wrote:
> In message <200901211539.26445.vapier@gentoo.org> you wrote:
> > > - When would "ncb" not be available?
> >
> > ncb is specific to u-boot: tools/ncb.c. most people will not bother to
> > compile it as they'll just run the netconsole script. it certainly isnt
> > compiled by default or integrated into the build system.
> >
> > > - What else are the implications when using ncb versus netcat?
> >
> > ncb is looser with receiving udp packets so it works with broadcast
> > packets.
>
> This sounds like arguments for NOT applying your patch which depends
> on ncb, or am I missing something?
like i said in the original changelog, the script will use ncb only if it
exists (i.e. the user has compiled it and thus wants to use it). some people
want the ncb behavior, some people do not. otherwise i really dont know what
you're looking for here.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090121/f135e607/attachment-0001.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-01-09 9:38 [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible Mike Frysinger
2009-01-16 8:37 ` Wolfgang Denk
@ 2009-09-09 12:46 ` Mike Frysinger
2009-09-09 13:28 ` Wolfgang Denk
2009-09-09 16:20 ` [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust Mike Frysinger
2009-09-09 16:20 ` [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available Mike Frysinger
3 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-09-09 12:46 UTC (permalink / raw)
To: u-boot
On Friday 09 January 2009 04:38:22 Mike Frysinger wrote:
> The netcat utility likes to exit when it receives an empty packet (as it
> thinks this means EOF). This can easily occur when working with command
> line editing as this behavior will be triggered when using backspace. Or
> with tabs and command line completion. Since the local ncb util does not
> have this "feature" and it supports broadcast udp, default to using that
> rather than netcat.
ping ... afaik, it should still apply fine
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090909/c30512f5/attachment.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-09-09 12:46 ` Mike Frysinger
@ 2009-09-09 13:28 ` Wolfgang Denk
2009-09-09 14:15 ` Mike Frysinger
0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2009-09-09 13:28 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <200909090846.33499.vapier@gentoo.org> you wrote:
>
> On Friday 09 January 2009 04:38:22 Mike Frysinger wrote:
> > The netcat utility likes to exit when it receives an empty packet (as it
> > thinks this means EOF). This can easily occur when working with command
> > line editing as this behavior will be triggered when using backspace. Or
> > with tabs and command line completion. Since the local ncb util does not
> > have this "feature" and it supports broadcast udp, default to using that
> > rather than netcat.
>
> ping ... afaik, it should still apply fine
Maybe. But I still don't like the patch. Now, with the distance of a
few months, I think it should be split into two parts:
1) "make a bit more robust"
I agree that this is kind of a bug fix; I think it can go in.
2) "use ncb when possible"
Here I really dislike the implementation of "when possible", which
makes silent and undocumented assumptions about from which directory
the script has to be run. I guess the "when possible" would almost
always turn out to be false, so we might omit the patch alltogether,
especially since it's also documented in "doc/README.NetConsole".
If we add it, we should follow standard UNIX philosophy and assume
that you set your PATH accordingly to reach the tools you want to use.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
While money can't buy happiness, it certainly lets you choose your
own form of misery.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-09-09 13:28 ` Wolfgang Denk
@ 2009-09-09 14:15 ` Mike Frysinger
2009-09-09 14:32 ` Wolfgang Denk
0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-09-09 14:15 UTC (permalink / raw)
To: u-boot
On Wednesday 09 September 2009 09:28:42 Wolfgang Denk wrote:
> Mike Frysinger wrote:
> > On Friday 09 January 2009 04:38:22 Mike Frysinger wrote:
> > > The netcat utility likes to exit when it receives an empty packet (as
> > > it thinks this means EOF). This can easily occur when working with
> > > command line editing as this behavior will be triggered when using
> > > backspace. Or with tabs and command line completion. Since the local
> > > ncb util does not have this "feature" and it supports broadcast udp,
> > > default to using that rather than netcat.
> >
> > ping ... afaik, it should still apply fine
>
> Maybe. But I still don't like the patch. Now, with the distance of a
> few months, I think it should be split into two parts:
>
> 1) "make a bit more robust"
>
> I agree that this is kind of a bug fix; I think it can go in.
np
> 2) "use ncb when possible"
>
> Here I really dislike the implementation of "when possible", which
> makes silent and undocumented assumptions about from which directory
> the script has to be run. I guess the "when possible" would almost
> always turn out to be false, so we might omit the patch alltogether,
> especially since it's also documented in "doc/README.NetConsole".
>
> If we add it, we should follow standard UNIX philosophy and assume
> that you set your PATH accordingly to reach the tools you want to use.
since ncb is compiled whenever netconsole is enabled, and people typically use
this script with netconsole enabled, "when possible" tends to be line up
fairly often. also, the broadcast aspect is pretty useful. i guess i could
make it search PATH, but the idea was to have things "just work" rather than
forcing people to install random utils into their PATH.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090909/90db57e6/attachment.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-09-09 14:15 ` Mike Frysinger
@ 2009-09-09 14:32 ` Wolfgang Denk
2009-09-09 14:54 ` Mike Frysinger
0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Denk @ 2009-09-09 14:32 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <200909091015.05454.vapier@gentoo.org> you wrote:
>
> > 2) "use ncb when possible"
> >
> > Here I really dislike the implementation of "when possible", which
> > makes silent and undocumented assumptions about from which directory
> > the script has to be run. I guess the "when possible" would almost
> > always turn out to be false, so we might omit the patch alltogether,
> > especially since it's also documented in "doc/README.NetConsole".
> >
> > If we add it, we should follow standard UNIX philosophy and assume
> > that you set your PATH accordingly to reach the tools you want to use.
>
> since ncb is compiled whenever netconsole is enabled, and people typically use
> this script with netconsole enabled, "when possible" tends to be line up
> fairly often. also, the broadcast aspect is pretty useful. i guess i could
Agreed. But the code is based on the assumption that your current
directory when attaching to the console of a target is the U-Boot
source directory. For me, this is definitely not always the case. I
might as well have /tftpboot or solilar as cwd.
> make it search PATH, but the idea was to have things "just work" rather than
> forcing people to install random utils into their PATH.
I rather have people intentionally install tools to some directory in
their PATH or set PATH intentionally to some tool directory rather
than have tools suddenly and mysteriously break just because I run
them from a different location.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You are in a maze of UUCP connections, all alike.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible
2009-09-09 14:32 ` Wolfgang Denk
@ 2009-09-09 14:54 ` Mike Frysinger
0 siblings, 0 replies; 16+ messages in thread
From: Mike Frysinger @ 2009-09-09 14:54 UTC (permalink / raw)
To: u-boot
On Wednesday 09 September 2009 10:32:44 Wolfgang Denk wrote:
> Mike Frysinger wrote:
> > > 2) "use ncb when possible"
> > >
> > > Here I really dislike the implementation of "when possible", which
> > > makes silent and undocumented assumptions about from which directory
> > > the script has to be run. I guess the "when possible" would almost
> > > always turn out to be false, so we might omit the patch alltogether,
> > > especially since it's also documented in "doc/README.NetConsole".
> > >
> > > If we add it, we should follow standard UNIX philosophy and assume
> > > that you set your PATH accordingly to reach the tools you want to use.
> >
> > since ncb is compiled whenever netconsole is enabled, and people
> > typically use this script with netconsole enabled, "when possible" tends
> > to be line up fairly often. also, the broadcast aspect is pretty useful.
> > i guess i could
>
> Agreed. But the code is based on the assumption that your current
> directory when attaching to the console of a target is the U-Boot
> source directory. For me, this is definitely not always the case. I
> might as well have /tftpboot or solilar as cwd.
it takes multiple steps. first, the cwd and then based on argv0. so even if
you're in a different place, if the script lives in the source tree when you
execute it, it'll work fine.
> > make it search PATH, but the idea was to have things "just work" rather
> > than forcing people to install random utils into their PATH.
>
> I rather have people intentionally install tools to some directory in
> their PATH or set PATH intentionally to some tool directory rather
> than have tools suddenly and mysteriously break just because I run
> them from a different location.
if they're both installed into the same place, then it'll still work. i can
add a PATH search in place of the cwd one as the argv0+PATH should handle both
cases fine.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090909/e0e07d43/attachment.pgp
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust
2009-01-09 9:38 [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible Mike Frysinger
2009-01-16 8:37 ` Wolfgang Denk
2009-09-09 12:46 ` Mike Frysinger
@ 2009-09-09 16:20 ` Mike Frysinger
2009-09-15 20:54 ` Wolfgang Denk
2009-09-09 16:20 ` [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available Mike Frysinger
3 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-09-09 16:20 UTC (permalink / raw)
To: u-boot
The netcat utility likes to exit when it receives an empty packet (as it
thinks this means EOF). This can easily occur when working with command
line editing as this behavior will be triggered when using backspace. Or
with tabs and command line completion. So create two netcat processes -
one to only listen (and put it into a loop), and one to do the sending.
Once the user quits the transmitting netcat, the listening one will be
killed automatically.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
- split the changes (robust and ncb)
tools/netconsole | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/netconsole b/tools/netconsole
index 09c8981..6ef2723 100755
--- a/tools/netconsole
+++ b/tools/netconsole
@@ -31,12 +31,18 @@ if [ -z "${ip}" ] || [ -n "$3" ] ; then
fi
for nc in netcat nc ; do
- type ${nc} >/dev/null && break
+ type ${nc} >/dev/null 2>&1 && break
done
trap "stty icanon echo intr ^C" 0 2 3 5 10 13 15
echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
stty -icanon -echo intr ^T
-${nc} -u -l -p ${port} < /dev/null &
-exec ${nc} -u ${ip} ${port}
+(
+while ${nc} -u -l -p ${port} < /dev/null ; do
+ :
+done
+) &
+pid=$!
+${nc} -u ${ip} ${port}
+kill ${pid} 2>/dev/null
--
1.6.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available
2009-01-09 9:38 [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible Mike Frysinger
` (2 preceding siblings ...)
2009-09-09 16:20 ` [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust Mike Frysinger
@ 2009-09-09 16:20 ` Mike Frysinger
2009-09-15 20:55 ` Wolfgang Denk
3 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2009-09-09 16:20 UTC (permalink / raw)
To: u-boot
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>
---
v2
- split the changes
- search PATH rather than CWD
- update docs
doc/README.NetConsole | 24 +++---------------------
tools/netconsole | 17 ++++++++++++++---
2 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/doc/README.NetConsole b/doc/README.NetConsole
index 639cc12..c8bcb90 100644
--- a/doc/README.NetConsole
+++ b/doc/README.NetConsole
@@ -36,27 +36,9 @@ you can just remove the -p option from the script.
It turns out that 'netcat' cannot be used to listen to broadcast
packets. We developed our own tool 'ncb' (see tools directory) that
listens to broadcast packets on a given port and dumps them to the
-standard output. use it as follows:
-
-+++++++++++++++++++++++++++++++++++++++++++
-#! /bin/bash
-
-[ $# = 1 ] || { echo "Usage: $0 target_ip" >&2 ; exit 1 ; }
-TARGET_IP=$1
-
-stty icanon echo intr ^T
-./ncb &
-nc -u ${TARGET_IP} 6666
-stty icanon echo intr ^C
-kill 0
-+++++++++++++++++++++++++++++++++++++++++++
-
-Again, this script takes exactly one argument, which is interpreted
-as the target IP address (or host name, assuming DNS is working). The
-script can be interrupted by pressing ^T (CTRL-T).
-
-The 'ncb' tool can be found in the tools directory; it will be built
-when compiling for a board which has CONFIG_NETCONSOLE defined.
+standard output. It will be built when compiling for a board which
+has CONFIG_NETCONSOLE defined. If the netconsole script can find it
+in PATH or in the same directory, it will be used instead.
For Linux, the network-based console needs special configuration.
Minimally, the host IP address needs to be specified. This can be
diff --git a/tools/netconsole b/tools/netconsole
index 6ef2723..c8109bb 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}
--
1.6.4.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust
2009-09-09 16:20 ` [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust Mike Frysinger
@ 2009-09-15 20:54 ` Wolfgang Denk
0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2009-09-15 20:54 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <1252513221-2524-1-git-send-email-vapier@gentoo.org> you wrote:
> The netcat utility likes to exit when it receives an empty packet (as it
> thinks this means EOF). This can easily occur when working with command
> line editing as this behavior will be triggered when using backspace. Or
> with tabs and command line completion. So create two netcat processes -
> one to only listen (and put it into a loop), and one to do the sending.
> Once the user quits the transmitting netcat, the listening one will be
> killed automatically.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> - split the changes (robust and ncb)
>
> tools/netconsole | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Presidency: The greased pig in the field game of American politics.
- Ambrose Bierce
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available
2009-09-09 16:20 ` [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available Mike Frysinger
@ 2009-09-15 20:55 ` Wolfgang Denk
0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2009-09-15 20:55 UTC (permalink / raw)
To: u-boot
Dear Mike Frysinger,
In message <1252513221-2524-2-git-send-email-vapier@gentoo.org> you wrote:
> 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>
> ---
> v2
> - split the changes
> - search PATH rather than CWD
> - update docs
>
> doc/README.NetConsole | 24 +++---------------------
> tools/netconsole | 17 ++++++++++++++---
> 2 files changed, 17 insertions(+), 24 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our way is peace.
-- Septimus, the Son Worshiper, "Bread and Circuses",
stardate 4040.7.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2009-09-15 20:55 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 9:38 [U-Boot] [PATCH] tools/netconsole: make a bit more robust and use ncb when possible Mike Frysinger
2009-01-16 8:37 ` Wolfgang Denk
2009-01-16 19:07 ` Mike Frysinger
2009-01-21 20:13 ` Wolfgang Denk
2009-01-21 20:39 ` Mike Frysinger
2009-01-21 20:57 ` Wolfgang Denk
2009-01-21 21:06 ` Mike Frysinger
2009-09-09 12:46 ` Mike Frysinger
2009-09-09 13:28 ` Wolfgang Denk
2009-09-09 14:15 ` Mike Frysinger
2009-09-09 14:32 ` Wolfgang Denk
2009-09-09 14:54 ` Mike Frysinger
2009-09-09 16:20 ` [U-Boot] [PATCH 1/2 v2] tools/netconsole: make a bit more robust Mike Frysinger
2009-09-15 20:54 ` Wolfgang Denk
2009-09-09 16:20 ` [U-Boot] [PATCH 2/2 v2] tools/netconsole: use ncb automatically if available Mike Frysinger
2009-09-15 20:55 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox