Bug 909454
Summary: | gtk printer widget gives "Getting printer information failed" for cups printer | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Rui Gouveia <rgouveia> | ||||
Component: | gtk2 | Assignee: | Marek Kašík <mkasik> | ||||
Status: | CLOSED ERRATA | QA Contact: | Desktop QE <desktop-qa-list> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 6.3 | CC: | cww, extern.frank.sudthoff, mclasen, msimon, nobody, tpelka | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | gtk2-2.24.23-2.el6 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2014-10-14 07:40:28 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 994246 | ||||||
Attachments: |
|
Description
Rui Gouveia
2013-02-08 20:16:46 UTC
Hi, Doing an strace while the print dialog is invoked I can see that it's trying to connect to the printer server on the default port and not on the configured port. 2665 connect(22, {sa_family=AF_INET, sin_port=htons(631), sin_addr=inet_addr("192.168.122.99")}, 16) = -1 EINPROGRESS (Operation now in progress) 2665 connect(22, {sa_family=AF_INET, sin_port=htons(631), sin_addr=inet_addr("192.168.122.99")}, 16) = -1 ECONNREFUSED (Connection refused) 2665 close(22) = 0 Hi, Some more digging. Hope it helps. The lpoptions appear well defined. The printer is accessible at "printer-uri-supported=ipp://192.168.122.99:63101/printers/HP-LaserJet-5200" : # lpoptions auth-info-required=none copies=1 device-uri=ipp://192.168.122.99:63101/printers/HP-LaserJet-5200 job-hold-until=no-hold job-priority=50 marker-change-time=1360357008 marker-colors=none marker-levels=24 marker-names='Black Cartridge HP Q7516A' marker-types=tonerCartridge number-up=1 printer-info='HP LaserJet 5200' printer-is-accepting-jobs=true printer-is-shared=false printer-location='GSS 2' printer-make-and-model='HP LaserJet 5200 Postscript (recommended) on 192.168.122.99' printer-state=3 printer-state-change-time=1360356574 printer-state-reasons=none printer-type=27439302 printer-uri-supported=ipp://192.168.122.99:63101/printers/HP-LaserJet-5200 But the strace shows that the port number is ignored and the default ipp port is used instead : 2665 connect(22, {sa_family=AF_INET, sin_port=htons(631), sin_addr=inet_addr("192.168.122.99")}, 16) = -1 EINPROGRESS (Operation now in progress) 2665 connect(22, {sa_family=AF_INET, sin_port=htons(631), sin_addr=inet_addr("192.168.122.99")}, 16) = -1 ECONNREFUSED (Connection refused) 2665 close(22) = 0 The following is a tcpdump from the server side : # tcpdump -nn -v -i any host 192.168.122.228 tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes 19:15:56.413416 IP (tos 0x0, ttl 64, id 52810, offset 0, flags [DF], proto TCP (6), length 60) 192.168.122.228.50929 > 192.168.122.99.631: Flags [S], cksum 0x1a9c (correct), seq 2187211175, win 14600, options [mss 1460,sackOK,TS val 6815725 ecr 0,nop,wscale 7], length 0 19:15:56.413462 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40) 192.168.122.99.631 > 192.168.122.228.50929: Flags [R.], cksum 0xbbc8 (correct), seq 0, ack 2187211176, win 0, length 0 19:16:06.240436 IP (tos 0x0, ttl 64, id 55959, offset 0, flags [DF], proto TCP (6), length 209) Versions: # rpm -q cups gtk2 cups-1.4.2-48.el6_3.3.x86_64 gtk2-2.18.9-10.el6.x86_64 I'm not a programmer (simple scripts only), but in the following code, from .../rpmbuild/SOURCES/gtk+-2.18.9/modules/printbackends/cups/gtkprintbackendcups.c , I don't understand where the variable port is instantiated: if (!printer) { GtkPrinterCups *cups_printer; char uri[HTTP_MAX_URI]; /* Printer URI */ char method[HTTP_MAX_URI]; /* Method/scheme name */ char username[HTTP_MAX_URI]; /* Username:password */ char hostname[HTTP_MAX_URI]; /* Hostname */ char resource[HTTP_MAX_URI]; /* Resource name */ int port; /* Port number */ char *cups_server; /* CUPS server */ list_has_changed = TRUE; cups_printer = gtk_printer_cups_new (printer_name, backend); cups_printer->device_uri = g_strdup_printf ("/printers/%s", printer_name); /* Check to see if we are looking at a class */ if (member_uris) { cups_printer->printer_uri = g_strdup (member_uris); /* TODO if member_uris is a class we need to recursivly find a printer */ GTK_NOTE (PRINTING, g_print ("CUPS Backend: Found class with printer %s\n", member_uris)); } else { cups_printer->printer_uri = g_strdup (printer_uri); GTK_NOTE (PRINTING, g_print ("CUPS Backend: Found printer %s\n", printer_uri)); } #if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) || CUPS_VERSION_MAJOR > 1 httpSeparateURI (HTTP_URI_CODING_ALL, cups_printer->printer_uri, method, sizeof (method), username, sizeof (username), hostname, sizeof (hostname), &port, resource, sizeof (resource)); #else httpSeparate (cups_printer->printer_uri, method, username, hostname, &port, resource); #endif if (strncmp (resource, "/printers/", 10) == 0) { cups_printer->ppd_name = g_strdup (resource + 10); GTK_NOTE (PRINTING, g_print ("CUPS Backend: Setting ppd name '%s' for printer/class '%s'\n", cups_printer->ppd_name, printer_name)); } gethostname (uri, sizeof (uri)); cups_server = g_strdup (cupsServer()); if (strcasecmp (uri, hostname) == 0) strcpy (hostname, "localhost"); /* if the cups server is local and listening at a unix domain socket * then use the socket connection */ if ((strstr (hostname, "localhost") != NULL) && (cups_server[0] == '/')) strcpy (hostname, cups_server); g_free (cups_server); cups_printer->default_cover_before = g_strdup (default_cover_before); cups_printer->default_cover_after = g_strdup (default_cover_after); cups_printer->hostname = g_strdup (hostname); cups_printer->port = port; cups_printer->auth_info_required = g_strdupv (auth_info_required); g_strfreev (auth_info_required); printer = GTK_PRINTER (cups_printer); Thank you This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux. Hi, FYI, I did more testes regarding this issue, suspecting a wrong configuration, but I just confirmed the issue. Server has in cupsd.conf: Port 63101 BrowsePort 63101 Client has cupsd.conf: BrowsePoll 192.168.122.99:63101 BrowsePort 63101 Firewall allows traffic: 7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:63101 8 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW udp dpt:63101 SELinux allows the non-standaard port 63101 in the server and the client: # semanage port -l | grep ipp ipp_port_t tcp 63101, 631, 8610-8614 ipp_port_t udp 63101, 631, 8610-8614 All the non-Gtk application work as expected, using only the port 63101/tcp and udp, but when the Gtk Print Dialog starts the following communications is attempted and fails: 20:24:33.886932 IP 192.168.122.228.52755 > 192.168.122.99.631: Flags [S], seq 1291153458, win 14600, options [mss 1460,sackOK,TS val 5593038 ecr 0,nop,wscale 7], length 0 20:24:33.887248 IP 192.168.122.99.631 > 192.168.122.228.52755: Flags [R.], seq 0, ack 1291153459, win 0, length 0 I tried setting the IPP_PORT Env variable without success. Thank you Looking at the function _cupsSetDefaults(void)... If I define the ENV vars: IPP_PORT and CUPS_SERVER it works!!! :) Since the server is parsed correctly, the problem must be in the port selection. Agree? Correct me if I'm wrong. ### If cg->ipp_port is not defined if (!cg->ipp_port) { const char *ipp_port; /* IPP_PORT environment variable */ struct servent *service; /* Port number info */ ### ipp_port takes the value from ENV(IPP_PORT) and is not null. if ((ipp_port = getenv("IPP_PORT")) != NULL) { ### If conversion from string to integer generates an ### error cg->ipp_port takes the default value CUPS_DEFAULT_IPP_PORT if ((cg->ipp_port = atoi(ipp_port)) <= 0) cg->ipp_port = CUPS_DEFAULT_IPP_PORT; } ### else, if ipp does not exists in the system services ### or service->s_port has an invalid value, then ### cg->ipp_port takes the default value CUPS_DEFAULT_IPP_PORT else if ((service = getservbyname("ipp", NULL)) == NULL || service->s_port <= 0) cg->ipp_port = CUPS_DEFAULT_IPP_PORT; ### else, cg->ipp_port takes the value of the services value. else cg->ipp_port = ntohs(service->s_port); } So, if IPP_PORT is defined, all is ok, but if not, this code jumps directly to getting the default value in services. So, where is the value in the configuration read ? I may be analysing the wrong code... Help is appreciated. Thank you This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux. Hi, I found a workaround. Define: $ export CUPS_SERVER=<Print server IP or name> $ export IPP_PORT=<non-standard port> Created attachment 908637 [details]
The patch
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1554.html |