# [PATCH]Add SO_ORIGINAL_DST support and SOL_IP constant to socket_get_options()

- Thread: https://externals.io/message/13077
- Original archive: https://news-web.php.net/php.internals/13077
- Started by Leonardo Pedretti on 2004-09-30T18:48:40+00:00
- Messages: 2
- 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

---

## #13077 — Leonardo Pedretti — 2004-09-30T18:48:40+00:00

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

This patch adds some quite useful functionalities to socket_get_options() 
function.

1st of all, it adds the constant SOL_IP to indicate IP layer in the level 
parameter.

2nd, and the most important, it adds the SO_ORIGINAL_DST constant for the 
optname parameter, and adds this functionality of c's getsockopt()

It applies and compiles cleanly in php-5.0.2 sources under linux 2.4.26 
(slackware linux current). I think it will apply cleanly also into cvs.

Things NOT tested: I don't have solaris, bsd, etc. to test it. If someone can 
test it and report necessary changes, or errors so I can make the changes, It 
will be appreciated.

Regards
Leo

-- 

Leonardo Pedretti
Axon Sistemas
Líder de Equipo Proyecto Basalto

---

## #13096 — Leonardo Pedretti — 2004-10-01T14:02:27+00:00

URL: https://externals.io/message/13077#13096

Help needed on this details bob is commenting about the patch (i don't have 
much experience on the configure scripts).
It would be interesting that someone reports the existence/equivalence of the 
SO_ORIGINAL_DST option on some other systems.

Regards
Leo


> > […]
>
> At minimum, I would imagine that
>
>   a) changing the autoconf script so that it properly detects if the
>      underlying operating system has support for the capability in question
>      is required;
>
>   b) adding #ifdef/#endif pairs based on the autoconf rewrite to include
>      the proper files on a per-architecture basis.
>
> If you only have Linux, then doing (a) and (b) for the Linux-specific
> case would get your patch a lot farther.  If this patch is applied
> as-is to the PHP sources and then compiled on anything except linux,
> it will break because of #include <linux/...> (at minimum).
>
> Not that I'm authoritative about PHP adoption; but having submitted
> patches before to a variety of projects I've found you're likely
> to get farther if you create your patch so that it doesn't break
> anyone else's system.
>
> -Bob

-- 

Leonardo Pedretti
Axon Sistemas
Líder de Equipo Proyecto Basalto
