aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-04-26 02:22:19 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-04-26 02:22:19 +0000
commitfbf0b8af41eb2662c40d0fb932ae85c01ea0743e (patch)
treecb195f87e401bf7356964a4ca1998143a9845d8e /networking
parent86f2cce6bfc6d86da47c090c06c294410818632b (diff)
downloadbusybox-fbf0b8af41eb2662c40d0fb932ae85c01ea0743e.tar.gz
iPatch from waldi, fixes usage of ip route flush (from)? (match|exact)
Diffstat (limited to 'networking')
-rw-r--r--networking/libiproute/iproute.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 3dcafdb6f..70ddf9f41 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -72,6 +72,8 @@ static int print_route(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
int len = n->nlmsg_len;
struct rtattr * tb[RTA_MAX+1];
char abuf[256];
+ inet_prefix dst;
+ inet_prefix src;
int host_len = -1;
SPRINT_BUF(b1);
@@ -144,6 +146,18 @@ static int print_route(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);
+ if (filter.rdst.family && inet_addr_match(&dst, &filter.rdst, filter.rdst.bitlen))
+ return 0;
+ if (filter.mdst.family && filter.mdst.bitlen >= 0 &&
+ inet_addr_match(&dst, &filter.mdst, r->rtm_dst_len))
+ return 0;
+
+ if (filter.rsrc.family && inet_addr_match(&src, &filter.rsrc, filter.rsrc.bitlen))
+ return 0;
+ if (filter.msrc.family && filter.msrc.bitlen >= 0 &&
+ inet_addr_match(&src, &filter.msrc, r->rtm_src_len))
+ return 0;
+
if (filter.flushb &&
r->rtm_family == AF_INET6 &&
r->rtm_dst_len == 0 &&