Skip to content

Commit e824353

Browse files
shemmingerdavem330
authored andcommitted
ipv6: namespace cleanups
Running 'make namespacecheck' shows: net/ipv6/route.o ipv6_route_table_template rt6_bind_peer net/ipv6/icmp.o icmpv6_route_lookup ipv6_icmp_table_template This addresses some of those warnings by: * make icmpv6_route_lookup static * move inline's out of ip6_route.h since only used into route.c * move rt6_bind_peer into route.c Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1d143d9 commit e824353

File tree

4 files changed

+35
-43
lines changed

4 files changed

+35
-43
lines changed

include/net/ip6_route.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
5151
return (flags >> 3) & 7;
5252
}
5353

54-
void rt6_bind_peer(struct rt6_info *rt, int create);
55-
56-
static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
57-
{
58-
if (rt6_has_peer(rt))
59-
return rt6_peer_ptr(rt);
60-
61-
rt6_bind_peer(rt, create);
62-
return (rt6_has_peer(rt) ? rt6_peer_ptr(rt) : NULL);
63-
}
64-
65-
static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
66-
{
67-
return __rt6_get_peer(rt, 0);
68-
}
69-
70-
static inline struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
71-
{
72-
return __rt6_get_peer(rt, 1);
73-
}
7454

7555
void ip6_route_input(struct sk_buff *skb);
7656

include/net/ipv6.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
267267
int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
268268
struct icmp6hdr *thdr, int len);
269269

270-
struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
271-
struct sock *sk, struct flowi6 *fl6);
272-
273270
int ip6_ra_control(struct sock *sk, int sel);
274271

275272
int ipv6_parse_hopopts(struct sk_buff *skb);
@@ -839,7 +836,6 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
839836

840837
#ifdef CONFIG_SYSCTL
841838
extern struct ctl_table ipv6_route_table_template[];
842-
extern struct ctl_table ipv6_icmp_table_template[];
843839

844840
struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
845841
struct ctl_table *ipv6_route_sysctl_init(struct net *net);

net/ipv6/icmp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,10 @@ static void mip6_addr_swap(struct sk_buff *skb)
315315
static inline void mip6_addr_swap(struct sk_buff *skb) {}
316316
#endif
317317

318-
struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
319-
struct sock *sk, struct flowi6 *fl6)
318+
static struct dst_entry *icmpv6_route_lookup(struct net *net,
319+
struct sk_buff *skb,
320+
struct sock *sk,
321+
struct flowi6 *fl6)
320322
{
321323
struct dst_entry *dst, *dst2;
322324
struct flowi6 fl2;
@@ -984,7 +986,7 @@ int icmpv6_err_convert(u8 type, u8 code, int *err)
984986
EXPORT_SYMBOL(icmpv6_err_convert);
985987

986988
#ifdef CONFIG_SYSCTL
987-
struct ctl_table ipv6_icmp_table_template[] = {
989+
static struct ctl_table ipv6_icmp_table_template[] = {
988990
{
989991
.procname = "ratelimit",
990992
.data = &init_net.ipv6.sysctl.icmpv6_time,

net/ipv6/route.c

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,36 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
104104
const struct in6_addr *gwaddr, int ifindex);
105105
#endif
106106

107+
static void rt6_bind_peer(struct rt6_info *rt, int create)
108+
{
109+
struct inet_peer_base *base;
110+
struct inet_peer *peer;
111+
112+
base = inetpeer_base_ptr(rt->_rt6i_peer);
113+
if (!base)
114+
return;
115+
116+
peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
117+
if (peer) {
118+
if (!rt6_set_peer(rt, peer))
119+
inet_putpeer(peer);
120+
}
121+
}
122+
123+
static struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
124+
{
125+
if (rt6_has_peer(rt))
126+
return rt6_peer_ptr(rt);
127+
128+
rt6_bind_peer(rt, create);
129+
return (rt6_has_peer(rt) ? rt6_peer_ptr(rt) : NULL);
130+
}
131+
132+
static struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
133+
{
134+
return __rt6_get_peer(rt, 1);
135+
}
136+
107137
static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
108138
{
109139
struct rt6_info *rt = (struct rt6_info *) dst;
@@ -312,22 +342,6 @@ static void ip6_dst_destroy(struct dst_entry *dst)
312342
}
313343
}
314344

315-
void rt6_bind_peer(struct rt6_info *rt, int create)
316-
{
317-
struct inet_peer_base *base;
318-
struct inet_peer *peer;
319-
320-
base = inetpeer_base_ptr(rt->_rt6i_peer);
321-
if (!base)
322-
return;
323-
324-
peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
325-
if (peer) {
326-
if (!rt6_set_peer(rt, peer))
327-
inet_putpeer(peer);
328-
}
329-
}
330-
331345
static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
332346
int how)
333347
{

0 commit comments

Comments
 (0)