Commit c9b1ec65 authored by Pavel Tvrdík's avatar Pavel Tvrdík

Socktest: Consider interface index at sendmsg

parent 454a2b40
......@@ -103,7 +103,7 @@ static inline int get_recv_ttl(void)
extern int cf_type;
void
prepare_tx_cmsgs(int fd, struct msghdr *msg, void *buf, int blen, struct in_addr laddr)
prepare_tx_cmsgs(int fd, int cf_ifindex, struct msghdr *msg, void *buf, int blen, struct in_addr laddr)
{
#ifdef RAW_USE_HDR
if (cf_type == SK_IP)
......
......@@ -74,7 +74,7 @@ static inline int get_recv_ttl(void)
void
prepare_tx_cmsgs(int fd, struct msghdr *msg, void *buf, int blen, struct in_addr laddr)
prepare_tx_cmsgs(int fd, int cf_ifindex, struct msghdr *msg, void *buf, int blen, struct in_addr laddr)
{
struct cmsghdr *cm;
struct in_pktinfo *pi;
......@@ -88,7 +88,7 @@ prepare_tx_cmsgs(int fd, struct msghdr *msg, void *buf, int blen, struct in_addr
cm->cmsg_len = CMSG_LEN(sizeof(*pi));
pi = (struct in_pktinfo *) CMSG_DATA(cm);
pi->ipi_ifindex = 0;
pi->ipi_ifindex = cf_ifindex;
pi->ipi_spec_dst = laddr;
pi->ipi_addr = INET_ANY;
......
......@@ -68,7 +68,7 @@ static inline int get_recv_ttl(void)
void
prepare_tx_cmsgs(int fd, struct msghdr *msg, void *buf, int blen, struct in6_addr laddr)
prepare_tx_cmsgs(int fd, int cf_ifindex, struct msghdr *msg, void *buf, int blen, struct in6_addr laddr)
{
struct cmsghdr *cm;
struct in6_pktinfo *pi;
......@@ -82,7 +82,7 @@ prepare_tx_cmsgs(int fd, struct msghdr *msg, void *buf, int blen, struct in6_add
cm->cmsg_len = CMSG_LEN(sizeof(*pi));
pi = (struct in6_pktinfo *) CMSG_DATA(cm);
pi->ipi6_ifindex = 0;
pi->ipi6_ifindex = cf_ifindex;
pi->ipi6_addr = laddr;
msg->msg_controllen = cm->cmsg_len;
......
......@@ -25,7 +25,7 @@ do_sendmsg(int fd, inetaddr saddr, inetaddr daddr, int dport, void *buf, size_t
}
#endif
prepare_tx_cmsgs(fd, &msg, cmsg_buf, sizeof(cmsg_buf), saddr);
prepare_tx_cmsgs(fd, cf_ifindex, &msg, cmsg_buf, sizeof(cmsg_buf), saddr);
return sendmsg(fd, &msg, 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment