diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-05-29 14:33:29 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-05-29 14:33:29 +0200 |
commit | 20ddbf33277108da86c69bb78890fac09e055627 (patch) | |
tree | 5babb22b06e8a85fdf9aa2d29e8f886b67775932 /src | |
parent | 1ecda7339e8678c0b4debe7003b4a42791ad478e (diff) | |
download | conntrack-tools-20ddbf33277108da86c69bb78890fac09e055627.tar.gz conntrack-tools-20ddbf33277108da86c69bb78890fac09e055627.zip |
udp: bind UDP sender side to same interface of the receiver side
Otherwise, the kernel may select a different interface for the client
side. Original patch from Michael Griego.
While at it, remove some trailing whitespaces.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/udp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -136,14 +136,18 @@ struct udp_sock *udp_client_create(struct udp_conf *conf) m->addr.ipv4.sin_family = AF_INET; m->addr.ipv4.sin_port = htons(conf->port); m->addr.ipv4.sin_addr = conf->client.inet_addr; - m->sockaddr_len = sizeof(struct sockaddr_in); + m->sockaddr_len = sizeof(struct sockaddr_in); break; case AF_INET6: m->addr.ipv6.sin6_family = AF_INET6; m->addr.ipv6.sin6_port = htons(conf->port); memcpy(&m->addr.ipv6.sin6_addr, &conf->client.inet_addr6, sizeof(struct in6_addr)); - m->sockaddr_len = sizeof(struct sockaddr_in6); + m->sockaddr_len = sizeof(struct sockaddr_in6); + /* Bind the sender side to the same interface that we use to + * receive sync messages. + */ + m->addr.ipv6.sin6_scope_id = conf->server.ipv6.scope_id; break; default: ret = -1; |