Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.7

Request #14830 Add source port option to resolver
Submitted: 2008-10-19 23:31 UTC
From: guitarking117 Assigned: mikepultz
Status: Assigned Package: Net_DNS (version 1.0.0)
PHP Version: 5.2.6 OS: Suse Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-19 23:31 UTC] guitarking117 (Nicholas Williams)
Description: ------------ With `dig`, the source port for the connection is usually chosen randomly. However, it is possible to specify a source port with the -b option as so: -b [ip address]#[src port] Here's a real-life example of how this would work: -b 206.74.179.17#1024 This is useful as sometimes it is necessary to chose specific port numbers to do certain types of diagnostics. It would be nice of Net_DNS offered a similar option to specify a source port. Currently I'm using Net_DNS for all my other DNS checks (even my reverse DNS checks), but I'm having to exec() dig to perform tests using a specific source port.

Comments

 [2008-10-24 11:44 UTC] bate (Marco Kaiser)
I move this to the todo list, thanks for this feature request.
 [2010-08-09 06:03 UTC] mikepultz (Mike Pultz)
This would be pretty tough to do considering the way Net_DNS creates sockets. A socket handle is created for each name server in the nameservers array, so it would be impossible to socket_bind() to the same IP/port for each socket. Also, fsockopen() is used for cases when the sockets extension isn't installed, which has no way of setting the source IP/port- it would have to be switched to use stream_socket_create() function instead. We could add support for binding to a source IP address, and let the port be chosen randomly, but I'm not sure if that satisfies the requirement?
 [2010-08-09 10:42 UTC] bate (Marco Kaiser)
mikepultz, i add you as a developer, try to add a patch for this and run some tests
 [2010-08-09 10:56 UTC] bate (Marco Kaiser)
-Assigned To: bate +Assigned To: mikepultz