From: | Kurt Roeckx <Q(at)ping(dot)be> |
---|---|
To: | Kevin Brown <kevin(at)sysexperts(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Stats Collector Error 7.4beta1 and 7.4beta2 |
Date: | 2003-09-09 18:03:41 |
Message-ID: | 20030909180341.GA6557@ping.be |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Sep 09, 2003 at 02:10:20AM -0700, Kevin Brown wrote:
> > I could go for Jan's idea of putting a random key into the messages,
> > if anyone feels that we should not trust to the kernel to enforce the
> > packet source address restriction. But the memcmp() test seems a clear
> > loser given today's discussions.
>
> The test in the 7.3.x code looked reasonable to me, especially if it's
> possible to make it work with IPV6 (if it doesn't already). It's doing
> basically the right thing, at any rate: directly comparing the actual
> fields that are relevant. Does this test represent a significant
> performance hit?
The reason I used a memcmp() instead of dealing with the
structure members themself is because it was easier.
Checking that they're the same address family is easy, and if
they're different the kernel is really broken.
For the addresses and port, in case of IPv4, you have to cast it
to sockaddr_in *, and compare the sin_addr and sin_port like
before.
For IPv6 you could do it with a memcmp on the sin6_addr part, and
put it inside an #ifdef HAVE_IPV6.
If you want to write code to compare 2 addresses, please make it
a general function and place it in ip.c.
Anyway, I'm happy with the current use of recv().
Kurt
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-09-09 18:25:19 | Re: Maximum table size |
Previous Message | Bruce Momjian | 2003-09-09 17:57:47 | Re: libpq++ |