Commit e557212e authored by Eric Dumazet's avatar Eric Dumazet Committed by Stephen Hemminger

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: default avatarEric Dumazet <edumazet@google.com>
parent 907e1aca
...@@ -420,7 +420,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, ...@@ -420,7 +420,7 @@ int rtnl_listen(struct rtnl_handle *rtnl,
.msg_iov = &iov, .msg_iov = &iov,
.msg_iovlen = 1, .msg_iovlen = 1,
}; };
char buf[8192]; char buf[16384];
memset(&nladdr, 0, sizeof(nladdr)); memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK; nladdr.nl_family = AF_NETLINK;
...@@ -486,7 +486,7 @@ int rtnl_from_file(FILE *rtnl, rtnl_filter_t handler, ...@@ -486,7 +486,7 @@ int rtnl_from_file(FILE *rtnl, rtnl_filter_t handler,
{ {
int status; int status;
struct sockaddr_nl nladdr; struct sockaddr_nl nladdr;
char buf[8192]; char buf[16384];
struct nlmsghdr *h = (void*)buf; struct nlmsghdr *h = (void*)buf;
memset(&nladdr, 0, sizeof(nladdr)); memset(&nladdr, 0, sizeof(nladdr));
......
...@@ -1877,7 +1877,7 @@ static int inet_show_netlink(struct filter *f, FILE *dump_fp, int protocol) ...@@ -1877,7 +1877,7 @@ static int inet_show_netlink(struct filter *f, FILE *dump_fp, int protocol)
int fd, family; int fd, family;
struct sockaddr_nl nladdr; struct sockaddr_nl nladdr;
struct msghdr msg; struct msghdr msg;
char buf[8192]; char buf[16384];
struct iovec iov[3]; struct iovec iov[3];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0) if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
...@@ -1993,7 +1993,7 @@ done: ...@@ -1993,7 +1993,7 @@ done:
static int tcp_show_netlink_file(struct filter *f) static int tcp_show_netlink_file(struct filter *f)
{ {
FILE *fp; FILE *fp;
char buf[8192]; char buf[16384];
if ((fp = fopen(getenv("TCPDIAG_FILE"), "r")) == NULL) { if ((fp = fopen(getenv("TCPDIAG_FILE"), "r")) == NULL) {
perror("fopen($TCPDIAG_FILE)"); perror("fopen($TCPDIAG_FILE)");
...@@ -2510,7 +2510,7 @@ static int handle_netlink_request(struct filter *f, FILE *dump_fp, ...@@ -2510,7 +2510,7 @@ static int handle_netlink_request(struct filter *f, FILE *dump_fp,
int (* show_one_sock)(struct nlmsghdr *nlh, struct filter *f)) int (* show_one_sock)(struct nlmsghdr *nlh, struct filter *f))
{ {
int fd; int fd;
char buf[8192]; char buf[16384];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0) if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
return -1; return -1;
...@@ -2795,7 +2795,7 @@ static int packet_show_netlink(struct filter *f, FILE *dump_fp) ...@@ -2795,7 +2795,7 @@ static int packet_show_netlink(struct filter *f, FILE *dump_fp)
struct nlmsghdr nlh; struct nlmsghdr nlh;
struct packet_diag_req r; struct packet_diag_req r;
} req; } req;
char buf[8192]; char buf[16384];
if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0) if ((fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG)) < 0)
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment