svn commit: r288247 - head/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Sat Sep 26 01:23:30 UTC 2015


Author: mav
Date: Sat Sep 26 01:23:29 2015
New Revision: 288247
URL: https://svnweb.freebsd.org/changeset/base/288247

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

Modified:
  head/sys/cam/ctl/ctl_ha.c

Modified: head/sys/cam/ctl/ctl_ha.c
==============================================================================
--- head/sys/cam/ctl/ctl_ha.c	Sat Sep 26 01:04:52 2015	(r288246)
+++ head/sys/cam/ctl/ctl_ha.c	Sat Sep 26 01:23:29 2015	(r288247)
@@ -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;


More information about the svn-src-all mailing list