Page 1 of 1

Clickpack - Routine CPIPToDomain

Posted: Wed Jun 15, 2005 10:27 am
by pnpmarques
Hello,
I'm working with Clickpack to treat weblogs. I am trying to convert an IP adress to a domain using routine CPIPToDomain. The problem is that it doesn't do any conversion (Testing returns nothing, as well using it in a job).
I'll try to give you more information hoping that it helps you to help me:

There is no reference to it and I don't know much about its code but I believe that inside the routine, this line:
DScallPerl1("sub {my $ip = pack(N,$_[0]);$host = gethostbyaddr($ip,0); return $host; }","I",Key)
is calling the unix command nslookup.

If I execute the nslookup command like this:
/anydirectory/nslookup
I get:
bash: nslookup: command not found

I really have to put the whole path to get something:
/usr/sbin/nslookup 123.123.11.22
Name: name.company.pt
Address: 123.123.11.22


If I execute the nslookup command in a DS job (no path) a get this:
DSJobName..BeforeJob (ExecSH): Executed command: nslookup 123.123.11.22
*** Output from command was: ***
Server: name.company.pt
Address: 123.123.11.22

Do you think Clickpack is not well instaled or something is missing on the server configuration?
Thank You!

Re: Clickpack - Routine CPIPToDomain

Posted: Thu Jul 07, 2005 8:47 am
by ferreirahe
Hi Pedro,

It seems that the code snipet of the Clickpack CPIPToDomain routine you've posted has a wrong parameter regarding Solaris OS:

DScallPerl1("sub {my $ip = pack(N,$_[0]);$host = gethostbyaddr($ip,0); return $host; }","I",Key)

should be:

DScallPerl1("sub {my $ip = pack(N,$_[0]);$host = gethostbyaddr($ip,2); return $host; }","I",Key)

For some reason, the implementation of the gethostbyaddr(...) function only accepts the AF_INET protocol as 2, not 0. In Windows works both ways...who knows what will come next? :wink:

Cheers,
Henrique

pnpmarques wrote:Hello,
I'm working with Clickpack to treat weblogs. I am trying to convert an IP adress to a domain using routine CPIPToDomain. The problem is that it doesn't do any conversion (Testing returns nothing, as well using it in a job).
I'll try to give you more information hoping that it helps you to help me:

There is no reference to it and I don't know much about its code but I believe that inside the routine, this line:
DScallPerl1("sub {my $ip = pack(N,$_[0]);$host = gethostbyaddr($ip,0); return $host; }","I",Key)
is calling the unix command nslookup.

If I execute the nslookup command like this:
/anydirectory/nslookup
I get:
bash: nslookup: command not found

I really have to put the whole path to get something:
/usr/sbin/nslookup 123.123.11.22
Name: name.company.pt
Address: 123.123.11.22


If I execute the nslookup command in a DS job (no path) a get this:
DSJobName..BeforeJob (ExecSH): Executed command: nslookup 123.123.11.22
*** Output from command was: ***
Server: name.company.pt
Address: 123.123.11.22

Do you think Clickpack is not well instaled or something is missing on the server configuration?
Thank You!