Re: [Toybox] Notes about netcat toy

2012-06-20 Thread orc
On Wed, 20 Jun 2012 19:21:31 -0500
Rob Landley  wrote:

> On 06/19/2012 06:18 AM, orc wrote:
> > Hm, seems to be that toybox netcat does not support udp mode and
> > ipv6.
> 
> Yup.  Those are todo items.
> 
> Genericizing the code so I can use the same engine for telnet would be
> nice too.
> 
> > I'm using ipv6 for internal purposes so I see that if I want
> > ipv6-aware netcat in toybox I need to follow one of two ways here:
> 
> I want udp support so I can do:
> 
> http://sarah.thesharps.us/2009-02-22-09-00

Yes, for this too.

> 
> I'd also like to resolve this command line argument incompatability:
> 
> http://lists.busybox.net/pipermail/busybox/2009-July/069920.html
> 
> http://landley.net/hg/aboriginal/rev/1218
> 
> > - Rewrite current netcat.c logic that it will support ipv6
> 
> It's on my todo list, and not actually that big a code change.

Yes. But changes seems to be incompatible a bit with current code. Or I
did not get how to work properly when implementing a
protocol-independent program.

> 
> > - Port openbsd's netcat.c into toybox (much work needed plus
> > stripping unneeded code, 3-clause BSD)
> >
> > (Another way is to use openbsd netcat.c directly)
> 
> In which case how is toybox involved?

Uh, nevermind :-)
Just for many years I stuck with openbsd netcat.

> 
> > I have dirty (with #if 0 parts) code that supports ipv6 in current
> > toybox netcat via getaddrinfo, but with udp mode I'm stuck.
> 
> If you send me the patch and I can probably clean it up.

Of course. See attached diff.
Unfortunately I don't know how to deal with poll and other things like
that, so with udp I'm stuck here. (udp mode here was just a new command
line option plus if() switch that set ai_socktype to SOCK_DGRAM and
ai_protocol to IPPROTO_UDP)
Review it, give some suggestions. Maybe it will help.

> 
> > Implementing udp option will be useful too.
> > Rob, do you have some plans about this toy?
> 
> I have many, many plans.  My todo list runneth over.
> 
> Finishing netcat is left over from my 2009 todo list:
> 
> http://landley.net/toybox/todos/notes.txt
> 
>  netcat/nc: Implement remaining command line options.

Just noticed that in this http://landley.net/toybox/todo.txt:

> The following commands are done:
> ... nc, netcat ...

and worried about it's completeness with missing things like v4/v6
protocol support.

> 
> > Then, some other notes:
> > 
> > - busybox and openbsd netcats doesn't require to specify source
> > address and port for listen mode. Maybe rewrite netcat that it will
> > accept something like 'netcat -L 127.0.0.1 8033'?
> 
> See above.
> 
> > - Toybox netcat says that it executes program from -e option, but
> >   actually executes it via toys.optargs.
> 
> It executes the rest of the command line after -e.  If you give it -e
> "one two three" it's just like typing "one two three" on the command
> line and you'd better have a command with spaces in its name in your
> $PATH.

Okay. When you see the diff, you may notice that I had to fight with
this when trying to implement 'nc -L 127.0.0.1 8033'. Just don't know
how better to apply this here. Then I dropped that, remaining task was
to implement at least v6 support.

> 
> > - New network toys should be ready for ipv6 by default.
> 
> Note the date:
> 
> changeset:   189:22d22427dec6
> user:Rob Landley 
> date:Mon Dec 03 18:53:00 2007 -0600
> files:   toys/Config.in toys/netcat.c toys/toylist.h
> description:
> Add first pass at netcat.  Base applet, -f, and -w implemented.
> 
> "world ipv6 launch day" was earlier this month, and was once again
> resoundingly ignored:
> 
> http://www.fiercetelecom.com/story/world-ipv6-launch-results-what-effect-did-event-have-internet/2012-06-18
> 
> Global ipv4 traffic, 189.81 Tbps (terabits? terabytes?
> Terasomething.) ipv6 traffic: 24.07 giga-whatevers. So ipv4 is still
> about 10,000 times as much traffic as ipv6.
> 
> Yay the future and all that.  I'd like to support ipv6 on general
> principles. But unless you're in korea (the whole country sharing an
> old "class B" 16 bit IP address block last I checked), it's still
> "coming soon now" 15 years after I first heard about it when somebody
> did a presentation at a LUG meeting back in the 90's.

Yes, but ipv6 can be used not only with Internet. I use it, for
example, in some VPNs and play with it in QEMU-KVM.

> 
> Rob

(P.S. Diff can scary you, don't get it as a final implementation!)

toybox-0.3.0-netcat-ipv6.diff
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] Notes about netcat toy

2012-06-20 Thread Rob Landley
On 06/19/2012 06:18 AM, orc wrote:
> Hm, seems to be that toybox netcat does not support udp mode and
> ipv6.

Yup.  Those are todo items.

Genericizing the code so I can use the same engine for telnet would be
nice too.

> I'm using ipv6 for internal purposes so I see that if I want
> ipv6-aware netcat in toybox I need to follow one of two ways here:

I want udp support so I can do:

http://sarah.thesharps.us/2009-02-22-09-00

I'd also like to resolve this command line argument incompatability:

http://lists.busybox.net/pipermail/busybox/2009-July/069920.html

http://landley.net/hg/aboriginal/rev/1218

> - Rewrite current netcat.c logic that it will support ipv6

It's on my todo list, and not actually that big a code change.

> - Port openbsd's netcat.c into toybox (much work needed plus stripping
>   unneeded code, 3-clause BSD)
>
> (Another way is to use openbsd netcat.c directly)

In which case how is toybox involved?

> I have dirty (with #if 0 parts) code that supports ipv6 in current
> toybox netcat via getaddrinfo, but with udp mode I'm stuck.

If you send me the patch and I can probably clean it up.

> Implementing udp option will be useful too.
> Rob, do you have some plans about this toy?

I have many, many plans.  My todo list runneth over.

Finishing netcat is left over from my 2009 todo list:

http://landley.net/toybox/todos/notes.txt

 netcat/nc: Implement remaining command line options.

I got buried in new command submissions for a bit (until I lost track of
what already merged code needed what cleanups), and then buried in
non-toybox stuff, and am now slowly trying to catch back up.

I'm prioritizing having the code that's implemented be _good_ over
having buckets of features quickly, because otherwise what's the point
of doing yet another implementation of all this stuff that's already out
there?

> Then, some other notes:
> 
> - busybox and openbsd netcats doesn't require to specify source
> address and port for listen mode. Maybe rewrite netcat that it will
> accept something like 'netcat -L 127.0.0.1 8033'?

See above.

> - Toybox netcat says that it executes program from -e option, but
>   actually executes it via toys.optargs.

It executes the rest of the command line after -e.  If you give it -e
"one two three" it's just like typing "one two three" on the command
line and you'd better have a command with spaces in its name in your $PATH.

> - New network toys should be ready for ipv6 by default.

Note the date:

changeset:   189:22d22427dec6
user:Rob Landley 
date:Mon Dec 03 18:53:00 2007 -0600
files:   toys/Config.in toys/netcat.c toys/toylist.h
description:
Add first pass at netcat.  Base applet, -f, and -w implemented.

"world ipv6 launch day" was earlier this month, and was once again
resoundingly ignored:

http://www.fiercetelecom.com/story/world-ipv6-launch-results-what-effect-did-event-have-internet/2012-06-18

Global ipv4 traffic, 189.81 Tbps (terabits? terabytes?  Terasomething.)
 ipv6 traffic: 24.07 giga-whatevers. So ipv4 is still about 10,000 times
as much traffic as ipv6.

Yay the future and all that.  I'd like to support ipv6 on general
principles. But unless you're in korea (the whole country sharing an old
"class B" 16 bit IP address block last I checked), it's still "coming
soon now" 15 years after I first heard about it when somebody did a
presentation at a LUG meeting back in the 90's.

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


[Toybox] Notes about netcat toy

2012-06-19 Thread orc
Hm, seems to be that toybox netcat does not support udp mode and
ipv6. I'm using ipv6 for internal purposes so I see that if I want
ipv6-aware netcat in toybox I need to follow one of two ways here:

- Rewrite current netcat.c logic that it will support ipv6
- Port openbsd's netcat.c into toybox (much work needed plus stripping
  unneeded code, 3-clause BSD)

(Another way is to use openbsd netcat.c directly)

I have dirty (with #if 0 parts) code that supports ipv6 in current
toybox netcat via getaddrinfo, but with udp mode I'm stuck.
Implementing udp option will be useful too.
Rob, do you have some plans about this toy?

Then, some other notes:

- busybox and openbsd netcats doesn't require to specify source
address and port for listen mode. Maybe rewrite netcat that it will
accept something like 'netcat -L 127.0.0.1 8033'?
- Toybox netcat says that it executes program from -e option, but
  actually executes it via toys.optargs.
- New network toys should be ready for ipv6 by default.
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net