[PATCH] IPv6 bracket notation for listen addresses in -p
Vladislav Grishenko
themiron at mail.ru
Fri Dec 14 23:57:37 WST 2012
Hi,
Actually that can be done just with strrchr() instead of strchr
Refer
http://wl500g.googlecode.com/svn/trunk/dropbear/300-ipv6_addr_port_split.pat
ch
In addition, here's simple patch that adds IP family support via additional
cmd args
For example, you can now listen on IPv6 only with "dropbear -6", on IPv4
only "dropbear -4"
http://wl500g.googlecode.com/svn/trunk/dropbear/004-ip-family.patch
Best Regards, Vladislav Grishenko
wl500g.googlecode.com
> -----Original Message-----
> From: dropbear-bounces+themiron=mail.ru at ucc.asn.au [mailto:dropbear-
> bounces+themiron=mail.ru at ucc.asn.au] On Behalf Of Matt Johnston
> Sent: Friday, December 14, 2012 8:30 PM
> To: Ben Jencks
> Cc: dropbear at ucc.asn.au
> Subject: Re: [PATCH] IPv6 bracket notation for listen addresses in -p
>
> Hi,
>
> Thanks for that, I'll make sure it makes the next release.
>
> Cheers,
> Matt
>
> On Tue, Dec 11, 2012 at 12:11:45AM -0500, Ben Jencks wrote:
> > Updates parsing of the -p option to handle [2001:dba::]:22 style IPv6
> > addresses. This allows binding to specific IPv6 addresses, rather than
> > having to bind to all addresses in order to get any IPv6 support. For
> > example, you can now listen on IPv6 only with -p [::]:22.
> >
> > This has been done before at [1], but I thought that patch was kind of
> > ugly so I wrote my own.
> >
> > Please CC me on responses as I'm not subscribed to the list.
> >
> > [1]
> > https://lists.openwrt.org/pipermail/openwrt-devel/2009-May/004299.html
> >
> > diff -ur dropbear-2012.55.orig/svr-runopts.c dropbear-2012.55/svr-
> runopts.c
> > --- dropbear-2012.55.orig/svr-runopts.c 2012-02-23
08:47:06.000000000
> -0500
> > +++ dropbear-2012.55/svr-runopts.c 2012-12-10 23:17:28.496729985 -0500
> > @@ -324,8 +324,23 @@
> > /* We don't free it, it becomes part of the runopt state */
> > myspec = m_strdup(spec);
> >
> > - /* search for ':', that separates address and port */
> > - svr_opts.ports[svr_opts.portcount] = strchr(myspec, ':');
> > + if (myspec[0] == '[') {
> > + myspec++;
> > + svr_opts.ports[svr_opts.portcount] = strchr(myspec,
> ']');
> > + if (svr_opts.ports[svr_opts.portcount] == NULL) {
> > + /* Unmatched [ -> exit */
> > + dropbear_exit("Bad listen address");
> > + }
> > + svr_opts.ports[svr_opts.portcount][0] = '\0';
> > + svr_opts.ports[svr_opts.portcount]++;
> > + if (svr_opts.ports[svr_opts.portcount][0] != ':') {
> > + /* Missing port -> exit */
> > + dropbear_exit("Missing port");
> > + }
> > + } else {
> > + /* search for ':', that separates address and port
*/
> > + svr_opts.ports[svr_opts.portcount] = strchr(myspec,
> ':');
> > + }
> >
> > if (svr_opts.ports[svr_opts.portcount] == NULL) {
> > /* no ':' -> the whole string specifies just a port
*/
More information about the Dropbear
mailing list