diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -3968,6 +3968,13 @@ xt->xt_len = sizeof(struct xtcpcb); in_pcbtoxinpcb(inp, &xt->xt_inp); + /* + * TCP doesn't use inp_ppcb pointer, we embed inpcb into tcpcb. + * Fixup the pointer that in_pcbtoxinpcb() has set. When printing + * TCP netstat(1) used to use this pointer, so this fixup needs to + * stay for stable/14. + */ + xt->xt_inp.inp_ppcb = (uintptr_t)tp; } void diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -383,16 +383,9 @@ if (Lflag && so->so_qlimit == 0) continue; xo_open_instance("socket"); - if (Aflag) { - if (istcp) - xo_emit("{q:address/%*lx} ", - 2 * (int)sizeof(void *), - (u_long)inp->inp_ppcb); - else - xo_emit("{q:address/%*lx} ", - 2 * (int)sizeof(void *), - (u_long)so->so_pcb); - } + if (Aflag) + xo_emit("{q:address/%*lx} ", 2 * (int)sizeof(void *), + (u_long)so->so_pcb); #ifdef INET6 if ((inp->inp_vflag & INP_IPV6) != 0) vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?