Remove check on source address of a statistics packet. Check was broken
authorTom Lane
Sun, 7 Sep 2003 14:44:40 +0000 (14:44 +0000)
committerTom Lane
Sun, 7 Sep 2003 14:44:40 +0000 (14:44 +0000)
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.

src/backend/postmaster/pgstat.c

index aef71fd49676502bcaa92dc926bc62adc86fa796..b027189082141757fb3ce468ae4bff3f8f88b5fd 100644 (file)
@@ -13,7 +13,7 @@
  *
  * Copyright (c) 2001-2003, PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.43 2003/08/12 16:21:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.44 2003/09/07 14:44:40 tgl Exp $
  * ----------
  */
 #include "postgres.h"
@@ -1591,8 +1591,6 @@ pgstat_recvbuffer(void)
    int         msg_send = 0;   /* next send index in buffer */
    int         msg_recv = 0;   /* next receive index */
    int         msg_have = 0;   /* number of bytes stored */
-   struct sockaddr_storage fromaddr;
-   int         fromlen;
    bool        overflow = false;
 
    /*
@@ -1702,10 +1700,8 @@ pgstat_recvbuffer(void)
         */
        if (FD_ISSET(pgStatSock, &rfds))
        {
-           fromlen = sizeof(fromaddr);
-           len = recvfrom(pgStatSock, (char *) &input_buffer,
-                          sizeof(PgStat_Msg), 0,
-                          (struct sockaddr *) &fromaddr, &fromlen);
+           len = recv(pgStatSock, (char *) &input_buffer,
+                      sizeof(PgStat_Msg), 0);
            if (len < 0)
            {
                ereport(LOG,
@@ -1726,16 +1722,6 @@ pgstat_recvbuffer(void)
            if (input_buffer.msg_hdr.m_size != len)
                continue;
 
-           /*
-            * The source address of the packet must be our own socket.
-            * This ensures that only real hackers or our own backends
-            * tell us something.  (This should be redundant with a
-            * kernel-level check due to having used connect(), but let's
-            * do it anyway.)
-            */
-           if (memcmp(&fromaddr, &pgStatAddr, fromlen))
-               continue;
-
            /*
             * O.K. - we accept this message.  Copy it to the circular
             * msgbuffer.