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

Browse packets no longer sent after reload #1670

Closed
michaelrsweet opened this issue May 10, 2006 · 8 comments
Closed

Browse packets no longer sent after reload #1670

michaelrsweet opened this issue May 10, 2006 · 8 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2.0
CUPS.org User: twaugh.redhat

Reloading cupsd (by sending it SIGHUP) causes browse packets to be stopped.

See RH Bugzilla bug #191217:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=191217

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Everything looks OK here, looking into it some more...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

I can't reproduce this at all - can you get a cupsd.conf and error_log file from the user?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: twaugh.redhat

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=191217 now has the cupsd.conf used, as well as an error_log snippet. The important line is:

E [09/May/2006:14:01:19 -0600] cupsdSendBrowseList: sendto failed for browser 1 - Bad file descriptor.

It seems like this is what happens:

In main.c at line 611, cupsdStopServer() calls cupsdStopBrowsing() which closes the browse socket and sets BrowseSocket to -1.

Then, from main.c:617, while reading configuration, NumBrowsers gets set to 1. But later during cupsdReadConfiguration() (conf.c:938), the scheduler attempts to send 'delete' browse messages from cupsdDeletePrinter() (printers.c:681).

This fails, because BrowseSocket == -1, and so at dirsvc.c:2608 we decrement NumBrowsers back to 0.

Later, in cupsdStartBrowsing, we do open the browse socket -- but NumBrowsers is still 0 so it never gets used.

Perhaps the key to reproducing this problem is having both 'BrowseDeny All' and 'BrowseAddress @Local' in cupsd.conf.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: twaugh.redhat

Actually you need a specific 'BrowseAddress' network mask like 192.168.1.255 to trigger this.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: twaugh.redhat

Attached is a fix that works for me.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Actually, I'm opting to localize the check to cupsdSendBrowseDelete(), since we want to disable browsing if BrowseSocket is -1 after a successful startup.

I also added corresponding checks for SLP as well...

Let me know if this doesn't work for you...

(And BTW, thanks for the clear debugging into the cause!)

@michaelrsweet
Copy link
Collaborator Author

"cups-str1670.patch":

--- cups-1.2.x/scheduler/dirsvc.c.str1670 2006-05-18 13:48:42.000000000 +0100
+++ cups-1.2.x/scheduler/dirsvc.c 2006-05-18 13:49:45.000000000 +0100
@@ -2596,7 +2596,8 @@
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdSendBrowseList: (%d bytes) %s", bytes, packet);

  •  if (sendto(BrowseSocket, packet, bytes, 0,
    
  •  if (BrowseSocket != -1 &&
    
  • sendto(BrowseSocket, packet, bytes, 0,
     (struct sockaddr *)&(b->to),
     sizeof(struct sockaddr_in)) <= 0)
    
    {

@michaelrsweet
Copy link
Collaborator Author

"str1670.patch":

Index: dirsvc.c

--- dirsvc.c (revision 5547)
+++ dirsvc.c (working copy)
@@ -665,10 +665,10 @@

  • Announce the deletion...
    */

  • if (BrowseLocalProtocols & BROWSE_CUPS)

  • if ((BrowseLocalProtocols & BROWSE_CUPS) && BrowseSocket >= 0)
    send_cups_browse(p);
    #ifdef HAVE_LIBSLP

  • if (BrowseLocalProtocols & BROWSE_SLP)

  • if ((BrowseLocalProtocols & BROWSE_SLP) && BrowseSLPHandle)
    slp_dereg_printer(p);
    #endif /* HAVE_LIBSLP */
    }
    @@ -934,6 +934,8 @@

    BrowseSLPRefresh = 0;
    }

  • else

  • BrowseSLPHandle = NULL;
    #endif /* HAVE_LIBSLP */

#ifdef HAVE_OPENLDAP

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

No branches or pull requests

1 participant