Fix the NLMSG_LENGTH() arguments in nl.c. Somehow it worked before by

lucky coincidence, but the types provided to the sizeof were wrong.
This commit is contained in:
Nicholas J. Kain 2014-03-17 06:14:14 -04:00
parent 22fede861f
commit 6460346bb6

View File

@ -172,7 +172,7 @@ static int nl_sendgetlink_do(int fd, int seq, int ifindex, int by_ifindex)
ssize_t r; ssize_t r;
memset(nlbuf, 0, sizeof nlbuf); memset(nlbuf, 0, sizeof nlbuf);
nlh->nlmsg_len = NLMSG_LENGTH(sizeof (struct rtattr)); nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
nlh->nlmsg_type = RTM_GETLINK; nlh->nlmsg_type = RTM_GETLINK;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
nlh->nlmsg_seq = seq; nlh->nlmsg_seq = seq;
@ -218,7 +218,7 @@ int nl_sendgetaddr(int fd, int seq, int ifindex)
ssize_t r; ssize_t r;
memset(nlbuf, 0, sizeof nlbuf); memset(nlbuf, 0, sizeof nlbuf);
nlh->nlmsg_len = NLMSG_LENGTH(sizeof (struct rtattr)); nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct ifaddrmsg));
nlh->nlmsg_type = RTM_GETADDR; nlh->nlmsg_type = RTM_GETADDR;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT;
nlh->nlmsg_seq = seq; nlh->nlmsg_seq = seq;