From: zobo at scene-si dot org Operating system: Linux PHP version: master-Git-2012-11-09 (Git) Package: Sockets related Bug Type: Feature/Change Request Bug description:Not possibe to set SO_BINDTODEVICE with socket_set_option
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 bug report at https://bugs.php.net/bug.php?id=63472&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63472&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63472&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63472&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63472&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63472&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63472&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63472&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63472&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63472&r=support Expected behavior: https://bugs.php.net/fix.php?id=63472&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63472&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63472&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63472&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63472&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63472&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63472&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63472&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63472&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63472&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63472&r=mysqlcfg