Revert r299830, it has couple of fatal errors.

The CMSG_ family of macros take care of alignment, so we don't need r299830
at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.

Together with:	peter
This commit is contained in:
Gleb Smirnoff 2016-05-18 22:02:19 +00:00
parent 631dbc3b78
commit 9aa8749970
2 changed files with 6 additions and 5 deletions

View File

@ -1169,7 +1169,7 @@ recv_dgram(struct port_input *pi, struct in_addr *laddr)
memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr));
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_CREDS)
memcpy(cred, CMSG_DATA(cmsg), sizeof(struct sockcred));
cred = (struct sockcred *)CMSG_DATA(cmsg);
}
if (pi->cred)
@ -1207,7 +1207,7 @@ snmpd_input(struct port_input *pi, struct tport *tport)
ret = recv_stream(pi);
} else {
struct in_addr laddr;
struct in_addr *laddr;
memset(cbuf, 0, CMSG_SPACE(sizeof(struct in_addr)));
msg.msg_control = cbuf;
@ -1216,11 +1216,11 @@ snmpd_input(struct port_input *pi, struct tport *tport)
cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
cmsgp->cmsg_level = IPPROTO_IP;
cmsgp->cmsg_type = IP_SENDSRCADDR;
memcpy(&laddr, CMSG_DATA(cmsgp), sizeof(struct in_addr));
laddr = (struct in_addr *)CMSG_DATA(cmsgp);
ret = recv_dgram(pi, &laddr);
ret = recv_dgram(pi, laddr);
if (laddr.s_addr == 0) {
if (laddr->s_addr == 0) {
msg.msg_control = NULL;
msg.msg_controllen = 0;
}

View File

@ -47,6 +47,7 @@ MANFILTER= sed -e 's%@MODPATH@%${LIBDIR}/%g' \
-e 's%@DEFPATH@%${DEFSDIR}/%g' \
-e 's%@MIBSPATH@%${BMIBSDIR}/%g'
NO_WCAST_ALIGN= yes
WARNS?= 6
.include <bsd.prog.mk>