Lines Matching refs:cmsg
40 struct cmsghdr *cmsg; in sendtofrom() local
62 cmsg = CMSG_FIRSTHDR(&msg); in sendtofrom()
66 cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr)); in sendtofrom()
67 cmsg->cmsg_level = IPPROTO_IP; in sendtofrom()
68 cmsg->cmsg_type = IP_SENDSRCADDR; in sendtofrom()
70 memcpy(CMSG_DATA(cmsg), &in->sin_addr, sizeof(struct in_addr)); in sendtofrom()
74 cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); in sendtofrom()
75 cmsg->cmsg_level = IPPROTO_IPV6; in sendtofrom()
76 cmsg->cmsg_type = IPV6_PKTINFO; in sendtofrom()
78 pkt6 = (struct in6_pktinfo *)CMSG_DATA(cmsg); in sendtofrom()
92 struct cmsghdr *cmsg; in recvfromto() local
123 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; in recvfromto()
124 cmsg = CMSG_NXTHDR(&msg, cmsg)) { in recvfromto()
127 if (cmsg->cmsg_level == IPPROTO_IP && in recvfromto()
128 cmsg->cmsg_type == IP_RECVDSTADDR) { in recvfromto()
132 memcpy(&in->sin_addr, CMSG_DATA(cmsg), in recvfromto()
137 if (cmsg->cmsg_level == IPPROTO_IPV6 && in recvfromto()
138 cmsg->cmsg_type == IPV6_PKTINFO) { in recvfromto()
142 pkt6 = (struct in6_pktinfo *)CMSG_DATA(cmsg); in recvfromto()