Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jun 2009 03:39:16 +0000 (UTC)
From:      Alexander Kabaev <kan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193677 - head/lib/libc/rpc
Message-ID:  <200906080339.n583dGCF014599@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kan
Date: Mon Jun  8 03:39:15 2009
New Revision: 193677
URL: http://svn.freebsd.org/changeset/base/193677

Log:
  Do not attempt to set source address on outgoing messages
  on UDP socket if we do not have a valid IP address.

Modified:
  head/lib/libc/rpc/svc_dg.c

Modified: head/lib/libc/rpc/svc_dg.c
==============================================================================
--- head/lib/libc/rpc/svc_dg.c	Mon Jun  8 03:37:25 2009	(r193676)
+++ head/lib/libc/rpc/svc_dg.c	Mon Jun  8 03:39:15 2009	(r193677)
@@ -209,7 +209,7 @@ svc_dg_recvfrom(int fd, char *buf, int b
 		return rlen;
 
 	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
-	     cmsg = CMSG_NXTHDR(&msg, cmsg)){
+	     cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 		if (cmsg->cmsg_level == IPPROTO_IP &&
 		    cmsg->cmsg_type == IP_RECVDSTADDR) {
 			have_lin = TRUE;
@@ -300,7 +300,7 @@ svc_dg_sendto(int fd, char *buf, int buf
 	msg.msg_namelen = raddrlen;
 	msg.msg_name = (char *)raddr;
 
-	if (laddr->sa_family == AF_INET) {
+	if (laddr->sa_family == AF_INET && lin->s_addr != INADDR_ANY) {
 		msg.msg_control = (caddr_t)tmp;
 		msg.msg_controllen = CMSG_LEN(sizeof(*lin));
 		cmsg = CMSG_FIRSTHDR(&msg);



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