diff options
author | David S. Miller <davem@davemloft.net> | 2010-11-11 20:07:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-11 20:07:48 -0500 |
commit | c753796769e4fb0cd813b6e5801b3c01f4681d4f (patch) | |
tree | f137ec0b76593a2aa1a6a263bcc1e4cf82bdf7b5 /include/net | |
parent | ed1deb7021b4dfee1d544b91edff4ef92f5c3b54 (diff) |
ipv4: Make rt->fl.iif tests lest obscure.
When we test rt->fl.iif against zero, we're seeing if it's
an output or an input route.
Make that explicit with some helper functions.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/dn_route.h | 10 | ||||
-rw-r--r-- | include/net/route.h | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index ccadab3aa3f6..9b185df265fb 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -80,6 +80,16 @@ struct dn_route { | |||
80 | unsigned rt_type; | 80 | unsigned rt_type; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static inline bool dn_is_input_route(struct dn_route *rt) | ||
84 | { | ||
85 | return rt->fl.iif != 0; | ||
86 | } | ||
87 | |||
88 | static inline bool dn_is_output_route(struct dn_route *rt) | ||
89 | { | ||
90 | return rt->fl.iif == 0; | ||
91 | } | ||
92 | |||
83 | extern void dn_route_init(void); | 93 | extern void dn_route_init(void); |
84 | extern void dn_route_cleanup(void); | 94 | extern void dn_route_cleanup(void); |
85 | 95 | ||
diff --git a/include/net/route.h b/include/net/route.h index cea533eaa853..5cd46d1c0e14 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -71,6 +71,16 @@ struct rtable { | |||
71 | struct inet_peer *peer; /* long-living peer info */ | 71 | struct inet_peer *peer; /* long-living peer info */ |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static inline bool rt_is_input_route(struct rtable *rt) | ||
75 | { | ||
76 | return rt->fl.iif != 0; | ||
77 | } | ||
78 | |||
79 | static inline bool rt_is_output_route(struct rtable *rt) | ||
80 | { | ||
81 | return rt->fl.iif == 0; | ||
82 | } | ||
83 | |||
74 | struct ip_rt_acct { | 84 | struct ip_rt_acct { |
75 | __u32 o_bytes; | 85 | __u32 o_bytes; |
76 | __u32 o_packets; | 86 | __u32 o_packets; |