aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/ipneigh.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-05-22 13:54:46 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-05-22 13:54:46 +0200
commit028c5aa18b5273c029f0278232d922ee1a164de6 (patch)
treef57dbcb9445ce4878f74789872ed123491f705c2 /networking/libiproute/ipneigh.c
parent84fc645605827d53aa3e749dfff309978b1bc73d (diff)
downloadbusybox-028c5aa18b5273c029f0278232d922ee1a164de6.tar.gz
ip: use rtnl_send_check() on flush commands, closes 6962
function old new delta rtnl_send_check - 160 +160 xrtnl_wilddump_request 64 66 +2 ipneigh_list_or_flush 714 706 -8 rtnl_send 69 - -69 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/1 up/down: 162/-77) Total: 85 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/libiproute/ipneigh.c')
-rw-r--r--networking/libiproute/ipneigh.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/networking/libiproute/ipneigh.c b/networking/libiproute/ipneigh.c
index f572414e9..984dd4bdd 100644
--- a/networking/libiproute/ipneigh.c
+++ b/networking/libiproute/ipneigh.c
@@ -32,7 +32,10 @@ struct filter_t {
int state;
int unused_only;
inet_prefix pfx;
+ /* Misnomer. Does not mean "flushed N something" */
+ /* More like "no_of_flush_commands_constructed_by_print_neigh()" */
int flushed;
+ /* Flush cmd buf. If !NULL, print_neigh() constructs flush commands in it */
char *flushb;
int flushp;
int flushe;
@@ -45,7 +48,7 @@ typedef struct filter_t filter_t;
static int flush_update(void)
{
- if (rtnl_send(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
+ if (rtnl_send_check(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
bb_perror_msg("can't send flush request");
return -1;
}
@@ -299,9 +302,7 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
G_filter.rth = &rth;
while (round < MAX_ROUNDS) {
- if (xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH) < 0) {
- bb_perror_msg_and_die("can't send dump request");
- }
+ xrtnl_wilddump_request(&rth, G_filter.family, RTM_GETNEIGH);
G_filter.flushed = 0;
if (xrtnl_dump_filter(&rth, print_neigh, NULL) < 0) {
bb_perror_msg_and_die("flush terminated");