[sane-devel] saned on Gentoo 1.4: disable IPv6?

Henning Meier-Geinitz henning@meier-geinitz.de
Mon, 22 Dec 2003 15:22:52 +0100


Hi,

On Mon, Dec 22, 2003 at 02:20:06PM +0100, Wolfgang Fabics wrote:
> - Tried to start saned (as usual) from xinetd, which started without
>   errors... but saned did not start when connecting to 6566/tcp
>   ("connection refused"). So I disabled xinetd completely and tried
>   saned manually...

If it does not start at all, that's usually an xinetd configuration
problem. saned is only started when you connect to the port, not when
xinetd is loaded. So when there is nothing in the logs from saned,
it's most probably xinetd's fault.

> - ...and found that saned doesn't start at all without debug parameters.
>    saned -d gives me:
> 
>    [saned] main: [1] bind failed: Address already in use

That's ok. I'm getting this:

hmg@hmg1:~$ /usr/local/sbin/saned -d
[saned] main: starting debug mode (level 2)
[saned] main: [1] bind failed: Address already in use

As it uses debug level 2 by default, you won't get many messages. But
it sits there and waits for connections: 

hmg@hmg1:~$ scanimage -d net:localhost:test -T
scanimage: scanning image of size 157x196 pixels at 8 bits/pixel
[...]

saned talks:
[saned] saned (AF-indep+IPv6) from sane-backends 1.0.13-cvs ready
[saned] check_host: access by remote host: ::ffff:127.0.0.1
[saned] init: access granted to hmg@::ffff:127.0.0.1
[saned] quit: exiting

>    A more thorough saned -d128 shows (same thing as at Jim's place):
> 
>   [saned] main: starting debug mode (level 128)
>   [saned] main: trying to get port for service `sane' (getaddrinfo)
>   [saned] main: [0] socket () using IPv6
>   [saned] main: [0] setsockopt ()
>   [saned] main: [0] bind () to port 6566
>   [saned] main: [0] listen ()
>   [saned] main: [1] socket () using IPv4
>   [saned] main: [1] setsockopt ()
>   [saned] main: [1] bind () to port 6566
>   [saned] main: [1] bind failed: Address already in use

Here is the message from above, it's the same one. An the maning is
just that: You can't bind IPv4 and IPv6 at the same time. That's not a
problem as IPv4 traffic will also work. If IPv6 bind had failed, the
IPv4 bind may have succeeded.

>   [saned] main: waiting for control connection
> 
>   But - hooray! - saned runs finally. I can confirm this by a quick
>   scanimage -L from a different terminal window:

It didn't work with the lower debug level? That would be strange.

>   # scanimage -L
>   device `mustek_pp:Mustek-1200CP' is a Mustek 1200CP flatbed scanner
>   device `net:127.0.0.1:mustek_pp:Mustek-1200CP' is a Mustek 1200CP
>   flatbed scanner
> 
> - But at the same time, the following happens to saned (I do not run
>    1.0.13 bcs it is not in the portage tree yet, and I want to keep at
>    least 'this' system somewhat tidy ;-):
> 
>    [saned] saned (AF-indep+IPv6) from sane-backends 1.0.12 ready
>    [saned] check_host: detected an IPv4-mapped address
>    [saned] check_host: access by remote host: ::ffff:127.0.0.1
>    [saned] check_host: remote host is IN_LOOPBACK: access granted
>    [saned] init: access granted
>    [saned] init: access granted to @::ffff:127.0.0.1
>    [saned] process_request: waiting for request
>    [saned] process_request: got request 1
>    [saned] process_request: waiting for request
>    [saned] process_request: got request 10
>    [saned] quit: exiting
> 
>    Pop goes the world, no more saned 'round here *sob*.

That's ok. saned exits after one connection. That's why it's called
"debug mode" :-)

> So, my questions circle around that IPv6 thing in the first place:

I sure that IPv6 is not your problem. As you can "see" the scanner,
the connection is ok. I.e. start saned again and scan directly:

scanimage -d net:127.0.0.1:mustek_pp:Mustek-1200CP >/tmp/image.pnm

> Despite the fact that I have disabled IPv6 on my system (USE="-ipv6),
> the sane-backends' ./configure script claimed
> 
> "checking whether to use IPv6... yes"
> 
> How come?

That's because you haven't disabled IPv6 support. At least glibc tells
saned that you have IPv6.

> And how do I turn that off?

./configure  --disable-ipv6

(at least in sane-backends 1.0.13).

> Didn't find anything in the
> manuals (neither sane nor Gentoo) that I could relate to that. In fact,
> sane-backends does not seem to recognize USE flags at all:
 
What is a "USE" flag?

> Any help with this would be much appreciated!

Check xinetd, not saned.

E.g. does running script that just echos some text work instead of
saned? E.g.

#!/bin/bash
echo "saned is running"

Save as /tmp/saned, c hmod a+x, and put that into xinetd. 
"telnet localhost sane" should print the message. If that works, using
the real saned as avove should also work.

Bye,
  Henning