netlink: extend buffers to 16K
Starting from linux-3.15 (commit 9063e21fb026, "netlink: autosize skb
lengths"), kernel is able to send up to 16K in netlink replies.
This change enables iproute2 commands to get bigger chunks,
without breaking compatibility with old kernels.
Signed-off-by: Eric Dumazet <edumazet@google.com>
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 9e2a795..8d504a9 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -420,7 +420,7 @@
.msg_iov = &iov,
.msg_iovlen = 1,
};
- char buf[8192];
+ char buf[16384];
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
@@ -486,7 +486,7 @@
{
int status;
struct sockaddr_nl nladdr;
- char buf[8192];
+ char buf[16384];
struct nlmsghdr *h = (void*)buf;
memset(&nladdr, 0, sizeof(nladdr));
diff --git a/misc/ss.c b/misc/ss.c
index d3c4fa6..b7e0ef0 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1877,7 +1877,7 @@
int fd, family;
struct sockaddr_nl nladdr;
struct msghdr msg;
- char buf[8192];
+ char buf[16384];
struct iovec iov[3];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
@@ -1993,7 +1993,7 @@
static int tcp_show_netlink_file(struct filter *f)
{
FILE *fp;
- char buf[8192];
+ char buf[16384];
if ((fp = fopen(getenv("TCPDIAG_FILE"), "r")) == NULL) {
perror("fopen($TCPDIAG_FILE)");
@@ -2510,7 +2510,7 @@
int (* show_one_sock)(struct nlmsghdr *nlh, struct filter *f))
{
int fd;
- char buf[8192];
+ char buf[16384];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
return -1;
@@ -2795,7 +2795,7 @@
struct nlmsghdr nlh;
struct packet_diag_req r;
} req;
- char buf[8192];
+ char buf[16384];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
return -1;