in reply to (tye)Re: How do I *add* a socket option ?
in thread How do I *add* a socket option ?

Yep, I did exactly that, I got the 1.5 Socket version from CPAN, and installed *that*.

Yes, I know that I downgraded Socket because of that, but I was ready to take that chance.

I added

if (strEQ(name, "SO_ORIGINAL_DST")) #ifdef SO_ORIGINAL_DST return SO_ORIGINAL_DST; #else goto not_there; #endif
in Socket.xs ,and also put the SO_ORIGINAL_DST tag in Socket.pm

I compiled it and installed it. It installed it in /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Socket/Socket.so

Now, when I run:

my $destination_address = $server_socket->sockopt(SO_ORIGINAL_DST); print STDERR "Error: $!\n"; print STDERR "Requested destination address: $destination_address\n";
I get "Your vendor has not defined Socket macro SO_ORIGINAL_DST, used at ./proxy.pl line 14".

So the error appears as soon as $server_socket->sockopt() gets called, because it doesn't even reach the "Error: " output.

Replies are listed 'Best First'.
(tye)Re2: How do I *add* a socket option ?
by tye (Sage) on Oct 12, 2000 at 18:57 UTC

    Then SO_ORIGINAL_DST must not be defined when you compile that code. Check which include file that is defined in and what files you are including in Socket.xs. There could be #ifdef's that prevent it from being defined.

    FYI, you should get that error when your use imports that symbol, not when you try to use the symbol. And you must be importing that symbol since you don't have () on the end of it.

            - tye (but my friends call me "Tye")
      OK, cool, that sorta works.

      I added

      #include <linux/netfilter_ipv4.h>
      in Socket.xs and re-installed it. Now, I get my original error, the same that I got if I did
      getsockopt($server_socket, SOL_SOCKET, 80); # 80 = SO_ORIGINAL_DST
      That error is "Protocol not available".

      I am back to square one. :-(