Skip to content

Commit 232dc8e

Browse files
karstengrdavem330
authored andcommitted
net/smc: original socket family in inet_sock_diag
Commit ed75986 ("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: ed75986 ("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>
1 parent 8fc002b commit 232dc8e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/smc/smc_diag.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,20 @@ static void smc_diag_msg_common_fill(struct smc_diag_msg *r, struct sock *sk)
3838
{
3939
struct smc_sock *smc = smc_sk(sk);
4040

41+
r->diag_family = sk->sk_family;
4142
if (!smc->clcsock)
4243
return;
4344
r->id.idiag_sport = htons(smc->clcsock->sk->sk_num);
4445
r->id.idiag_dport = smc->clcsock->sk->sk_dport;
4546
r->id.idiag_if = smc->clcsock->sk->sk_bound_dev_if;
4647
sock_diag_save_cookie(sk, r->id.idiag_cookie);
4748
if (sk->sk_protocol == SMCPROTO_SMC) {
48-
r->diag_family = PF_INET;
4949
memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
5050
memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
5151
r->id.idiag_src[0] = smc->clcsock->sk->sk_rcv_saddr;
5252
r->id.idiag_dst[0] = smc->clcsock->sk->sk_daddr;
5353
#if IS_ENABLED(CONFIG_IPV6)
5454
} else if (sk->sk_protocol == SMCPROTO_SMC6) {
55-
r->diag_family = PF_INET6;
5655
memcpy(&r->id.idiag_src, &smc->clcsock->sk->sk_v6_rcv_saddr,
5756
sizeof(smc->clcsock->sk->sk_v6_rcv_saddr));
5857
memcpy(&r->id.idiag_dst, &smc->clcsock->sk->sk_v6_daddr,

0 commit comments

Comments
 (0)