forked from luck/tmp_suning_uos_patched
net/smc: original socket family in inet_sock_diag
Commited75986f4a
("net/smc: ipv6 support for smc_diag.c") changed the value of the diag_family field. The idea was to indicate the family of the IP address in the inet_diag_sockid field. But the change makes it impossible to distinguish an inet_sock_diag response message from SMC sock_diag response. This patch restores the original behaviour and sends AF_SMC as value of the diag_family field. Fixes:ed75986f4a
("net/smc: ipv6 support for smc_diag.c") Reported-by: Eugene Syromiatnikov <esyr@redhat.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8fc002b01a
commit
232dc8ef64
|
@ -38,6 +38,7 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk)
|
||||||
{
|
{
|
||||||
struct smc_sock *smc = smc_sk(sk);
|
struct smc_sock *smc = smc_sk(sk);
|
||||||
|
|
||||||
|
r->diag_family = sk->sk_family;
|
||||||
if (!smc->clcsock)
|
if (!smc->clcsock)
|
||||||
return;
|
return;
|
||||||
r->id.idiag_sport = htons(smc->clcsock->sk->sk_num);
|
r->id.idiag_sport = htons(smc->clcsock->sk->sk_num);
|
||||||
|
@ -45,14 +46,12 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk)
|
||||||
r->id.idiag_if = smc->clcsock->sk->sk_bound_dev_if;
|
r->id.idiag_if = smc->clcsock->sk->sk_bound_dev_if;
|
||||||
sock_diag_save_cookie(sk, r->id.idiag_cookie);
|
sock_diag_save_cookie(sk, r->id.idiag_cookie);
|
||||||
if (sk->sk_protocol == SMCPROTO_SMC) {
|
if (sk->sk_protocol == SMCPROTO_SMC) {
|
||||||
r->diag_family = PF_INET;
|
|
||||||
memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
|
memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
|
||||||
memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
|
memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
|
||||||
r->id.idiag_src[0] = smc->clcsock->sk->sk_rcv_saddr;
|
r->id.idiag_src[0] = smc->clcsock->sk->sk_rcv_saddr;
|
||||||
r->id.idiag_dst[0] = smc->clcsock->sk->sk_daddr;
|
r->id.idiag_dst[0] = smc->clcsock->sk->sk_daddr;
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
} else if (sk->sk_protocol == SMCPROTO_SMC6) {
|
} else if (sk->sk_protocol == SMCPROTO_SMC6) {
|
||||||
r->diag_family = PF_INET6;
|
|
||||||
memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_saddr,
|
memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_saddr,
|
||||||
sizeof(smc->clcsock->sk->sk_v6_rcv_saddr));
|
sizeof(smc->clcsock->sk->sk_v6_rcv_saddr));
|
||||||
memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr,
|
memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user