aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/iproute.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-26 11:03:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-26 11:03:16 +0100
commitffc4bced958e5746e736c9939c4d1de665e1cffa (patch)
treec7a7ab6a672431d3d77e4dd93cfab36b9b2d17bc /networking/libiproute/iproute.c
parente83877942982ee642287b098fe93b70c0802d087 (diff)
downloadbusybox-w32-ffc4bced958e5746e736c9939c4d1de665e1cffa.tar.gz
busybox-w32-ffc4bced958e5746e736c9939c4d1de665e1cffa.tar.bz2
busybox-w32-ffc4bced958e5746e736c9939c4d1de665e1cffa.zip
libiproute: eliminate unused fields in struct filter_t's; style fixes
function old new delta print_route 1603 1588 -15 iproute_list_or_flush 1254 1230 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/libiproute/iproute.c')
-rw-r--r--networking/libiproute/iproute.c182
1 files changed, 98 insertions, 84 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 67eb90b84..c4b3450dd 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -29,14 +29,15 @@ typedef struct filter_t {
29 int flushp; 29 int flushp;
30 int flushe; 30 int flushe;
31 struct rtnl_handle *rth; 31 struct rtnl_handle *rth;
32 int protocol, protocolmask; 32 //int protocol, protocolmask; - write-only fields?!
33 int scope, scopemask; 33 //int scope, scopemask; - unused
34 int type, typemask; 34 //int type; - read-only
35 int tos, tosmask; 35 //int typemask; - unused
36 //int tos, tosmask; - unused
36 int iif, iifmask; 37 int iif, iifmask;
37 int oif, oifmask; 38 int oif, oifmask;
38 int realm, realmmask; 39 //int realm, realmmask; - unused
39 inet_prefix rprefsrc; 40 //inet_prefix rprefsrc; - read-only
40 inet_prefix rvia; 41 inet_prefix rvia;
41 inet_prefix rdst; 42 inet_prefix rdst;
42 inet_prefix mdst; 43 inet_prefix mdst;
@@ -44,15 +45,15 @@ typedef struct filter_t {
44 inet_prefix msrc; 45 inet_prefix msrc;
45} filter_t; 46} filter_t;
46 47
47#define filter (*(filter_t*)&bb_common_bufsiz1) 48#define G_filter (*(filter_t*)&bb_common_bufsiz1)
48 49
49static int flush_update(void) 50static int flush_update(void)
50{ 51{
51 if (rtnl_send(filter.rth, filter.flushb, filter.flushp) < 0) { 52 if (rtnl_send(G_filter.rth, G_filter.flushb, G_filter.flushp) < 0) {
52 bb_perror_msg("failed to send flush request"); 53 bb_perror_msg("failed to send flush request");
53 return -1; 54 return -1;
54 } 55 }
55 filter.flushp = 0; 56 G_filter.flushp = 0;
56 return 0; 57 return 0;
57} 58}
58 59
@@ -95,7 +96,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
95 n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags); 96 n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
96 return 0; 97 return 0;
97 } 98 }
98 if (filter.flushb && n->nlmsg_type != RTM_NEWROUTE) 99 if (G_filter.flushb && n->nlmsg_type != RTM_NEWROUTE)
99 return 0; 100 return 0;
100 len -= NLMSG_LENGTH(sizeof(*r)); 101 len -= NLMSG_LENGTH(sizeof(*r));
101 if (len < 0) 102 if (len < 0)
@@ -107,8 +108,8 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
107 host_len = 32; 108 host_len = 32;
108 109
109 if (r->rtm_family == AF_INET6) { 110 if (r->rtm_family == AF_INET6) {
110 if (filter.tb) { 111 if (G_filter.tb) {
111 if (filter.tb < 0) { 112 if (G_filter.tb < 0) {
112 if (!(r->rtm_flags & RTM_F_CLONED)) { 113 if (!(r->rtm_flags & RTM_F_CLONED)) {
113 return 0; 114 return 0;
114 } 115 }
@@ -116,11 +117,11 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
116 if (r->rtm_flags & RTM_F_CLONED) { 117 if (r->rtm_flags & RTM_F_CLONED) {
117 return 0; 118 return 0;
118 } 119 }
119 if (filter.tb == RT_TABLE_LOCAL) { 120 if (G_filter.tb == RT_TABLE_LOCAL) {
120 if (r->rtm_type != RTN_LOCAL) { 121 if (r->rtm_type != RTN_LOCAL) {
121 return 0; 122 return 0;
122 } 123 }
123 } else if (filter.tb == RT_TABLE_MAIN) { 124 } else if (G_filter.tb == RT_TABLE_MAIN) {
124 if (r->rtm_type == RTN_LOCAL) { 125 if (r->rtm_type == RTN_LOCAL) {
125 return 0; 126 return 0;
126 } 127 }
@@ -130,72 +131,82 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
130 } 131 }
131 } 132 }
132 } else { 133 } else {
133 if (filter.tb > 0 && filter.tb != r->rtm_table) { 134 if (G_filter.tb > 0 && G_filter.tb != r->rtm_table) {
134 return 0; 135 return 0;
135 } 136 }
136 } 137 }
137 if (filter.rdst.family && 138 if (G_filter.rdst.family
138 (r->rtm_family != filter.rdst.family || filter.rdst.bitlen > r->rtm_dst_len)) { 139 && (r->rtm_family != G_filter.rdst.family || G_filter.rdst.bitlen > r->rtm_dst_len)
140 ) {
139 return 0; 141 return 0;
140 } 142 }
141 if (filter.mdst.family && 143 if (G_filter.mdst.family
142 (r->rtm_family != filter.mdst.family || 144 && (r->rtm_family != G_filter.mdst.family
143 (filter.mdst.bitlen >= 0 && filter.mdst.bitlen < r->rtm_dst_len))) { 145 || (G_filter.mdst.bitlen >= 0 && G_filter.mdst.bitlen < r->rtm_dst_len)
146 )
147 ) {
144 return 0; 148 return 0;
145 } 149 }
146 if (filter.rsrc.family && 150 if (G_filter.rsrc.family
147 (r->rtm_family != filter.rsrc.family || filter.rsrc.bitlen > r->rtm_src_len)) { 151 && (r->rtm_family != G_filter.rsrc.family || G_filter.rsrc.bitlen > r->rtm_src_len)
152 ) {
148 return 0; 153 return 0;
149 } 154 }
150 if (filter.msrc.family && 155 if (G_filter.msrc.family
151 (r->rtm_family != filter.msrc.family || 156 && (r->rtm_family != G_filter.msrc.family
152 (filter.msrc.bitlen >= 0 && filter.msrc.bitlen < r->rtm_src_len))) { 157 || (G_filter.msrc.bitlen >= 0 && G_filter.msrc.bitlen < r->rtm_src_len)
158 )
159 ) {
153 return 0; 160 return 0;
154 } 161 }
155 162
156 memset(tb, 0, sizeof(tb)); 163 memset(tb, 0, sizeof(tb));
157 parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); 164 parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);
158 165
159 if (filter.rdst.family && inet_addr_match(&dst, &filter.rdst, filter.rdst.bitlen)) 166 if (G_filter.rdst.family && inet_addr_match(&dst, &G_filter.rdst, G_filter.rdst.bitlen))
160 return 0; 167 return 0;
161 if (filter.mdst.family && filter.mdst.bitlen >= 0 && 168 if (G_filter.mdst.family && G_filter.mdst.bitlen >= 0 &&
162 inet_addr_match(&dst, &filter.mdst, r->rtm_dst_len)) 169 inet_addr_match(&dst, &G_filter.mdst, r->rtm_dst_len))
163 return 0; 170 return 0;
164 171
165 if (filter.rsrc.family && inet_addr_match(&src, &filter.rsrc, filter.rsrc.bitlen)) 172 if (G_filter.rsrc.family && inet_addr_match(&src, &G_filter.rsrc, G_filter.rsrc.bitlen))
166 return 0; 173 return 0;
167 if (filter.msrc.family && filter.msrc.bitlen >= 0 && 174 if (G_filter.msrc.family && G_filter.msrc.bitlen >= 0
168 inet_addr_match(&src, &filter.msrc, r->rtm_src_len)) 175 && inet_addr_match(&src, &G_filter.msrc, r->rtm_src_len)
176 ) {
169 return 0; 177 return 0;
178 }
170 179
171 if (filter.flushb && 180 if (G_filter.flushb
172 r->rtm_family == AF_INET6 && 181 && r->rtm_family == AF_INET6
173 r->rtm_dst_len == 0 && 182 && r->rtm_dst_len == 0
174 r->rtm_type == RTN_UNREACHABLE && 183 && r->rtm_type == RTN_UNREACHABLE
175 tb[RTA_PRIORITY] && 184 && tb[RTA_PRIORITY]
176 *(int*)RTA_DATA(tb[RTA_PRIORITY]) == -1) 185 && *(int*)RTA_DATA(tb[RTA_PRIORITY]) == -1
186 ) {
177 return 0; 187 return 0;
188 }
178 189
179 if (filter.flushb) { 190 if (G_filter.flushb) {
180 struct nlmsghdr *fn; 191 struct nlmsghdr *fn;
181 if (NLMSG_ALIGN(filter.flushp) + n->nlmsg_len > filter.flushe) { 192 if (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len > G_filter.flushe) {
182 if (flush_update()) 193 if (flush_update())
183 bb_error_msg_and_die("flush"); 194 bb_error_msg_and_die("flush");
184 } 195 }
185 fn = (struct nlmsghdr*)(filter.flushb + NLMSG_ALIGN(filter.flushp)); 196 fn = (struct nlmsghdr*)(G_filter.flushb + NLMSG_ALIGN(G_filter.flushp));
186 memcpy(fn, n, n->nlmsg_len); 197 memcpy(fn, n, n->nlmsg_len);
187 fn->nlmsg_type = RTM_DELROUTE; 198 fn->nlmsg_type = RTM_DELROUTE;
188 fn->nlmsg_flags = NLM_F_REQUEST; 199 fn->nlmsg_flags = NLM_F_REQUEST;
189 fn->nlmsg_seq = ++filter.rth->seq; 200 fn->nlmsg_seq = ++G_filter.rth->seq;
190 filter.flushp = (((char*)fn) + n->nlmsg_len) - filter.flushb; 201 G_filter.flushp = (((char*)fn) + n->nlmsg_len) - G_filter.flushb;
191 filter.flushed = 1; 202 G_filter.flushed = 1;
192 return 0; 203 return 0;
193 } 204 }
194 205
195 if (n->nlmsg_type == RTM_DELROUTE) { 206 if (n->nlmsg_type == RTM_DELROUTE) {
196 printf("Deleted "); 207 printf("Deleted ");
197 } 208 }
198 if (r->rtm_type != RTN_UNICAST && !filter.type) { 209 if (r->rtm_type != RTN_UNICAST /* && !G_filter.type - always 0 */) {
199 printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1)); 210 printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1));
200 } 211 }
201 212
@@ -235,17 +246,17 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
235 } else if (r->rtm_src_len) { 246 } else if (r->rtm_src_len) {
236 printf("from 0/%u ", r->rtm_src_len); 247 printf("from 0/%u ", r->rtm_src_len);
237 } 248 }
238 if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) { 249 if (tb[RTA_GATEWAY] && G_filter.rvia.bitlen != host_len) {
239 printf("via %s ", format_host(r->rtm_family, 250 printf("via %s ", format_host(r->rtm_family,
240 RTA_PAYLOAD(tb[RTA_GATEWAY]), 251 RTA_PAYLOAD(tb[RTA_GATEWAY]),
241 RTA_DATA(tb[RTA_GATEWAY]), 252 RTA_DATA(tb[RTA_GATEWAY]),
242 abuf, sizeof(abuf))); 253 abuf, sizeof(abuf)));
243 } 254 }
244 if (tb[RTA_OIF] && filter.oifmask != -1) { 255 if (tb[RTA_OIF] && G_filter.oifmask != -1) {
245 printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); 256 printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF])));
246 } 257 }
247 258
248 if (tb[RTA_PREFSRC] && filter.rprefsrc.bitlen != host_len) { 259 if (tb[RTA_PREFSRC] && /*G_filter.rprefsrc.bitlen - always 0*/ 0 != host_len) {
249 /* Do not use format_host(). It is our local addr 260 /* Do not use format_host(). It is our local addr
250 and symbolic name will not be useful. 261 and symbolic name will not be useful.
251 */ 262 */
@@ -276,7 +287,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
276 printf(" error %d", ci->rta_error); 287 printf(" error %d", ci->rta_error);
277 } 288 }
278 } 289 }
279 if (tb[RTA_IIF] && filter.iifmask != -1) { 290 if (tb[RTA_IIF] && G_filter.iifmask != -1) {
280 printf(" iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); 291 printf(" iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF])));
281 } 292 }
282 bb_putchar('\n'); 293 bb_putchar('\n');
@@ -441,10 +452,13 @@ IF_FEATURE_IP_RULE(ARG_table,)
441 452
442 if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT) 453 if (req.r.rtm_type == RTN_LOCAL || req.r.rtm_type == RTN_NAT)
443 req.r.rtm_scope = RT_SCOPE_HOST; 454 req.r.rtm_scope = RT_SCOPE_HOST;
444 else if (req.r.rtm_type == RTN_BROADCAST || 455 else
445 req.r.rtm_type == RTN_MULTICAST || 456 if (req.r.rtm_type == RTN_BROADCAST
446 req.r.rtm_type == RTN_ANYCAST) 457 || req.r.rtm_type == RTN_MULTICAST
458 || req.r.rtm_type == RTN_ANYCAST
459 ) {
447 req.r.rtm_scope = RT_SCOPE_LINK; 460 req.r.rtm_scope = RT_SCOPE_LINK;
461 }
448 else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) { 462 else if (req.r.rtm_type == RTN_UNICAST || req.r.rtm_type == RTN_UNSPEC) {
449 if (cmd == RTM_DELROUTE) 463 if (cmd == RTM_DELROUTE)
450 req.r.rtm_scope = RT_SCOPE_NOWHERE; 464 req.r.rtm_scope = RT_SCOPE_NOWHERE;
@@ -507,9 +521,9 @@ static void iproute_flush_cache(void)
507 521
508static void iproute_reset_filter(void) 522static void iproute_reset_filter(void)
509{ 523{
510 memset(&filter, 0, sizeof(filter)); 524 memset(&G_filter, 0, sizeof(G_filter));
511 filter.mdst.bitlen = -1; 525 G_filter.mdst.bitlen = -1;
512 filter.msrc.bitlen = -1; 526 G_filter.msrc.bitlen = -1;
513} 527}
514 528
515/* Return value becomes exitcode. It's okay to not return at all */ 529/* Return value becomes exitcode. It's okay to not return at all */
@@ -545,7 +559,7 @@ static int iproute_list_or_flush(char **argv, int flush)
545 int arg, parm; 559 int arg, parm;
546 560
547 iproute_reset_filter(); 561 iproute_reset_filter();
548 filter.tb = RT_TABLE_MAIN; 562 G_filter.tb = RT_TABLE_MAIN;
549 563
550 if (flush && !*argv) 564 if (flush && !*argv)
551 bb_error_msg_and_die(bb_msg_requires_arg, "\"ip route flush\""); 565 bb_error_msg_and_die(bb_msg_requires_arg, "\"ip route flush\"");
@@ -555,14 +569,14 @@ static int iproute_list_or_flush(char **argv, int flush)
555 if (arg == KW_proto) { 569 if (arg == KW_proto) {
556 uint32_t prot = 0; 570 uint32_t prot = 0;
557 NEXT_ARG(); 571 NEXT_ARG();
558 filter.protocolmask = -1; 572 //G_filter.protocolmask = -1;
559 if (rtnl_rtprot_a2n(&prot, *argv)) { 573 if (rtnl_rtprot_a2n(&prot, *argv)) {
560 if (index_in_strings(keywords, *argv) != KW_all) 574 if (index_in_strings(keywords, *argv) != KW_all)
561 invarg(*argv, "protocol"); 575 invarg(*argv, "protocol");
562 prot = 0; 576 prot = 0;
563 filter.protocolmask = 0; 577 //G_filter.protocolmask = 0;
564 } 578 }
565 filter.protocol = prot; 579 //G_filter.protocol = prot;
566 } else if (arg == KW_dev || arg == KW_oif) { 580 } else if (arg == KW_dev || arg == KW_oif) {
567 NEXT_ARG(); 581 NEXT_ARG();
568 od = *argv; 582 od = *argv;
@@ -571,20 +585,20 @@ static int iproute_list_or_flush(char **argv, int flush)
571 id = *argv; 585 id = *argv;
572 } else if (arg == KW_via) { 586 } else if (arg == KW_via) {
573 NEXT_ARG(); 587 NEXT_ARG();
574 get_prefix(&filter.rvia, *argv, do_ipv6); 588 get_prefix(&G_filter.rvia, *argv, do_ipv6);
575 } else if (arg == KW_table) { /* table all/cache/main */ 589 } else if (arg == KW_table) { /* table all/cache/main */
576 NEXT_ARG(); 590 NEXT_ARG();
577 parm = index_in_substrings(keywords, *argv); 591 parm = index_in_substrings(keywords, *argv);
578 if (parm == KW_cache) 592 if (parm == KW_cache)
579 filter.tb = -1; 593 G_filter.tb = -1;
580 else if (parm == KW_all) 594 else if (parm == KW_all)
581 filter.tb = 0; 595 G_filter.tb = 0;
582 else if (parm != KW_main) { 596 else if (parm != KW_main) {
583#if ENABLE_FEATURE_IP_RULE 597#if ENABLE_FEATURE_IP_RULE
584 uint32_t tid; 598 uint32_t tid;
585 if (rtnl_rttable_a2n(&tid, *argv)) 599 if (rtnl_rttable_a2n(&tid, *argv))
586 invarg(*argv, "table"); 600 invarg(*argv, "table");
587 filter.tb = tid; 601 G_filter.tb = tid;
588#else 602#else
589 invarg(*argv, "table"); 603 invarg(*argv, "table");
590#endif 604#endif
@@ -592,21 +606,21 @@ static int iproute_list_or_flush(char **argv, int flush)
592 } else if (arg == KW_cache) { 606 } else if (arg == KW_cache) {
593 /* The command 'ip route flush cache' is used by OpenSWAN. 607 /* The command 'ip route flush cache' is used by OpenSWAN.
594 * Assuming it's a synonym for 'ip route flush table cache' */ 608 * Assuming it's a synonym for 'ip route flush table cache' */
595 filter.tb = -1; 609 G_filter.tb = -1;
596 } else if (arg == KW_from) { 610 } else if (arg == KW_from) {
597 NEXT_ARG(); 611 NEXT_ARG();
598 parm = index_in_substrings(keywords, *argv); 612 parm = index_in_substrings(keywords, *argv);
599 if (parm == KW_root) { 613 if (parm == KW_root) {
600 NEXT_ARG(); 614 NEXT_ARG();
601 get_prefix(&filter.rsrc, *argv, do_ipv6); 615 get_prefix(&G_filter.rsrc, *argv, do_ipv6);
602 } else if (parm == KW_match) { 616 } else if (parm == KW_match) {
603 NEXT_ARG(); 617 NEXT_ARG();
604 get_prefix(&filter.msrc, *argv, do_ipv6); 618 get_prefix(&G_filter.msrc, *argv, do_ipv6);
605 } else { 619 } else {
606 if (parm == KW_exact) 620 if (parm == KW_exact)
607 NEXT_ARG(); 621 NEXT_ARG();
608 get_prefix(&filter.msrc, *argv, do_ipv6); 622 get_prefix(&G_filter.msrc, *argv, do_ipv6);
609 filter.rsrc = filter.msrc; 623 G_filter.rsrc = G_filter.msrc;
610 } 624 }
611 } else { /* "to" is the default parameter */ 625 } else { /* "to" is the default parameter */
612 if (arg == KW_to) { 626 if (arg == KW_to) {
@@ -616,21 +630,21 @@ static int iproute_list_or_flush(char **argv, int flush)
616 /* parm = arg; - would be more plausible, but we reuse 'arg' here */ 630 /* parm = arg; - would be more plausible, but we reuse 'arg' here */
617 if (arg == KW_root) { 631 if (arg == KW_root) {
618 NEXT_ARG(); 632 NEXT_ARG();
619 get_prefix(&filter.rdst, *argv, do_ipv6); 633 get_prefix(&G_filter.rdst, *argv, do_ipv6);
620 } else if (arg == KW_match) { 634 } else if (arg == KW_match) {
621 NEXT_ARG(); 635 NEXT_ARG();
622 get_prefix(&filter.mdst, *argv, do_ipv6); 636 get_prefix(&G_filter.mdst, *argv, do_ipv6);
623 } else { /* "to exact" is the default */ 637 } else { /* "to exact" is the default */
624 if (arg == KW_exact) 638 if (arg == KW_exact)
625 NEXT_ARG(); 639 NEXT_ARG();
626 get_prefix(&filter.mdst, *argv, do_ipv6); 640 get_prefix(&G_filter.mdst, *argv, do_ipv6);
627 filter.rdst = filter.mdst; 641 G_filter.rdst = G_filter.mdst;
628 } 642 }
629 } 643 }
630 argv++; 644 argv++;
631 } 645 }
632 646
633 if (do_ipv6 == AF_UNSPEC && filter.tb) { 647 if (do_ipv6 == AF_UNSPEC && G_filter.tb) {
634 do_ipv6 = AF_INET; 648 do_ipv6 = AF_INET;
635 } 649 }
636 650
@@ -642,43 +656,43 @@ static int iproute_list_or_flush(char **argv, int flush)
642 656
643 if (id) { 657 if (id) {
644 idx = xll_name_to_index(id); 658 idx = xll_name_to_index(id);
645 filter.iif = idx; 659 G_filter.iif = idx;
646 filter.iifmask = -1; 660 G_filter.iifmask = -1;
647 } 661 }
648 if (od) { 662 if (od) {
649 idx = xll_name_to_index(od); 663 idx = xll_name_to_index(od);
650 filter.oif = idx; 664 G_filter.oif = idx;
651 filter.oifmask = -1; 665 G_filter.oifmask = -1;
652 } 666 }
653 } 667 }
654 668
655 if (flush) { 669 if (flush) {
656 char flushb[4096-512]; 670 char flushb[4096-512];
657 671
658 if (filter.tb == -1) { /* "flush table cache" */ 672 if (G_filter.tb == -1) { /* "flush table cache" */
659 if (do_ipv6 != AF_INET6) 673 if (do_ipv6 != AF_INET6)
660 iproute_flush_cache(); 674 iproute_flush_cache();
661 if (do_ipv6 == AF_INET) 675 if (do_ipv6 == AF_INET)
662 return 0; 676 return 0;
663 } 677 }
664 678
665 filter.flushb = flushb; 679 G_filter.flushb = flushb;
666 filter.flushp = 0; 680 G_filter.flushp = 0;
667 filter.flushe = sizeof(flushb); 681 G_filter.flushe = sizeof(flushb);
668 filter.rth = &rth; 682 G_filter.rth = &rth;
669 683
670 for (;;) { 684 for (;;) {
671 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); 685 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);
672 filter.flushed = 0; 686 G_filter.flushed = 0;
673 xrtnl_dump_filter(&rth, print_route, NULL); 687 xrtnl_dump_filter(&rth, print_route, NULL);
674 if (filter.flushed == 0) 688 if (G_filter.flushed == 0)
675 return 0; 689 return 0;
676 if (flush_update()) 690 if (flush_update())
677 return 1; 691 return 1;
678 } 692 }
679 } 693 }
680 694
681 if (filter.tb != -1) { 695 if (G_filter.tb != -1) {
682 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE); 696 xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);
683 } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { 697 } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
684 bb_perror_msg_and_die("can't send dump request"); 698 bb_perror_msg_and_die("can't send dump request");