diff options
author | David S. Miller <davem@davemloft.net> | 2010-12-13 00:55:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-13 01:08:17 -0500 |
commit | 323e126f0c5995f779d7df7fd035f6e8fed8764d (patch) | |
tree | 402c7267a45ae488363bb1ef8e4c786b65b82572 /include/net | |
parent | a02e4b7dae455151c423e2f69ef222c502a321fd (diff) |
ipv4: Don't pre-seed hoplimit metric.
Always go through a new ip4_dst_hoplimit() helper, just like ipv6.
This allowed several simplifications:
1) The interim dst_metric_hoplimit() can go as it's no longer
userd.
2) The sysctl_ip_default_ttl entry no longer needs to use
ipv4_doint_and_flush, since the sysctl is not cached in
routing cache metrics any longer.
3) ipv4_doint_and_flush no longer needs to be exported and
therefore can be marked static.
When ipv4_doint_and_flush_strategy was removed some time ago,
the external declaration in ip.h was mistakenly left around
so kill that off too.
We have to move the sysctl_ip_default_ttl declaration into
ipv4's route cache definition header net/route.h, because
currently net/ip.h (where the declaration lives now) has
a back dependency on net/route.h
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/dst.h | 6 | ||||
-rw-r--r-- | include/net/ip.h | 10 | ||||
-rw-r--r-- | include/net/route.h | 11 |
3 files changed, 11 insertions, 16 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 9208b500aaaf..755ac6c1aa03 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -116,12 +116,6 @@ dst_metric(const struct dst_entry *dst, const int metric) | |||
116 | return dst_metric_raw(dst, metric); | 116 | return dst_metric_raw(dst, metric); |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline u32 | ||
120 | dst_metric_hoplimit(const struct dst_entry *dst) | ||
121 | { | ||
122 | return dst_metric_raw(dst, RTAX_HOPLIMIT); | ||
123 | } | ||
124 | |||
125 | static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) | 119 | static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) |
126 | { | 120 | { |
127 | dst->_metrics[metric-1] = val; | 121 | dst->_metrics[metric-1] = val; |
diff --git a/include/net/ip.h b/include/net/ip.h index 86e2b182a0c0..67fac78a186b 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -201,7 +201,6 @@ static inline int inet_is_reserved_local_port(int port) | |||
201 | return test_bit(port, sysctl_local_reserved_ports); | 201 | return test_bit(port, sysctl_local_reserved_ports); |
202 | } | 202 | } |
203 | 203 | ||
204 | extern int sysctl_ip_default_ttl; | ||
205 | extern int sysctl_ip_nonlocal_bind; | 204 | extern int sysctl_ip_nonlocal_bind; |
206 | 205 | ||
207 | extern struct ctl_path net_core_path[]; | 206 | extern struct ctl_path net_core_path[]; |
@@ -428,15 +427,6 @@ extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | |||
428 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, | 427 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, |
429 | u32 info); | 428 | u32 info); |
430 | 429 | ||
431 | /* sysctl helpers - any sysctl which holds a value that ends up being | ||
432 | * fed into the routing cache should use these handlers. | ||
433 | */ | ||
434 | int ipv4_doint_and_flush(ctl_table *ctl, int write, | ||
435 | void __user *buffer, | ||
436 | size_t *lenp, loff_t *ppos); | ||
437 | int ipv4_doint_and_flush_strategy(ctl_table *table, | ||
438 | void __user *oldval, size_t __user *oldlenp, | ||
439 | void __user *newval, size_t newlen); | ||
440 | #ifdef CONFIG_PROC_FS | 430 | #ifdef CONFIG_PROC_FS |
441 | extern int ip_misc_proc_init(void); | 431 | extern int ip_misc_proc_init(void); |
442 | #endif | 432 | #endif |
diff --git a/include/net/route.h b/include/net/route.h index b8c1f7703fc6..27002362944a 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -231,4 +231,15 @@ static inline int inet_iif(const struct sk_buff *skb) | |||
231 | return skb_rtable(skb)->rt_iif; | 231 | return skb_rtable(skb)->rt_iif; |
232 | } | 232 | } |
233 | 233 | ||
234 | extern int sysctl_ip_default_ttl; | ||
235 | |||
236 | static inline int ip4_dst_hoplimit(const struct dst_entry *dst) | ||
237 | { | ||
238 | int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); | ||
239 | |||
240 | if (hoplimit == 0) | ||
241 | hoplimit = sysctl_ip_default_ttl; | ||
242 | return hoplimit; | ||
243 | } | ||
244 | |||
234 | #endif /* _ROUTE_H */ | 245 | #endif /* _ROUTE_H */ |