]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: no need to clear memory of the netlink buffers
authorJorge Boncompte [DTI2] <jorge@dti2.net>
Fri, 20 Apr 2012 12:28:40 +0000 (14:28 +0200)
committerDavid Lamparter <equinox@diac24.net>
Wed, 2 May 2012 15:03:34 +0000 (17:03 +0200)
The memory is always written before sending. Clearing it before use
slows netlink_route_multipath() down considerably and it's pretty
noticeable in a full-internet table scenario loading.

  * zebra/rt_netlink.c: subtract bulk buffer size from clear

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
zebra/rt_netlink.c

index 5909131ddbc2e55f3dcdf63e5e46b8b7134d4911..15475e2056d021b56fe5cb185e7257deb41ed1cc 100644 (file)
@@ -1368,7 +1368,7 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
     char buf[NL_PKT_BUF_SIZE];
   } req;
 
-  memset (&req, 0, sizeof req);
+  memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE);
 
   bytelen = (family == AF_INET ? 4 : 16);
 
@@ -1443,7 +1443,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
     char buf[NL_PKT_BUF_SIZE];
   } req;
 
-  memset (&req, 0, sizeof req);
+  memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE);
 
   bytelen = (family == AF_INET ? 4 : 16);
 
@@ -1903,7 +1903,7 @@ netlink_address (int cmd, int family, struct interface *ifp,
   } req;
 
   p = ifc->address;
-  memset (&req, 0, sizeof req);
+  memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE);
 
   bytelen = (family == AF_INET ? 4 : 16);