Edit report at https://bugs.php.net/bug.php?id=63472&edit=1
ID: 63472 Updated by: s...@php.net Reported by: zobo at scene-si dot org Summary: Not possibe to set SO_BINDTODEVICE with socket_set_option Status: Closed Type: Feature/Change Request Package: Sockets related Operating System: Linux PHP Version: master-Git-2012-11-09 (Git) 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. merged as a0b4348abc09e00170a334c6f67ef399e8b36a1e Previous Comments: ------------------------------------------------------------------------ [2013-06-23 22:31:33] s...@php.net 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. ------------------------------------------------------------------------ [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