Wouter Verhelst [Mon, 16 May 2011 19:06:46 +0000 (21:06 +0200)]
Fix lp[] initialization
Originally, the s variable was a pointer which was allocated with
calloc() every time we went through the loop. Now, it's a stack variable
which gets memset() back to zero instead, and is copied to the array.
This change was done for an unrelated reason (which is why we didn't
change this assignment back then), but with the current code it's more
efficient and less error-prone if we assign values to the pointers when
we declare the lp[] array, rather than when we go through the loop. So
do that, then.
Alex Bligh [Mon, 16 May 2011 11:01:12 +0000 (12:01 +0100)]
fix autogen.sh
Building from source fails on a clean git pull, due to autogen.sh failing.
$ ./autogen.sh
+ make -C man -f Makefile.am infiles
make: Entering directory `/home/amb/nbd/nbd/man'
make: *** No rule to make target `infiles'. Stop.
make: Leaving directory `/home/amb/nbd/nbd/man'
A manual autoreconf does this.
$ autoreconf -f -i -s
configure.ac:123: required file `man/nbd-client.8.sh.in' not found
configure.ac:123: required file `man/nbd-server.5.sh.in' not found
configure.ac:123: required file `man/nbd-server.1.sh.in' not found
autoreconf: automake failed with exit status: 1
I think the attached is the right patch (well, I have ./configure
now). There may be a prettier way of doing it (e.g. putting an
"infiles" target into man/Makefile.am) but this is least intrusive.
--
Alex Bligh
Signed-off-by: Alex Bligh <alex@alex.org.uk>
Alex Bligh [Mon, 16 May 2011 09:35:07 +0000 (10:35 +0100)]
Ensure all options have option length
This is a documentation only patch to the new handshake protocol, but
changes the protocol in completely back compatible manner.
Under the current handshake protocol, it is impliedly necessary for the
server to understand every option presented by the client, as there is
no way for the server to skip options it does not understand (as the
length field is not always part of the option).
My proposal is to include the length field as a 32 bit unsigned length
in the same way that it currently forms the first 4 octets of the
NBD_OPT_EXPORT_NAME. So the length field has technically moved out
of the option data and into the option header (obviously there is
no code change required). This will allow servers to skip options
presented by clients that the server does not understand.
--
Alex Bligh
Signed-off-by: Alex Bligh <alex@alex.org.uk>
Wouter Verhelst [Wed, 11 May 2011 13:43:14 +0000 (15:43 +0200)]
Release 2.9.21a
Wouter Verhelst [Wed, 11 May 2011 09:51:10 +0000 (11:51 +0200)]
Add sh.tmpl to EXTRA_DIST so it won't break
Wouter Verhelst [Mon, 9 May 2011 18:11:30 +0000 (20:11 +0200)]
Release 2.9.21
Wouter Verhelst [Mon, 9 May 2011 18:01:31 +0000 (20:01 +0200)]
Fix 'make distcheck'
Wouter Verhelst [Mon, 9 May 2011 17:51:20 +0000 (19:51 +0200)]
Fix thinko
It's nbd-client.8, not nbd-server.8
Wouter Verhelst [Wed, 4 May 2011 12:04:03 +0000 (14:04 +0200)]
Don't forget the template, and ignore generated files
Wouter Verhelst [Wed, 13 Apr 2011 11:03:23 +0000 (13:03 +0200)]
Manpage generation revisited
Previously, we would generate manpages using direct automake-style @foo@
substitution. These, however, contain data in shell syntaxis, which
results in a manpage in the style of '${prefix}/etc/nbd-server/config
allows to configure the nbd-server', which is confusing.
Instead, generate a shell script that outputs the manpage using shell
interpolation, which supposedly works correctly. It's a bit yuck, but
it's the way automake wants us to do these things.
Wouter Verhelst [Fri, 8 Apr 2011 12:01:39 +0000 (14:01 +0200)]
Documentation updates
- Document the protocol
- Move developer documentation into a separate directory. This includes
the Doxyfile. Update some other files so that doc/ isn't git ignore'd,
and so that the Doxyfile is generated at the right location.
- Add a README which explains the purpose of that directory.
Wouter Verhelst [Mon, 21 Mar 2011 08:46:46 +0000 (09:46 +0100)]
Fix dup_serve
Copy the virtstyle field too, and make sure that we copy everything from
's' (the source) rather than from 'serve' (the destination)
Wouter Verhelst [Thu, 3 Mar 2011 14:21:00 +0000 (15:21 +0100)]
Fix memleak
Wouter Verhelst [Thu, 3 Mar 2011 14:07:26 +0000 (15:07 +0100)]
Fix inline usage
inlines must be static, or gcc with some particular set of options (C99?
-Wall -Werror? dunno, don't care) won't compile it.
Wouter Verhelst [Sun, 27 Feb 2011 23:30:47 +0000 (00:30 +0100)]
Require C99
We'll want to use a few C99-specific features, and C99 is getting older
than whisky now anyway.
Wouter Verhelst [Sun, 13 Feb 2011 10:17:47 +0000 (11:17 +0100)]
Fix getopt usage
getopt returns an int, not a char. Since char is unsigned by default on
some architectures, this caused an infinite loop in option parsing
there.
Wouter Verhelst [Sat, 12 Feb 2011 19:18:45 +0000 (20:18 +0100)]
Check return value of read_all in all cases
... to avoid nbd-tester-client going berzerk if the server dies (this is a test
suite! It should deal with servers dying!)
Wouter Verhelst [Sat, 12 Feb 2011 18:50:29 +0000 (19:50 +0100)]
Assign a value to serve when using modern protocol
We dereference this pointer later on, so need to make sure it's
actually valid.
As an added precaution, initialize it to NULL, so that we catch any
further incorrect dereferences, too.
Wouter Verhelst [Fri, 28 Jan 2011 12:47:13 +0000 (13:47 +0100)]
Release 2.9.20
Wouter Verhelst [Fri, 28 Jan 2011 12:45:48 +0000 (13:45 +0100)]
Test request blocks that are larger than 1MB, too.
Wouter Verhelst [Fri, 28 Jan 2011 12:19:30 +0000 (13:19 +0100)]
Fix handling of oversized requests
Previously, nbd-server would not serve requests that were over 1MB in
size. This was a problem, and even a bug since the kernel does send such
requests.
Modify the server so that it loops if the request is larger than 1MB.
Wouter Verhelst [Thu, 27 Jan 2011 21:30:09 +0000 (22:30 +0100)]
Fix buffer size checking
Yes, this means we've re-introduced CVE-2005-3534. Sigh.
Wouter Verhelst [Wed, 26 Jan 2011 00:46:21 +0000 (01:46 +0100)]
Remove outdated roadmap
Wouter Verhelst [Sun, 16 Jan 2011 00:41:16 +0000 (01:41 +0100)]
Release 2.9.19
sf@psjt.org [Sat, 11 Dec 2010 00:27:45 +0000 (01:27 +0100)]
10 TByte partition
Moin!
The attached patch allows to run a 16TB nbd partition on a 32-bit
system.
Gruß, Stephan
Gregory Thiemonge [Mon, 27 Sep 2010 14:04:36 +0000 (16:04 +0200)]
nbd-server: Limit the number of connections
Hi there,
This is a patch that allows to limit the number of opened connections in
nbd-server.
This limitation can be specified from both command line and config
files:
- -M <n> or --max-connections <n> from command line
- or maxconnections = <n> in config files (export sections)
Regards,
Greg
Wouter Verhelst [Wed, 8 Sep 2010 08:31:24 +0000 (10:31 +0200)]
Put nbd-client back in sbin
Laurent Vivier [Fri, 27 Aug 2010 18:48:17 +0000 (20:48 +0200)]
Move man files to man/
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Wouter Verhelst [Thu, 2 Sep 2010 10:55:11 +0000 (12:55 +0200)]
Revisit documentation
There were a few issues with the documentation, where it grew some hairy
and weird phrasing. Fix those.
Laurent Vivier [Mon, 23 Aug 2010 20:51:50 +0000 (22:51 +0200)]
Remove GCC warnings:
warning: ignoring return value of ‘write’
warning: ignoring return value of ‘read’
warning: format not a string literal and no format arguments
warning: ignoring return value of ‘daemon’
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Wouter Verhelst [Tue, 24 Aug 2010 01:11:22 +0000 (03:11 +0200)]
Be less scary
When nothing is configured, a rather scary warning is displayed. Change
it so that it isn't quite as scary, since that produces a number of
questions from users who don't know nbd-server.
Wouter Verhelst [Thu, 19 Aug 2010 18:04:28 +0000 (20:04 +0200)]
Oops
Led [Fri, 11 Dec 2009 14:14:33 +0000 (16:14 +0200)]
README: nbX -> nbdX
Led [Fri, 11 Dec 2009 15:30:04 +0000 (17:30 +0200)]
include sdp_inet.h for build with SDP
Wouter Verhelst [Thu, 19 Aug 2010 17:57:07 +0000 (19:57 +0200)]
fix build with non-gcc compiler
Pulled from Alt Linu
Conflicts:
cliserv.h
Wouter Verhelst [Mon, 9 Aug 2010 18:02:09 +0000 (14:02 -0400)]
Release 2.9.18
Wouter Verhelst [Mon, 9 Aug 2010 17:52:00 +0000 (13:52 -0400)]
Extend test suite and fix named exports
Wouter Verhelst [Fri, 6 Aug 2010 21:14:31 +0000 (17:14 -0400)]
Comment out <linux/types.h> include
We provide the necessary bits ourselves anyway, and it doesn't exist on
non-Linux systems.
Wouter Verhelst [Fri, 6 Aug 2010 16:35:06 +0000 (12:35 -0400)]
Use a recent enough version of nbd.h (oops)
Wouter Verhelst [Fri, 6 Aug 2010 00:51:28 +0000 (20:51 -0400)]
Release 2.9.17
Wouter Verhelst [Fri, 6 Aug 2010 00:51:06 +0000 (20:51 -0400)]
Document differences with old style exports
Wouter Verhelst [Fri, 6 Aug 2010 00:37:45 +0000 (20:37 -0400)]
Fix simple_test for named exports
Old-style exports require the oldstyle=true option in the 'generic'
section; so add that.
Prepare simple_test for support for named exports in nbd-tester-client,
too, but that still needs to be implemented.
Wouter Verhelst [Thu, 5 Aug 2010 23:47:19 +0000 (19:47 -0400)]
Fix command-line oldstyle export
Wouter Verhelst [Wed, 4 Aug 2010 03:26:07 +0000 (23:26 -0400)]
Use IANA-assigned port number: 10809
Wouter Verhelst [Wed, 28 Jul 2010 22:10:50 +0000 (18:10 -0400)]
Sanitize negotiation a bit
- We don't need 64 bit size_t for a name
- We don't need 64 reserved bits client to server; if we ever need more
than 31, we'll just add another field and use the last bit as a marker
to say that the other field is available.
Wouter Verhelst [Wed, 28 Jul 2010 02:56:30 +0000 (22:56 -0400)]
Documentation updates
- Document -N / -name option
- Some generic docbook fixes
Wouter Verhelst [Tue, 27 Jul 2010 22:54:37 +0000 (18:54 -0400)]
Merge branch 'master' into names
Wouter Verhelst [Tue, 27 Jul 2010 22:48:09 +0000 (18:48 -0400)]
Mention two-dash form of long options
Wouter Verhelst [Tue, 27 Jul 2010 22:41:06 +0000 (18:41 -0400)]
Return the right value on nbd-client -c
command line parsing rewrite accidentally removed this.
Wouter Verhelst [Tue, 27 Jul 2010 18:52:15 +0000 (14:52 -0400)]
Fix a host/network order bug
Wouter Verhelst [Tue, 27 Jul 2010 18:35:12 +0000 (14:35 -0400)]
Functional fixes
Result of tests. It works! Whee!
Wouter Verhelst [Tue, 27 Jul 2010 17:40:31 +0000 (13:40 -0400)]
Documentation update
Wouter Verhelst [Tue, 27 Jul 2010 12:25:10 +0000 (08:25 -0400)]
Actually disable oldstyle export when requested
Wouter Verhelst [Tue, 27 Jul 2010 11:34:04 +0000 (07:34 -0400)]
Use a different magic
Use a different magic, to avoid old clients accidentally using the
well-known port and hanging.
Wouter Verhelst [Mon, 26 Jul 2010 23:44:17 +0000 (19:44 -0400)]
Initial implementation of named exports
Wouter Verhelst [Mon, 26 Jul 2010 20:37:29 +0000 (16:37 -0400)]
Fix segfault
Wouter Verhelst [Sun, 25 Jul 2010 13:19:20 +0000 (15:19 +0200)]
Documentation update
Wouter Verhelst [Sun, 25 Jul 2010 00:04:09 +0000 (02:04 +0200)]
Prepare for 2.9.16
Wouter Verhelst [Sun, 25 Jul 2010 00:00:23 +0000 (02:00 +0200)]
Make -Wall clean
Wouter Verhelst [Sat, 24 Jul 2010 19:48:24 +0000 (21:48 +0200)]
Add nbd.h to source
Previously, we would depend on an out-of-tree nbd.h. This is error-prone
on Linux (if the kernel nbd.h changes incompatibly, the userspace tools
won't compile anymore) and problematic on non-Linux (where you'd have to
manage somehow to fetch a working nbd.h)
So, stop being silly.
Wouter Verhelst [Sat, 24 Jul 2010 19:47:50 +0000 (21:47 +0200)]
Generate nbd-client.8.in, too
Wouter Verhelst [Sat, 24 Jul 2010 19:47:33 +0000 (21:47 +0200)]
Whitespace fixes
Wouter Verhelst [Sat, 24 Jul 2010 19:18:34 +0000 (21:18 +0200)]
Remove cruft
This was useful when we tried making github our official distribution
point; but we're not doing that anymore, so drop it.
Wouter Verhelst [Sat, 24 Jul 2010 19:07:00 +0000 (21:07 +0200)]
Improve structure
- Use getopt_long_only() to implement option parsing. This probably
makes use of small C libraries harder, but that wasn't very much
possible to begin with, anyway.
- Deprecate bs= and timeout= options in favour of new --block-size and
--timeout options.
- Compartmentalize a bit more. Yes, the compiler will optimize that away
in some cases, but what do I care, I don't need to write assembler
code.
Documentation update to follow.
Wouter Verhelst [Thu, 22 Jul 2010 13:22:47 +0000 (15:22 +0200)]
Fix compile with -DNOFORK
Wouter Verhelst [Wed, 21 Jul 2010 21:18:34 +0000 (23:18 +0200)]
Fix logic reversal in authorization file
Wouter Verhelst [Fri, 18 Jun 2010 06:35:36 +0000 (08:35 +0200)]
Deprecate command line export options.
Wouter Verhelst [Fri, 18 Jun 2010 06:32:33 +0000 (08:32 +0200)]
Whitespace fix
Wouter Verhelst [Mon, 14 Jun 2010 20:48:13 +0000 (22:48 +0200)]
Use correct names
The kernel uses /dev/nbdX rather than /dev/nbX. MAKEDEV used to be
different at some point, but no more.
Wouter Verhelst [Thu, 20 May 2010 13:35:57 +0000 (15:35 +0200)]
Fix bugs in command-line argument handling
We produced an error message when all four flags were used; and we would
only catch such flags if they were produced in the right order (which
was different from the order in the manpage).
Thanks to Fan Zhang for catching these.
Wouter Verhelst [Mon, 3 May 2010 13:57:28 +0000 (15:57 +0200)]
Fix leaks
There were a few strings that weren't being removed. This is
cleanup-code that's not called all that often, but We Shouldn't
Leak(TM).
Wouter Verhelst [Wed, 14 Apr 2010 15:30:52 +0000 (17:30 +0200)]
Improve output
- When using a float to store a result, make sure we don't do integer
calculation.
- Add our PID to the output, so that we can understand which line of
output is part of which nbd-tester-client run.
Wouter Verhelst [Thu, 1 Apr 2010 11:23:30 +0000 (13:23 +0200)]
Missed a bit
Wouter Verhelst [Thu, 1 Apr 2010 11:07:26 +0000 (13:07 +0200)]
Documentation update
Since we now support IPv6, upodate those bits of the documentation that
assume v4 only.
Wouter Verhelst [Wed, 24 Mar 2010 21:01:36 +0000 (22:01 +0100)]
Release 2.9.15
Neutron Soutmun [Wed, 24 Mar 2010 05:25:59 +0000 (12:25 +0700)]
Bug#382189: IPv6 support
Package: nbd
Version: 2.9.14-3
Severity: normal
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The latest patch to master branch of git repository is attached.
Please review the patch again.
It's also solved the #557810.
Add append_serve() more over the last patch to verify the parsing
listening address which now the parsing listening address could
be IPv4/IPv6 and also hostname. The service will resolve the hostname
and try to listening on all of them.
If the hostname/address could not solve, must show the error
getaddrinfo failed on listen host/address: testing (Name or service not known)
If parsing hostname,
It will listen on 127.0.0.1:12345
It will listen on ::1@12345
Regards,
Neutron Soutmun
- -- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=th_TH.UTF-8, LC_CTYPE=th_TH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkupomIACgkQ1k7Ar9TO/TdLngCgvGp2oGKR0PLGmMFVTUkxh9yO
NrQAnR4FqtwoEuo/aZoEFhdhFI3mOVbU
=1UBe
-----END PGP SIGNATURE-----
Wouter Verhelst [Sat, 27 Feb 2010 21:39:35 +0000 (22:39 +0100)]
Be explicit when we exit
Currently, when a fatal error occurs, nbd-server logs that error, but
then silently exits -- i.e., it is left to the user to guess that it has
exited. We should be more explicit about that fact.
Wouter Verhelst [Sat, 27 Feb 2010 21:29:50 +0000 (22:29 +0100)]
Parse listenaddr for hostnames
Previously, a listen address had to be specified by IP address;
hostnames where not supported. This patch should fix that. It is useful
for those who wish to use something like 'listenaddr = localhost',
though using the IP address is really recommended for most other
situations.
Wouter Verhelst [Tue, 15 Dec 2009 09:37:57 +0000 (10:37 +0100)]
Fix 'make -j check'
Port numbers were the same across all three tests, so that made the
check fail if they were ran at the same time...
Peter Korsgaard [Sun, 22 Nov 2009 22:11:42 +0000 (23:11 +0100)]
lfs.h: fix build with --disable-lfs
Running ./configure with --disable-lfs #define's NBD_LFS to 0 and
doesn't #undef it, so the LFS check should use #if rather than #ifdef
similar to how it is done in cliserv.h
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Wouter Verhelst [Sat, 17 Oct 2009 18:16:13 +0000 (20:16 +0200)]
Prepare for 2.9.14
Wouter Verhelst [Sat, 17 Oct 2009 18:15:40 +0000 (20:15 +0200)]
Make -Wall -Werror compile again
Wouter Verhelst [Fri, 16 Oct 2009 08:52:18 +0000 (10:52 +0200)]
Document why this is necessary.
Wouter Verhelst [Thu, 15 Oct 2009 17:22:19 +0000 (19:22 +0200)]
Put the -nofork check on the right spot
nbd-client will fork in two occasions: once when going daemon, once when
forking itself off to be able to open the device so we can trigger the
kernel to reread its partition table (if any), which in turn will cause
udev to DTRT.
The NOFORK macros were written in to make debugging simpeler, and
predate the daemon() thing. I think. Anyhow, what's useful for code
debugging is not necessarily useful for runtime debugging; so this moves
the daemon() call inside the macros, makes it not be called if -nofork
has been specified, and changes the code so that the partition table
reread is still triggered even if -nofork has been specified.
Wouter Verhelst [Sun, 27 Sep 2009 11:31:02 +0000 (13:31 +0200)]
Missed one
This one, too, needed to be thrown out. Oops.
Wouter Verhelst [Sat, 26 Sep 2009 17:11:07 +0000 (19:11 +0200)]
Remove unsupported options
The no longer supported -a option was still part of the 'getopt' call,
and was still shown in the error output. This patch removes that code.
Wouter Verhelst [Mon, 24 Aug 2009 19:12:21 +0000 (21:12 +0200)]
Make autogen.sh work
Makefile.am expects $(srcdir) to be set -- so set it in the environment
Wouter Verhelst [Wed, 19 Aug 2009 14:09:47 +0000 (16:09 +0200)]
Remove dead code
If someone needs it, they can always pull it from git.
Also, make the mlockall() call conditional on if(swap) again.
Wouter Verhelst [Tue, 18 Aug 2009 16:34:55 +0000 (18:34 +0200)]
Documentation update
Sometimes users get confused over the fact that block devices are files,
too, for the most part. Make it a bit more explicit that exporting block
devices is supported in the documentation.
Wouter Verhelst [Fri, 14 Aug 2009 09:16:33 +0000 (11:16 +0200)]
Fix error output
dousers() previously tried to call g_message directly. Since we're
running as daemon already at this point, g_message won't produce output.
Fix by using err() instead.
Wouter Verhelst [Fri, 14 Aug 2009 08:45:44 +0000 (10:45 +0200)]
Fix message string
Adding the filename as an argument is nice, but the message string needs
it too
Wouter Verhelst [Mon, 10 Aug 2009 08:09:21 +0000 (10:09 +0200)]
Patches from Debian
Wouter Verhelst [Tue, 4 Aug 2009 07:07:49 +0000 (09:07 +0200)]
Rerun autofoo
Wouter Verhelst [Tue, 4 Aug 2009 07:01:21 +0000 (09:01 +0200)]
Make incorrect use of timeout fail.
When nbd-client is compiled on a system that does not support the timeout
ioctl(), we now fail with an error message. Previously, the option would be
silently ignored, which might not be optimal.
Wouter Verhelst [Sat, 18 Jul 2009 13:15:13 +0000 (15:15 +0200)]
Unconfuse
Wouter Verhelst [Fri, 17 Jul 2009 08:58:03 +0000 (10:58 +0200)]
Implement sync option
This allows a user to enable fsync() calls after a write to a backend
file.
Wouter Verhelst [Thu, 9 Jul 2009 08:56:25 +0000 (10:56 +0200)]
Prepare for 2.9.13
Wouter Verhelst [Thu, 9 Jul 2009 08:51:09 +0000 (10:51 +0200)]
Documentation update
People are sometimes confused about the warnings that nbd-server
produces when an invalid or incomplete warning is encountered.
Note in the manpage that these warnings are harmless if a command-line
configuration was specified and no configuration file is desired.
Wouter Verhelst [Mon, 8 Jun 2009 21:15:46 +0000 (23:15 +0200)]
Don't try working on partitions
When a partition is given to the -d or -c command line options, reduce
it to the master device instead.
This assumes udev-style naming of device entries, though.
Wouter Verhelst [Mon, 8 Jun 2009 21:02:29 +0000 (23:02 +0200)]
Fix autodetection
Everything else in nbd-server was already 64bit-clean, but this part,
where the size of a block device is autodected, wasn't.
Replace the ioctl() to BLKGETSIZE with its 64bit version, so that trying
to detect the size of a multi-terabyte block device does not fail.