# dns_get_record for OSX

- Thread: https://externals.io/message/42521
- Original archive: https://news-web.php.net/php.internals/42521
- Started by Scott MacVicar on 2009-01-07T03:30:42+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #42521 — Scott MacVicar — 2009-01-07T03:30:42+00:00

URL: https://externals.io/message/42521#42521

I went to look at the bug Pierre mention earlier and noticed that  
dns_get_record isn't implemented on OS X, this looks to be down to the  
fact that it has a bind 8 BC layer that we use by default for some  
reason. I tried to make it use the bind 9 interface but it wasn't a  
simple task as some other things were missing.

End result here is a patch that allows bind 8 to work and therefore OS  
X, the main difference is that there is a shared _res structure rather  
than a per request one.

I'll apply this tomorrow if no one has any objections.

Scott

---

## #42523 — Kalle Sommer Nielsen — 2009-01-07T06:49:51+00:00

URL: https://externals.io/message/42521#42523 · In reply to: #42521

Hi Scott

2009/1/7 Scott MacVicar <scott@macvicar.net>:
> I went to look at the bug Pierre mention earlier and noticed that
> dns_get_record isn't implemented on OS X, this looks to be down to the fact
> that it has a bind 8 BC layer that we use by default for some reason. I
> tried to make it use the bind 9 interface but it wasn't a simple task as
> some other things were missing.
>
> End result here is a patch that allows bind 8 to work and therefore OS X,
> the main difference is that there is a shared _res structure rather than a
> per request one.

Does this mean it will also work on BSD? As far I remember then
dns_get_record wasn't implemented on BSD aswell. If not then it would
be ideal to support it if OSX is patched :)

>
> I'll apply this tomorrow if no one has any objections.
>
> Scott



-- 
Kalle Sommer Nielsen

---

## #42524 — Hannes Magnusson — 2009-01-07T08:06:28+00:00

URL: https://externals.io/message/42521#42524 · In reply to: #42523

> Hi Scott
>
> 2009/1/7 Scott MacVicar <scott@macvicar.net>:
> > […]
>
> Does this mean it will also work on BSD? As far I remember then
> dns_get_record wasn't implemented on BSD aswell. If not then it would

FreeBSD ports have had their own patch for years.

-Hannes

---

## #42525 — Pierre Joye — 2009-01-07T09:24:51+00:00

URL: https://externals.io/message/42521#42525 · In reply to: #42521

hi,


> I went to look at the bug Pierre mention earlier and noticed that
> dns_get_record isn't implemented on OS X, this looks to be down to the fact
> that it has a bind 8 BC layer that we use by default for some reason. I
> tried to make it use the bind 9 interface but it wasn't a simple task as
> some other things were missing.
>
> End result here is a patch that allows bind 8 to work and therefore OS X,
> the main difference is that there is a shared _res structure rather than a
> per request one.

Please look at (1st result in google or bugs.php.net :):

http://bugs.php.net/bug.php?id=29337

> I'll apply this tomorrow if no one has any objections.

About FreeBSD:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/php5/files/patch-ext_standard_dns.h


Cheers,
--
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #42526 — Pierre Joye — 2009-01-07T09:26:06+00:00

URL: https://externals.io/message/42521#42526 · In reply to: #42521

hi,


> I went to look at the bug Pierre mention earlier and noticed that
> dns_get_record isn't implemented on OS X, this looks to be down to the fact
> that it has a bind 8 BC layer that we use by default for some reason. I
> tried to make it use the bind 9 interface but it wasn't a simple task as
> some other things were missing.
>
> End result here is a patch that allows bind 8 to work and therefore OS X,
> the main difference is that there is a shared _res structure rather than a
> per request one.

Please look at (1st result in google or bugs.php.net :):

http://bugs.php.net/bug.php?id=29337

> I'll apply this tomorrow if no one has any objections.

About FreeBSD:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/php5/files/patch-ext_standard_dns.h


Cheers,
--
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #42527 — Pierre Joye — 2009-01-07T09:44:43+00:00

URL: https://externals.io/message/42521#42527 · In reply to: #42526

hi,



> Please look at (1st result in google or bugs.php.net :):
>
> http://bugs.php.net/bug.php?id=29337
>
> > […]
>
> About FreeBSD:
>
> http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/php5/files/patch-ext_standard_dns.h

On a sidenote, I would suggest to take a look at  the djbdns library,
which is available on almost all platform and seems to be much cleaner
than bind(8|9): http://cr.yp.to/djbdns/dns.html

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #42528 — Ronald Chmara — 2009-01-07T10:56:54+00:00

URL: https://externals.io/message/42521#42528 · In reply to: #42527

> On a sidenote, I would suggest to take a look at  the djbdns library,
> which is available on almost all platform and seems to be much cleaner
> than bind(8|9): http://cr.yp.to/djbdns/dns.html

Technical issue: While available, it is not installed (by default) on  
as many platforms as the bind libraries.
Non-Technical issue: <redacted>

-Bop

---

## #42530 — Scott MacVicar — 2009-01-07T13:04:36+00:00

URL: https://externals.io/message/42521#42530 · In reply to: #42523

Hi Kalle,
Kalle Sommer Nielsen wrote:
> Hi Scott
> 
> 2009/1/7 Scott MacVicar <scott@macvicar.net>:
> > […]
> 
> Does this mean it will also work on BSD? As far I remember then
> dns_get_record wasn't implemented on BSD aswell. If not then it would
> be ideal to support it if OSX is patched :)

Yeah it would work on all of the BSDs, though we have some wierd
bastardisation of bind8 and bind9 code in dns.c, I think some gentle
refactoring is in order to get this in a bit better shape.

OS X actually has res_nmkquery but AC_CHECK_FUNC can't correctly detect
this because of the way its defined in resolv.h, it's something like this.

#define res_nmkquery bind_9_nmkquery

AC_CHECK_FUNC does an #undef res_nmkquery as part of its test resulting
in the failure.

FreeBSD has __res_nmkquery but unfortunately PHP_CHECK_FUNC when
checking for res_nmkquery OR __res_nmkquery it doesn't tell you which
one it found.

I'll fix this in stages I guess, starting with the autoconf fun.

Scott
