Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 11:24:51 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r288804 - stable/10/sys/cam/ctl
Message-ID:  <201510051124.t95BOpeU088813@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Oct  5 11:24:51 2015
New Revision: 288804
URL: https://svnweb.freebsd.org/changeset/base/288804

Log:
  MFC r288247: Pass to sobind() copy of the address, not the original.

Modified:
  stable/10/sys/cam/ctl/ctl_ha.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_ha.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_ha.c	Mon Oct  5 11:05:56 2015	(r288803)
+++ stable/10/sys/cam/ctl/ctl_ha.c	Mon Oct  5 11:24:51 2015	(r288804)
@@ -427,6 +427,7 @@ static int
 ctl_ha_connect(struct ha_softc *softc)
 {
 	struct thread *td = curthread;
+	struct sockaddr_in sa;
 	struct socket *so;
 	int error;
 
@@ -440,7 +441,8 @@ ctl_ha_connect(struct ha_softc *softc)
 	softc->ha_so = so;
 	ctl_ha_sock_setup(softc);
 
-	error = soconnect(so, (struct sockaddr *)&softc->ha_peer_in, td);
+	memcpy(&sa, &softc->ha_peer_in, sizeof(sa));
+	error = soconnect(so, (struct sockaddr *)&sa, td);
 	if (error != 0) {
 		printf("%s: soconnect() error %d\n", __func__, error);
 		goto out;
@@ -517,6 +519,7 @@ static int
 ctl_ha_listen(struct ha_softc *softc)
 {
 	struct thread *td = curthread;
+	struct sockaddr_in sa;
 	struct sockopt opt;
 	int error, val;
 
@@ -557,7 +560,8 @@ ctl_ha_listen(struct ha_softc *softc)
 		SOCKBUF_UNLOCK(&softc->ha_lso->so_rcv);
 	}
 
-	error = sobind(softc->ha_lso, (struct sockaddr *)&softc->ha_peer_in, td);
+	memcpy(&sa, &softc->ha_peer_in, sizeof(sa));
+	error = sobind(softc->ha_lso, (struct sockaddr *)&sa, td);
 	if (error != 0) {
 		printf("%s: sobind() error %d\n", __func__, error);
 		goto out;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510051124.t95BOpeU088813>