Skip to content

Commit 75c35e0

Browse files
committed
Remove check on source address of a statistics packet. Check was broken
by recent IPv6 changes, and since it's redundant with a kernel-level check anyway, it seems not worth trying to fix it. Per recent discussions.
1 parent 4b407f6 commit 75c35e0

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
1515
*
16-
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.43 2003/08/12 16:21:18 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.44 2003/09/07 14:44:40 tgl Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -1591,8 +1591,6 @@ pgstat_recvbuffer(void)
15911591
int msg_send = 0; /* next send index in buffer */
15921592
int msg_recv = 0; /* next receive index */
15931593
int msg_have = 0; /* number of bytes stored */
1594-
struct sockaddr_storage fromaddr;
1595-
int fromlen;
15961594
bool overflow = false;
15971595

15981596
/*
@@ -1702,10 +1700,8 @@ pgstat_recvbuffer(void)
17021700
*/
17031701
if (FD_ISSET(pgStatSock, &rfds))
17041702
{
1705-
fromlen = sizeof(fromaddr);
1706-
len = recvfrom(pgStatSock, (char *) &input_buffer,
1707-
sizeof(PgStat_Msg), 0,
1708-
(struct sockaddr *) &fromaddr, &fromlen);
1703+
len = recv(pgStatSock, (char *) &input_buffer,
1704+
sizeof(PgStat_Msg), 0);
17091705
if (len < 0)
17101706
{
17111707
ereport(LOG,
@@ -1726,16 +1722,6 @@ pgstat_recvbuffer(void)
17261722
if (input_buffer.msg_hdr.m_size != len)
17271723
continue;
17281724

1729-
/*
1730-
* The source address of the packet must be our own socket.
1731-
* This ensures that only real hackers or our own backends
1732-
* tell us something. (This should be redundant with a
1733-
* kernel-level check due to having used connect(), but let's
1734-
* do it anyway.)
1735-
*/
1736-
if (memcmp(&fromaddr, &pgStatAddr, fromlen))
1737-
continue;
1738-
17391725
/*
17401726
* O.K. - we accept this message. Copy it to the circular
17411727
* msgbuffer.

0 commit comments

Comments
 (0)