mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 06:50:17 +00:00
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.
This commit is contained in:
parent
d75318cc8d
commit
3cadc0cdeb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user