1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Do not attempt to set source address on outgoing messages

on UDP socket if we do not have a valid IP address.
This commit is contained in:
Alexander Kabaev 2009-06-08 03:39:15 +00:00
parent 0fe7ed0085
commit 8a784b73d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193677

View File

@ -209,7 +209,7 @@ svc_dg_recvfrom(int fd, char *buf, int buflen,
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 buflen,
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);