php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49341 add SO_REUSEPORT support for socket_set_option()
Submitted: 2009-08-24 00:26 UTC Modified: 2021-06-10 16:55 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: jolan at gormsby dot com Assigned: cmb (profile)
Status: Closed Package: Sockets related
PHP Version: 5.2.10 OS: OpenBSD 4.6-current
Private report: No CVE-ID: None
 [2009-08-24 00:26 UTC] jolan at gormsby dot com
Description:
------------
SO_REUSEPORT is needed to allow separate processes to bind to the same 
port. Add the following to ext/sockets/sockets.c after SO_REUSEADDR:

#ifdef SO_REUSEPORT
       REGISTER_LONG_CONSTANT("SO_REUSEPORT",  SO_REUSEPORT,   CONST_CS 
| CONST_PERSISTENT);
#endif

I believe SO_REUSEPORT is not available under Windows, hence the ifdef.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-09 06:11 UTC] netnghia at yahoo dot com
After I add define SO_REUSEPORT to ext/sockets/sockets.c
I configure, make, make install php-5.2.9 again,  I have error:

Warning: socket_set_option(): unable to set socket option [92]: Protocol not available in /usr/share/gds_ftps/gds_ftpd.php on line 985

I don't know what to do to fix. It seem SO_REUSEPORT still cannot use.

Any suggestion?
 [2009-09-09 20:26 UTC] jolan at gormsby dot com
I believe SO_REUSEPORT is *BSD only.  What OS are you using?
 [2010-12-20 13:22 UTC] jani@php.net
-Package: Feature/Change Request +Package: Sockets related
 [2017-08-29 11:48 UTC] michal dot brzuchalski at gmail dot com
Actually it works on my Ubuntu, I've tested it.

---
uname -a
Linux thinkpad 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
---
 [2021-06-10 16:55 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 16:55 UTC] cmb@php.net
SO_REUSEPORT is available as of PHP 5.4.10 and 5.5.3,
respectively, if supported by the OS (Linux as of 3.9).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC