mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-01-07 04:54:44 +00:00
ss: small optim in tcp_show_info()
Kernel can give us smaller tcp_info than our. We copy the kernel provided structure and fill with 0 the remaining part. Lets clear only the missing part to save some cycles, as we intend to slightly increase tcp_info size in the future. Signed-off-by: Eric Dumazet <edumazet@google.com>
This commit is contained in:
parent
38a7f26828
commit
656e8fdd2d
@ -1893,8 +1893,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
|
||||
/* workaround for older kernels with less fields */
|
||||
if (len < sizeof(*info)) {
|
||||
info = alloca(sizeof(*info));
|
||||
memset(info, 0, sizeof(*info));
|
||||
memcpy(info, RTA_DATA(tb[INET_DIAG_INFO]), len);
|
||||
memset((char *)info + len, 0, sizeof(*info) - len);
|
||||
} else
|
||||
info = RTA_DATA(tb[INET_DIAG_INFO]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user