summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
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;