lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1346143938-17167-1-git-send-email-igorm@etf.rs>
Date:	Tue, 28 Aug 2012 10:52:17 +0200
From:	igorm@....rs
To:	netdev@...r.kernel.org
Cc:	davem@...emloft.net, Igor Maravic <igorm@....rs>
Subject: [PATCH net-next] net: ipv4: Optimize check_leaf function

From: Igor Maravic <igorm@....rs>

If the found tos is smaller then our tos,
don't pass through all the entries in fib_alias
list to find the match.
Directly jump to the last entry in the list, and check if the
tos value is 0.

Signed-off-by: Igor Maravic <igorm@....rs>
---
 net/ipv4/fib_trie.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 3c820da..ec45621 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1366,8 +1366,14 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
 			struct fib_info *fi = fa->fa_info;
 			int nhsel, err;
 
-			if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
-				continue;
+			if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) {
+				if (fa->fa_tos < flp->flowi4_tos) {
+					fa = list_entry_rcu(li->falh.prev, struct fib_alias, fa_list);
+					if (fa->fa_tos)
+						break;
+				} else
+					continue;
+			}
 			if (fi->fib_dead)
 				continue;
 			if (fa->fa_info->fib_scope < flp->flowi4_scope)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ