Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing '.' seperator in debugging output from backend/dnssd #4444

Closed
michaelrsweet opened this issue Jun 26, 2014 · 4 comments
Closed

Missing '.' seperator in debugging output from backend/dnssd #4444

michaelrsweet opened this issue Jun 26, 2014 · 4 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

@michaelrsweet michaelrsweet commented Jun 26, 2014

Version: 1.7.3
CUPS.org User: pseudonomous

See ubuntu bug (cups 1.7.2):

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1334449?comments=all
If for debugging purposes one reads the output from running:

/usr/lib/cups/backend/dnssd

at the command line, one will see statements like:

DEBUG: Found "Sales._ipp._tcpzeroconf.org"...
DEBUG: Querying "Sales._ipp._tcp.zeroconf.org"...
DEBUG: sent=0, count=1
DEBUG: Found "Stuart's Home AirPrint Printer._ipp._tcpzeroconf.org"...
DEBUG: Found "3rd. Floor Copy Room._ipp._tcpzeroconf.org"...
DEBUG: Found "Engineering._ipp._tcpzeroconf.org"...
DEBUG: Found "Marketing._ipp._tcpzeroconf.org"...

The domain component is not separated from the 'protocol component' of the dns record.

I have been unable to get cups to work with non-local (I mean services that are not served up by mdns in the domain .local) dns-sd ipp printers. (using unicast dns, I have gotten this to work with cups on OS X 10.6). I kept getting a DNS error:

ERROR: DNS failure: NXDOMAIN

At first I believed this was because the dns name was being constructed incorrectly, but after reading the source, I believe the problem is unrelated.

It seems likely to me that there is actually a problem with doing unicast dns lookups with Avahi, however, because of the weird debugging output from backend/dnssd, one is misled to believe that cups is constructing the wrong dnsname to look up.

I have confirmed the bug exists in cups 1.7.3 on Arch Linux as well. It's trivial to fix, but I've included a patch anyways. This bug does not exist with the version of cups (1.4.7) shipped with OS X 10.6.8, I do not know if it exists on more recent versions of OS X, but I don't see any reason why the code should be platform specific.

It should be trivial to patch; patch is attached.

@michaelrsweet
Copy link
Collaborator Author

@michaelrsweet michaelrsweet commented Jun 30, 2014

CUPS.org User: mike

The problem is that mDNSResponder includes a trailing "." on the regtype value while Avahi doesn't. So the correct fix is to make this some more conditional code... :/

@michaelrsweet
Copy link
Collaborator Author

@michaelrsweet michaelrsweet commented Jun 30, 2014

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

@michaelrsweet michaelrsweet commented Jun 30, 2014

"dnssd.c.patch":

--- dnssd.c 2014-06-25 17:00:48.447803109 -0500
+++ dnssd.c.orig 2014-06-25 16:44:59.739098716 -0500
@@ -924,7 +924,7 @@

  • Yes, add the device...
    */
  • fprintf(stderr, "DEBUG: Found "%s.%s.%s"...\n", serviceName, regtype,
  • fprintf(stderr, "DEBUG: Found "%s.%s%s"...\n", serviceName, regtype,
    replyDomain);

device = calloc(sizeof(cups_device_t), 1);

@michaelrsweet
Copy link
Collaborator Author

@michaelrsweet michaelrsweet commented Jun 30, 2014

"str4444.patch":

Index: backend/dnssd.c

--- backend/dnssd.c (revision 11968)
+++ backend/dnssd.c (working copy)
@@ -1,33 +1,17 @@
/*

  • "$Id$"
    *

    • * DNS-SD discovery backend for CUPS.
    • * DNS-SD discovery backend for CUPS.
      *
    • * Copyright 2008-2012 by Apple Inc.
    • * Copyright 2008-2014 by Apple Inc.
      *
    • * These coded instructions, statements, and computer programs are the
    • * property of Apple Inc. and are protected by Federal copyright
    • * law. Distribution and use rights are outlined in the file "LICENSE.txt"
    • * "LICENSE" which should have been included with this file. If this
    • * file is missing or damaged, see the license at "http://www.cups.org/".
    • * These coded instructions, statements, and computer programs are the
    • * property of Apple Inc. and are protected by Federal copyright
    • * law. Distribution and use rights are outlined in the file "LICENSE.txt"
    • * "LICENSE" which should have been included with this file. If this
    • * file is missing or damaged, see the license at "http://www.cups.org/".
      *
    • * This file is subject to the Apple OS-Developed Software exception.
    • * Contents:
    • * main() - Browse for printers.
    • * browse_callback() - Browse devices.
    • * browse_local_callback() - Browse local devices.
    • * client_callback() - Avahi client callback function.
    • * compare_devices() - Compare two devices.
    • * exec_backend() - Execute the backend that corresponds to the
    • * resolved service name.
    • * device_type() - Get DNS-SD type enumeration from string.
    • * get_device() - Create or update a device.
    • * query_callback() - Process query data.
    • * find_device() - Find a device from its name and domain.
    • * sigterm_handler() - Handle termination signals.
    • * unquote() - Unquote a name string.
    • * This file is subject to the Apple OS-Developed Software exception.
      */

    /*
    @@ -924,8 +908,11 @@

    • Yes, add the device...
      */
  • fprintf(stderr, "DEBUG: Found "%s.%s%s"...\n", serviceName, regtype,

  • replyDomain);
    

    +#ifdef HAVE_DNSSD

  • fprintf(stderr, "DEBUG: Found "%s.%s%s"...\n", serviceName, regtype, replyDomain);
    +#else /* HAVE_AVAHI */

  • fprintf(stderr, "DEBUG: Found "%s.%s.%s"...\n", serviceName, regtype, replyDomain);
    +#endif /* HAVE_DNSSD */

device = calloc(sizeof(cups_device_t), 1);
device->name = strdup(serviceName);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant