summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorJR Rivers <jrrivers@cumulusnetworks.com>2012-04-01 12:16:31 -0700
committerDavid Lamparter <equinox@diac24.net>2012-04-16 18:36:52 +0200
commit3cadc0cdebb8f8262b1c1fbb8bfcbcdc3baa3733 (patch)
tree3cc40be888ef151298db7c14d7ed0c66d54b5744 /zebra/rt_netlink.c
parentd75318cc8de91d94649106f4ea3122d0d21ac9eb (diff)
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.
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 73097bf6..5909131d 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 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
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 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
{
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
{
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
}
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
|| 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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
|| 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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
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 @@ netlink_address (int cmd, int family, struct interface *ifp,
{
struct nlmsghdr n;
struct ifaddrmsg ifa;
- char buf[1024];
+ char buf[NL_PKT_BUF_SIZE];
} req;
p = ifc->address;