Bug 105402 - Duplicate "Listen 127.0.0.1:631" in cupsd.conf (even after bugfix 88303)
Duplicate "Listen 127.0.0.1:631" in cupsd.conf (even after bugfix 88303)
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: redhat-config-printer (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-25 15:04 EDT by Philip Spencer
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-12 00:42:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Philip Spencer 2003-09-25 15:04:20 EDT
Description of problem:

With two ethernet interfaces, any attempt to set up a printer to share to two
subnets produces a duplicate "Listen 127.0.0.1:631" line in /etc/cups/cupsd.conf.

In our case we have eth0 (subnet 128.100.216.0/255.255.255.0) and eth1 (private
192.168.216.0/255.255.255.0). Initially we had cups set to listen to @IF(eth0)
and @IF(eth1) - that all worked fine. Then we decided it would be better to swit
ch to explicitly specifying the IP subnets, in case we later add virtual
interfaces. So instead of one "Ethernet eth0 and eth1" line in the configuration
tool, we added two lines: one for 128.100.216.0/255.255.255.0 and the
other for 192.168.216.0/255.255.255.0. This produced the following cupsd.conf:

Listen 127.0.0.1:631
Listen 128.100.216.10:631
Listen 192.168.216.10:631
Listen 127.0.0.1:631       <---- duplicate!

Note - this is different from bug 88303. I am already running the errata version
0.6.47.11-1 which contains a fix for that bug.

The problem is the following section of code in util/backend.py:

--------------------
# Interfaces to listen on
if len (ipaddr) != 1 or ipaddr[0] != "*":
    cupsd_conf_lines.append ("Listen 127.0.0.1:631\n")

for each in ipaddr:
    cupsd_conf_lines.append ("Listen %s:631\n" % each)
---------------------

If "127.0.0.1" shows up in the ipaddr list, there will be a duplicate Listen
line generated. This causes cupsd to crash and refuse to start until the
/etc/cups/cups.conf file is fixed by hand. The fix for bug 88303 eliminates
duplicates in ipaddr but it doesn't eliminate 127.0.0.1 from that list.

I have resolved the problem on our site by changing the above lines to:

----------------------
# Interfaces to listen on
wrote_localhost = 0
if len (ipaddr) != 1 or ipaddr[0] != "*":
    cupsd_conf_lines.append ("Listen 127.0.0.1:631\n")
    wrote_localhost = 1

for each in ipaddr:
    if each != "127.0.0.1" or not wrote_localhost:
        cupsd_conf_lines.append ("Listen %s:631\n" % each)
------------------------

This resolves the problem; however, I'm still not sure that the logic of writing
a separate "Listen 127.0.0.1:631" line is correct in the first place ...
Comment 1 Tim Waugh 2003-09-29 08:25:56 EDT
I can't seem to reproduce this problem unless I explicitly list
127.0.0.0/255.255.255.0 as a network interface to listen on.  Is that what
you've done?
Comment 2 Tim Waugh 2003-10-02 08:12:34 EDT
(I'm afraid your reply got lost from bugzilla due to a hardware problem; I had a
copy in my mailbox though:)

--->
No. I simply shared out the printer to two subnets, on different ethernet
interfaces.

Here is a procedure to duplicate the problem (which really shouldn't be
necessary; just look at the code! It shows quite clearly how the two lines
get added).

  * Install two ethernet cards in a machine.
  * Install RedHat Linux 9. Assign IP addresses A.B.C.D and E.F.G.H to the
    two network cards.
  * Upgrade to latest errata
  * Run redhat-config-printer
  * Add a local printer and click Apply.
  * Choose "Sharing" from the Action menu for that printer.
  * Remove the default "All Hosts" entry.
  * Add an entry and specify the firs subnet IP address and mask:
       A.B.C.0/255.255.255.0
  * Add a second entry for the second subnet:
       E.F.G.0/255.255.255.0
  * Click Apply.

The cupsd.conf file now has two "Listen 127.0.0.1:631" lines.

And here is another bug: when I do it this way, there is no listen line for
A.B.C.D, just for E.F.G.H! Unless I also explicitly turn on sharing to the
ethernet card via @IF(eth0) as well!
<---
Comment 3 Tim Waugh 2003-10-02 08:13:53 EDT
If possible, could you try redhat-config-printer-0.6.76-1, which is in rawhide
at the moment?  It contains further fixes in this area, and I'd like to verify
that it fixes the original problem.
Comment 4 Philip Spencer 2003-10-02 12:44:36 EDT
Yes, the new redhat-config-printer-0.6.76-1 does fix the original problem.

It also seems to fix the second problem I noticed when making the previous
reply. Now both subnet IP addresses get listed as they should (instead of just
the second one), and the localhost address 127.0.0.1 gets listed just once as it
should (instead of twice).

Thanks!
Comment 5 Tim Waugh 2003-10-03 11:25:37 EDT
Fixed in CVS.
Comment 6 John Flanagan 2004-05-12 00:42:13 EDT
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-071.html

Note You need to log in before you can comment on or make changes to this bug.