Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1492760

Summary: IO::Socket::IP->new() fails to listen on unspecified local address
Product: Red Hat Enterprise Linux 7 Reporter: Petr Pisar <ppisar>
Component: perl-IO-Socket-IPAssignee: perl-maint-list
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.4CC: bnater, djez, dkochuka, jkejda, jorton, mkyral, ppisar
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: perl-IO-Socket-IP-0.21-5.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: 1413065 Environment:
Last Closed: 2018-04-10 08:41:10 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: 1413065, 1465904    
Attachments:
Description Flags
First part of the upstream fix
none
Second part of the upstream fix none

Description Petr Pisar 2017-09-18 15:06:11 UTC
+++ This bug was initially created as a clone of Bug #1413065 +++

--- Additional comment from Petr Pisar on 2017-09-18 14:57:10 GMT ---

(In reply to Petr Pisar from comment #16)
> I can introduce special handling for undef and empty string to behave as the
> previous implementation, but it's impossible to emulate all the other corner
> cases.
> 
Actually this does not work with perl-IO-Socket-IP-0.21-4.el7.noarch because that IO::Socket::IP cannot deal with non-existing LocalAddr argument:

$ perl -MIO::Socket::IP -e '$a=IO::Socket::IP->new(Proto=>q{tcp}, Listen=>1) or die qq{Error: $@\n}; print `ss -tnlp`'
Error: 

While it works with latest upstream IO-Socket-IP-0.39:

$ perl -MIO::Socket::IP -e '$a=IO::Socket::IP->new(Proto=>q{tcp}, Listen=>1) or die qq{Error: $@\n}; print `ss -tnlp`'
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128          *:22                       *:*                  
LISTEN     0      1           :::36309                   :::*                   users:(("perl",pid=13539,fd=3))
LISTEN     0      128         :::22                      :::*                  

This incompatibility was probably fixed in IO-Socket-IP-0.25 <https://rt.cpan.org/Public/Bug/Display.html?id=91982> and to be fixed in perl-IO-Socket-IP before we can proceed with this perl-HTTP-Daemon bug.

Comment 1 Petr Pisar 2017-09-18 16:35:48 UTC
Created attachment 1327541 [details]
First part of the upstream fix

Comment 2 Petr Pisar 2017-09-18 16:36:21 UTC
Created attachment 1327542 [details]
Second part of  the upstream fix

Comment 3 Petr Pisar 2017-09-18 16:46:53 UTC
How to test:

(1) Create a listening socket using IO::Socket::IP without specifying local address to bind:

$ perl -MIO::Socket::IP -e '$a=IO::Socket::IP->new(Proto=>q{tcp}, Listen=>1) or die qq{Error: $@}; print `ss -tnlp`'

Before: The program dies with an (empty) exception and no socket is created:

Error:  at -e line 1.

After: The call succeeds and the "ss" command reports a listing socket (IPv6 one if your system support IPv6):

State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128          *:875                      *:*                  
[...]
LISTEN     0      1           :::38121                   :::*                   users:(("perl",pid=4675,fd=3))

Here the the last line is the socket created by the perl program.

(2) You can check LocalAddr argument is still correctly honored:

$ perl -Ilib -MIO::Socket::IP -e '$a=IO::Socket::IP->new(Proto=>q{tcp}, Listen=>1, LocalAddr=>q{::1}) or die qq{Error: $@}; print `ss -tnlp`'
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128          *:875                      *:*                  
[...]
LISTEN     0      1          ::1:56255                   :::*                   users:(("perl",pid=4677,fd=3))

Comment 10 errata-xmlrpc 2018-04-10 08:41:10 UTC
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.

https://access.redhat.com/errata/RHBA-2018:0665