Q-Bert has asked for the wisdom of the Perl Monks concerning the following question:

IO::Socket->sockopt is used to retrieve a socket option.

In the new 2.4 Linux, there is a new socket option in the netfilter code, called SO_ORIGINAL_DST. We use this to find the original socket destination once the socket has gone through the NAT code. netfilter_ipv4.h defines that value as SO_ORIGINAL_DST = 80.

If I try $socket->sockopt(80), I get $! = "Protocol not available". So I tried to modify Socket-1.5, and added a simple entry for SO_ORIGINAL_DST, but I then got:
Your vendor has not defined Socket macro SO_ORIGINAL_DST, used at ./pr +oxy.pl line 14

How do I add this new socket option so that both IO::Socket and perl recognize it as valid and return the right value ?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I *add* a socket option ?
by ChOas (Curate) on Oct 12, 2000 at 17:38 UTC
    did you try getsockopt($Socket, SOL_SOCKET, SO_ORIGINAL_DST)?
      Yep, SO_ORIGINAL_DST is not permitted by "strict".

      Trying getsockopt($Socket, SOL_SOCKET, 80) returns $!= "Protocol not available".