zebra: use larger buffer (4096) for netlink messages
Increase the maximum number of nexthops per route by using a larger
buffer for netlink messages.
* zebra/rt_netlink.c: Use a buffer of 4096 bytes to parse/build
netlink messages. Add a hash define for this number
(NL_PKT_BUF_SIZE). Most places in the code were previously using a
buffer of 1024 bytes.
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 73097bf..5909131 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -43,6 +43,8 @@
#include "zebra/interface.h"
#include "zebra/debug.h"
+#define NL_PKT_BUF_SIZE 4096
+
/* Socket interface to kernel */
struct nlsock
{
@@ -281,7 +283,7 @@
while (1)
{
- char buf[4096];
+ char buf[NL_PKT_BUF_SIZE];
struct iovec iov = { buf, sizeof buf };
struct sockaddr_nl snl;
struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
@@ -1363,7 +1365,7 @@
{
struct nlmsghdr n;
struct rtmsg r;
- char buf[1024];
+ char buf[NL_PKT_BUF_SIZE];
} req;
memset (&req, 0, sizeof req);
@@ -1438,7 +1440,7 @@
{
struct nlmsghdr n;
struct rtmsg r;
- char buf[1024];
+ char buf[NL_PKT_BUF_SIZE];
} req;
memset (&req, 0, sizeof req);
@@ -1646,7 +1648,7 @@
}
else
{
- char buf[1024];
+ char buf[NL_PKT_BUF_SIZE];
struct rtattr *rta = (void *) buf;
struct rtnexthop *rtnh;
union g_addr *src = NULL;
@@ -1690,7 +1692,7 @@
if (nexthop->rtype == NEXTHOP_TYPE_IPV4
|| nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX)
{
- rta_addattr_l (rta, 4096, RTA_GATEWAY,
+ rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->rgate.ipv4, bytelen);
rtnh->rtnh_len += sizeof (struct rtattr) + 4;
@@ -1708,7 +1710,7 @@
|| nexthop->rtype == NEXTHOP_TYPE_IPV6_IFNAME
|| nexthop->rtype == NEXTHOP_TYPE_IPV6_IFINDEX)
{
- rta_addattr_l (rta, 4096, RTA_GATEWAY,
+ rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->rgate.ipv6, bytelen);
if (IS_ZEBRA_DEBUG_KERNEL)
@@ -1764,7 +1766,7 @@
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
{
- rta_addattr_l (rta, 4096, RTA_GATEWAY,
+ rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->gate.ipv4, bytelen);
rtnh->rtnh_len += sizeof (struct rtattr) + 4;
@@ -1782,7 +1784,7 @@
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)
{
- rta_addattr_l (rta, 4096, RTA_GATEWAY,
+ rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY,
&nexthop->gate.ipv6, bytelen);
if (IS_ZEBRA_DEBUG_KERNEL)
@@ -1828,7 +1830,7 @@
addattr_l (&req.n, sizeof req, RTA_PREFSRC, &src->ipv4, bytelen);
if (rta->rta_len > RTA_LENGTH (0))
- addattr_l (&req.n, 1024, RTA_MULTIPATH, RTA_DATA (rta),
+ addattr_l (&req.n, NL_PKT_BUF_SIZE, RTA_MULTIPATH, RTA_DATA (rta),
RTA_PAYLOAD (rta));
}
@@ -1897,7 +1899,7 @@
{
struct nlmsghdr n;
struct ifaddrmsg ifa;
- char buf[1024];
+ char buf[NL_PKT_BUF_SIZE];
} req;
p = ifc->address;