ipv4: Elide fib_validate_source() completely when possible.
If rpfilter is off (or the SKB has an IPSEC path) and there are not tclassid users, we don't have to do anything at all when fib_validate_source() is invoked besides setting the itag to zero. We monitor tclassid uses with a counter (modified only under RTNL and marked __read_mostly) and we protect the fib_validate_source() real work with a test against this counter and whether rpfilter is to be done. Having a way to know whether we need no tclassid processing or not also opens the door for future optimized rpfilter algorithms that do not perform full FIB lookups. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -235,6 +235,11 @@ extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
|
||||
u8 tos, int oif, struct net_device *dev,
|
||||
struct in_device *idev, u32 *itag);
|
||||
extern void fib_select_default(struct fib_result *res);
|
||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||
extern int fib_num_tclassid_users;
|
||||
#else
|
||||
#define fib_num_tclassid_users 0
|
||||
#endif
|
||||
|
||||
/* Exported by fib_semantics.c */
|
||||
extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
|
||||
|
Reference in New Issue
Block a user