[PATCH] libiproute: fix filtering ip6 route by table id

Yousong Zhou yszhou4tech at gmail.com
Sun Feb 12 04:30:20 UTC 2023


Otherwise

 - "ip -6 route show" shows routes from all tables
 - "ip -6 route show table 200" shows nothing

function                                             old     new   delta
print_route                                         1962    1941     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-21)             Total: -21 bytes

Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 networking/libiproute/iproute.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 5a972f8b2..cd77f642f 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -111,15 +111,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
 				if (r->rtm_flags & RTM_F_CLONED) {
 					return 0;
 				}
-				if (G_filter.tb == RT_TABLE_LOCAL) {
-					if (r->rtm_type != RTN_LOCAL) {
-						return 0;
-					}
-				} else if (G_filter.tb == RT_TABLE_MAIN) {
-					if (r->rtm_type == RTN_LOCAL) {
-						return 0;
-					}
-				} else {
+				if (G_filter.tb != tid) {
 					return 0;
 				}
 			}


More information about the busybox mailing list