Re: function that resolves IP addresses

From: "Jim Buttafuoco" <jim(at)contactbda(dot)com>
To: "Marcel Gsteiger" <Marcel(dot)Gsteiger(at)milprog(dot)ch>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: function that resolves IP addresses
Date: 2005-10-19 13:16:25
Message-ID: 20051019131547.M85610@contactbda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

give this a try if you don't mind using plperlu. This was tested with Postgresql 8.0.3

create or replace function gethostbyaddr(inet) returns text
as
$$
use strict;
use Socket;
my $inet = $_[0];
my $iaddr=inet_aton($inet);
my $name = gethostbyaddr($iaddr,AF_INET);
return $name;
$$
language plperlu;

select gethostbyaddr('199.181.132.250'::inet);

---------- Original Message -----------
From: "Marcel Gsteiger" <Marcel(dot)Gsteiger(at)milprog(dot)ch>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Wed, 19 Oct 2005 14:36:46 +0200
Subject: [GENERAL] function that resolves IP addresses

> Hi all
>
> Does anybody know how I could create a database function that accepts
> an INET parameter and reverse-lookups the hostname via DNS PTR lookup?
> Something like the dnsname command line utility in the djbdns package. I
> need this function for analyzing firewall logs stored in the database
> with ulogd.
>
> Any idea would much be appreciated.
>
> Regards
> --Marcel
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
------- End of Original Message -------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2005-10-19 13:19:21 Re: getting around---division by zero on numeric
Previous Message A. Kretschmer 2005-10-19 13:09:15 Re: function that resolves IP addresses