Hi,
This comes as a follow-up on a recent issue I mentioned and was discussed on
this list. (See thread [1]).
The included patch fixes the issue and postgres has been working fine for me
with it. See this thread[2] for details.
Cheers,
----- Forwarded message from J=E9r=E9mie Courr=E8ges-Anglas <jca@wxcvbn.org=
> -----
> Date: Mon, 16 Feb 2015 23:21:05 +0100
> From: J=E9r=E9mie Courr=E8ges-Anglas <jca@wxcvbn.org>
> Subject: Re: postgresql-server exiting abnormally after upgrade to -snaps=
hot
> To: Hugo Osvaldo Barrera <hugo@barrera.io>
> Cc: misc@openbsd.org
> Mail-Followup-To: Hugo Osvaldo Barrera <hugo@barrera.io>, misc@openbsd.org
>=20
> jca@wxcvbn.org (J=E9r=E9mie Courr=E8ges-Anglas) writes:
>=20
> > Please try the diff below. It fixes the "backwards memcpy" problem
> > easily noticeable with psql -h ::1.
>=20
> Updated diff. Thanks to Stuart for reminding me that netmasks sa_len
> values can be much surprising.
>=20
> $OpenBSD$
> --- src/backend/libpq/hba.c.orig Mon Feb 16 21:53:21 2015
> +++ src/backend/libpq/hba.c Mon Feb 16 23:08:38 2015
> @@ -700,8 +700,13 @@ check_ip(SockAddr *raddr, struct sockaddr * addr, st=
ru
> struct sockaddr_storage addrcopy,
> maskcopy;
> =20
> - memcpy(&addrcopy, &addr, sizeof(addrcopy));
> - memcpy(&maskcopy, &mask, sizeof(maskcopy));
> + memcpy(&addrcopy, addr, sizeof(struct sockaddr_in));
> + /*
> + * On some OSes, if mask is obtained from eg. getifaddrs(3), sa_len
> + * can vary wildly. We already know that addr->sa_family =3D=3D AF_INE=
T,
> + * so just use sizeof(struct sockaddr_in).
> + */
> + memcpy(&maskcopy, mask, sizeof(struct sockaddr_in));
> pg_promote_v4_to_v6_addr(&addrcopy);
> pg_promote_v4_to_v6_mask(&maskcopy);
> =20
>=20
>=20
> --=20
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7=
EE
>=20
----- End forwarded message -----
[1]: http://www.postgresql.org/message-id/20150216202138.GB20474@athena.bar=
rera.io
[2]: https://marc.info/?t=3D142367714200001&r=3D1&w=3D2
--=20
Hugo Osvaldo Barrera
A: Because we read from top to bottom, left to right.
Q: Why should I start my reply below the quoted text?