# saned failing with getaddrinfo failed: Name or service not k

## dicer

Hy,

I just installed a fresh gentoo system and put sane on it.

I set up everything and it is working perfectly, when I try to telnet from localhost.

But when I try to telnet from a machine on the local net, the connection is refused and the following error appears in the syslog:

```
Apr  5 23:29:19 lhog xinetd[4207]: START: sane pid=4345 from=192.168.0.101

Apr  5 23:29:19 lhog saned[4345]: saned (AF-indep+IPv6) from sane-backends 1.0.13 ready

Apr  5 23:29:19 lhog saned[4345]: check_host: access by remote host: 192.168.0.101

Apr  5 23:29:19 lhog saned[4345]: check_host: getaddrinfo failed: Name or service not known

Apr  5 23:29:19 lhog saned[4345]: init: access by host 192.168.0.101 denied

Apr  5 23:29:19 lhog saned[4345]: quit: exiting
```

This is how my xinetd.conf looks like:

```
defaults

{

        only_from      = 0.0.0.0

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d
```

As you can see, all restrictions to IPs are disabled.

In /etc/sane.d/saned.conf I added the IP of the machine on the local network (192.168.0.101).

So I guess something goes wrong, when saned tries to resolve/check the ip-address. At least that error-message in the syslog is not normal, is it?

Apr  5 23:29:19 lhog saned[4345]: check_host: getaddrinfo failed: Name or service not known

Cause when connection from localhost, the log is just fine:

```
Apr  5 23:35:51 lhog xinetd[4207]: START: sane pid=4419 from=127.0.0.1

Apr  5 23:35:51 lhog saned[4419]: saned (AF-indep+IPv6) from sane-backends 1.0.13 ready

Apr  5 23:35:51 lhog saned[4419]: check_host: access by remote host: 127.0.0.1

Apr  5 23:35:52 lhog saned[4419]: init: bad status=0 or procnum=-720899

Apr  5 23:35:52 lhog saned[4419]: quit: exiting
```

mfg

dicer

----------

## dicer

I did some more logging (higher debug levels):

telnet from localhost:

```
[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] socket failed: Address family not supported by protocol

[saned] main: [1] socket () using IPv4

[saned] main: [1] setsockopt ()

[saned] main: [1] bind () to port 6566

[saned] main: [1] listen ()

[saned] main: waiting for control connection

[saned] saned (AF-indep+IPv6) from sane-backends 1.0.13 ready

[saned] check_host: access by remote host: 127.0.0.1

[saned] check_host: remote host is IN_LOOPBACK: access granted

[saned] init: access granted

[saned] init: bad status=0 or procnum=-720899

[saned] quit: exiting

```

telnet from network:

```
[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] socket failed: Address family not supported by protocol

[saned] main: [1] socket () using IPv4

[saned] main: [1] setsockopt ()

[saned] main: [1] bind () to port 6566

[saned] main: [1] listen ()

[saned] main: waiting for control connection

[saned] saned (AF-indep+IPv6) from sane-backends 1.0.13 ready

[saned] check_host: access by remote host: 192.168.0.101

[saned] check_host: remote host is not IN_LOOPBACK nor IN6_LOOPBACK

[saned] check_host: local hostname: lhog

[saned] check_host: getaddrinfo failed: Name or service not known

[saned] init: access by host 192.168.0.101 denied

[saned] quit: exiting
```

lhog=localhost=192.168.0.110

hog=192.168.0.101

So how do I get saned to not just check the loopbacks??

----------

## dicer

Just found the solution by myself:

You need your local hostname resolved in /etc/hosts too.

So if your machine is called MACH and has the ip 192.168.0.101, then you need to add the following line to /etc/hosts

192.168.0.101  MACH.local       MACH

Hope this helps someone out there,

mfg

dicer

----------

