diff options
author | Cong Wang <amwang@redhat.com> | 2013-08-31 01:44:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-31 22:29:59 -0400 |
commit | 3ce9b35ff6de8dfebb0b0045e667c000f632e563 (patch) | |
tree | ecde35b0c857ba52ef90724bf12f037f52ab4957 | |
parent | ae5dbf1ad83cb90921a400d15fb18afae66e1e56 (diff) |
ipv6: move ip6_dst_hoplimit() into core kernel
It will be used by vxlan, and may not be inlined.
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip6_route.h | 2 | ||||
-rw-r--r-- | include/net/ipv6.h | 2 | ||||
-rw-r--r-- | net/ipv6/output_core.c | 22 | ||||
-rw-r--r-- | net/ipv6/route.c | 19 |
4 files changed, 24 insertions, 21 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index f667248202b6..f525e7038cca 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -112,8 +112,6 @@ extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
112 | const struct in6_addr *addr, | 112 | const struct in6_addr *addr, |
113 | bool anycast); | 113 | bool anycast); |
114 | 114 | ||
115 | extern int ip6_dst_hoplimit(struct dst_entry *dst); | ||
116 | |||
117 | /* | 115 | /* |
118 | * support functions for ND | 116 | * support functions for ND |
119 | * | 117 | * |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 7bdff0455065..bbf1c8fb8511 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -658,6 +658,8 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
658 | 658 | ||
659 | extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); | 659 | extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); |
660 | 660 | ||
661 | extern int ip6_dst_hoplimit(struct dst_entry *dst); | ||
662 | |||
661 | /* | 663 | /* |
662 | * Header manipulation | 664 | * Header manipulation |
663 | */ | 665 | */ |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index ab92a3673fbb..53a062187db1 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/export.h> | 5 | #include <linux/export.h> |
6 | #include <net/ipv6.h> | 6 | #include <net/ipv6.h> |
7 | #include <net/ip6_fib.h> | 7 | #include <net/ip6_fib.h> |
8 | #include <net/addrconf.h> | ||
8 | 9 | ||
9 | void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) | 10 | void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) |
10 | { | 11 | { |
@@ -75,3 +76,24 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | |||
75 | return offset; | 76 | return offset; |
76 | } | 77 | } |
77 | EXPORT_SYMBOL(ip6_find_1stfragopt); | 78 | EXPORT_SYMBOL(ip6_find_1stfragopt); |
79 | |||
80 | #if IS_ENABLED(CONFIG_IPV6) | ||
81 | int ip6_dst_hoplimit(struct dst_entry *dst) | ||
82 | { | ||
83 | int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); | ||
84 | if (hoplimit == 0) { | ||
85 | struct net_device *dev = dst->dev; | ||
86 | struct inet6_dev *idev; | ||
87 | |||
88 | rcu_read_lock(); | ||
89 | idev = __in6_dev_get(dev); | ||
90 | if (idev) | ||
91 | hoplimit = idev->cnf.hop_limit; | ||
92 | else | ||
93 | hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit; | ||
94 | rcu_read_unlock(); | ||
95 | } | ||
96 | return hoplimit; | ||
97 | } | ||
98 | EXPORT_SYMBOL(ip6_dst_hoplimit); | ||
99 | #endif | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 55236a84c748..b770085ae36d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1354,25 +1354,6 @@ out: | |||
1354 | return entries > rt_max_size; | 1354 | return entries > rt_max_size; |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | int ip6_dst_hoplimit(struct dst_entry *dst) | ||
1358 | { | ||
1359 | int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); | ||
1360 | if (hoplimit == 0) { | ||
1361 | struct net_device *dev = dst->dev; | ||
1362 | struct inet6_dev *idev; | ||
1363 | |||
1364 | rcu_read_lock(); | ||
1365 | idev = __in6_dev_get(dev); | ||
1366 | if (idev) | ||
1367 | hoplimit = idev->cnf.hop_limit; | ||
1368 | else | ||
1369 | hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit; | ||
1370 | rcu_read_unlock(); | ||
1371 | } | ||
1372 | return hoplimit; | ||
1373 | } | ||
1374 | EXPORT_SYMBOL(ip6_dst_hoplimit); | ||
1375 | |||
1376 | /* | 1357 | /* |
1377 | * | 1358 | * |
1378 | */ | 1359 | */ |