[libvirt] [PATCH] Fix misuse of PF_UNIX

# HG changeset patch # User john.levon@sun.com # Date 1233105335 28800 # Node ID b3a2537e2f3d5ccb055df1820c112b469a26efdb # Parent 35f5d4f77a3f50cadacf32100fdbd992394f6002 Fix misuse of PF_UNIX PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable for the 3rd socket() argument. Solaris should be ignoring the invalid protocol anyway, but this fix is correct regardless. Signed-off-by: John Levon <john.levon@sun.com> diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -752,7 +752,11 @@ xenDaemonOpen_unix(virConnectPtr conn, c memset(&priv->addr, 0, sizeof(priv->addr)); priv->addrfamily = AF_UNIX; - priv->addrprotocol = PF_UNIX; + /* + * This must be zero on Solaris at least for AF_UNIX (which should + * really be PF_UNIX, but doesn't matter). + */ + priv->addrprotocol = 0; priv->addrlen = sizeof(struct sockaddr_un); addr = (struct sockaddr_un *)&priv->addr;

john.levon@sun.com wrote:
Fix misuse of PF_UNIX
PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable for the 3rd socket() argument. Solaris should be ignoring the invalid protocol anyway, but this fix is correct regardless.
Signed-off-by: John Levon <john.levon@sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -752,7 +752,11 @@ xenDaemonOpen_unix(virConnectPtr conn, c
memset(&priv->addr, 0, sizeof(priv->addr)); priv->addrfamily = AF_UNIX; - priv->addrprotocol = PF_UNIX; + /* + * This must be zero on Solaris at least for AF_UNIX (which should + * really be PF_UNIX, but doesn't matter). + */ + priv->addrprotocol = 0; priv->addrlen = sizeof(struct sockaddr_un);
addr = (struct sockaddr_un *)&priv->addr;
This looks like a fine change, especially since the general recommendation is to specify protocol as 0. Considering the above and that this is a bug fix, I'd drop the comment altogether. ACK.

On Wed, Jan 28, 2009 at 11:06:03AM +0100, Jim Meyering wrote:
john.levon@sun.com wrote:
Fix misuse of PF_UNIX
PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable for the 3rd socket() argument. Solaris should be ignoring the invalid protocol anyway, but this fix is correct regardless.
Signed-off-by: John Levon <john.levon@sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -752,7 +752,11 @@ xenDaemonOpen_unix(virConnectPtr conn, c
memset(&priv->addr, 0, sizeof(priv->addr)); priv->addrfamily = AF_UNIX; - priv->addrprotocol = PF_UNIX; + /* + * This must be zero on Solaris at least for AF_UNIX (which should + * really be PF_UNIX, but doesn't matter). + */ + priv->addrprotocol = 0; priv->addrlen = sizeof(struct sockaddr_un);
addr = (struct sockaddr_un *)&priv->addr;
This looks like a fine change, especially since the general recommendation is to specify protocol as 0. Considering the above and that this is a bug fix, I'd drop the comment altogether.
No, please don't drop the comment - the lack of such a warning comment is why I considered it safe to add the PF_UNIX setting in the first place Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Jan 27, 2009 at 05:26:33PM -0800, john.levon@sun.com wrote:
# HG changeset patch # User john.levon@sun.com # Date 1233105335 28800 # Node ID b3a2537e2f3d5ccb055df1820c112b469a26efdb # Parent 35f5d4f77a3f50cadacf32100fdbd992394f6002 Fix misuse of PF_UNIX
PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable for the 3rd socket() argument. Solaris should be ignoring the invalid protocol anyway, but this fix is correct regardless.
Signed-off-by: John Levon <john.levon@sun.com>
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (3)
-
Daniel P. Berrange
-
Jim Meyering
-
john.levon@sun.com