diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-05-17 23:31:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-05-17 23:31:59 +0000 |
commit | 2f6d85101b6720edef691e854216a266966c44ba (patch) | |
tree | 9c7be9b8caaed6e09356cb1e697790452a0e0da5 /src/backend/utils/adt/pgstatfuncs.c | |
parent | d42e2b75027c4ea4c8140d7734a6e751ec155b6c (diff) | |
download | postgresql-2f6d85101b6720edef691e854216a266966c44ba.tar.gz postgresql-2f6d85101b6720edef691e854216a266966c44ba.zip |
Temporary fix for the problem that pg_stat_activity, inet_client_addr(),
and inet_server_addr() fail if the client connected over a "scoped" IPv6
address. In this case getnameinfo() will return a string ending with
a poorly-standardized "%something" zone specifier, which these functions
try to feed to network_in(), which won't take it. So that we don't lose
functionality altogether, suppress the zone specifier before giving the
string to network_in(). Per report from Brian Hirt.
TODO: probably someday the inet type should support scoped IPv6 addresses,
and then this patch should be reverted.
Backpatch to 8.2 ... is it worth going further?
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
-rw-r--r-- | src/backend/utils/adt/pgstatfuncs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index e2d302b5a64..7b6e833697a 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.34 2006/10/04 00:29:59 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.34.2.1 2007/05/17 23:31:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -485,6 +485,8 @@ pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS) if (ret) PG_RETURN_NULL(); + clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host); + PG_RETURN_INET_P(DirectFunctionCall1(inet_in, CStringGetDatum(remote_host))); } |