From: Jorge Boncompte [DTI2] Date: Fri, 20 Apr 2012 12:28:40 +0000 (+0200) Subject: zebra: no need to clear memory of the netlink buffers X-Git-Tag: frr-2.0-rc1~1832 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a4c06dec1ebe41dd4444d387478500e6022e2209;p=matthieu%2Ffrr.git zebra: no need to clear memory of the netlink buffers 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] [reworded commit message] Signed-off-by: David Lamparter --- diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 5909131ddb..15475e2056 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -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);