struct in_pktinfo *pi;
mh.msg_control = &control;
- mh.msg_controllen = CMSG_LEN(sizeof(struct in_pktinfo));
+ mh.msg_controllen = sizeof(control);
cmsg = CMSG_FIRSTHDR(&mh);
- cmsg->cmsg_len = mh.msg_controllen;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
cmsg->cmsg_level = IPPROTO_IP;
cmsg->cmsg_type = IP_PKTINFO;
struct in6_pktinfo *pi;
mh.msg_control = &control;
- mh.msg_controllen = CMSG_LEN(sizeof(struct in6_pktinfo));
+ mh.msg_controllen = sizeof(control);
cmsg = CMSG_FIRSTHDR(&mh);
- cmsg->cmsg_len = mh.msg_controllen;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;