Req #63472 [Opn->Csd]: Not possibe to set SO_BINDTODEVICE with socket_set_option
Edit report at https://bugs.php.net/bug.php?id=63472&edit=1
ID: 63472
Updated by: stas@php.net
Reported by: zobo at scene-si dot org
Summary: Not possibe to set SO_BINDTODEVICE with
socket_set_option
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Sockets related
Operating System: Linux
PHP Version: master-Git-2012-11-09 (Git)
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-11-09 15:13:08] zobo at scene-si dot org
Description:
------------
In network/socket programming in Linux there are situations when one needs to
bind the socket to a specific interface. This is especially important when
dealaing with broadcasts. Linux has SO_BINDTODEVICE to do this.
But currently it is impossible to use this option with PHP as any unknown
options value will get translated to long and only then passed to setsockopt.
There are two ways to address this issue.
Change the default handler so, that if the argument is string, this is actually
passed to setsockopt. This not only solves this issue, but also opens
impossibles for future options with funky format where pack() may be abused to
get them working without changes to the extension code.
But as this might break BC, there are two other approaches:
1. Just add a case statement specifically for SO_BINDTODEVICE
2. Add some sort of flag to the function parameters (either a bit in the options
argument, or something else) that requests this special "raw" processing of the
argument value.
It would make sense to have the socket_get_option counterpart also implemented.
Not provided in the patch.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63472&edit=1
Thread (3 messages)