Commit c749c9cc authored by Adrian Bunk's avatar Adrian Bunk Committed by David S. Miller

[IPV6]: Misc cleanups.

- make some needlessly global code static
- remove the following unused functions:
  - exthdrs.c: ipv6_build_rthdr
  - exthdrs.c: ipv6_build_exthdr
  - exthdrs.c: ipv6_build_nfrag_opts
  - exthdrs.c: ipv6_build_frag_opts
- remove the following write-only global variables:
  - addrconf.c: inet6_dev_count
  - addrconf.c: inet6_ifa_count
- #if 0 the following unused global variable:
  - addrconf.c: in6addr_any
- remove the following unneeded EXPORT_SYMBOL's:
  - ipv6_syms.c: in6addr_any
  - ipv6_syms.c: in6addr_loopback
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b2185288
......@@ -44,8 +44,10 @@ struct in6_addr
* NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
* in network byte order, not in host byte order as are the IPv4 equivalents
*/
#if 0
extern const struct in6_addr in6addr_any;
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#endif
extern const struct in6_addr in6addr_loopback;
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
......
......@@ -112,7 +112,6 @@ extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex);
extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr);
extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr);
extern int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr);
......
......@@ -229,8 +229,6 @@ extern int ip6_ra_control(struct sock *sk, int sel,
void (*destructor)(struct sock *));
extern int ip6_call_ra_chain(struct sk_buff *skb, int sel);
extern int ipv6_parse_hopopts(struct sk_buff *skb, int);
extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
......
......@@ -99,9 +99,6 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
static void addrconf_sysctl_unregister(struct ipv6_devconf *p);
#endif
int inet6_dev_count;
int inet6_ifa_count;
#ifdef CONFIG_IPV6_PRIVACY
static int __ipv6_regen_rndid(struct inet6_dev *idev);
static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
......@@ -191,7 +188,9 @@ static struct ipv6_devconf ipv6_devconf_dflt = {
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
#if 0
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
#endif
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
int ipv6_addr_type(const struct in6_addr *addr)
......@@ -310,7 +309,6 @@ void in6_dev_finish_destroy(struct inet6_dev *idev)
return;
}
snmp6_unregister_dev(idev);
inet6_dev_count--;
kfree(idev);
}
......@@ -338,7 +336,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
kfree(ndev);
return NULL;
}
inet6_dev_count++;
/* We refer to the device */
dev_hold(dev);
......@@ -475,7 +472,6 @@ void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp)
}
dst_release(&ifp->rt->u.dst);
inet6_ifa_count--;
kfree(ifp);
}
......@@ -530,7 +526,6 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
ifa->flags = flags | IFA_F_TENTATIVE;
ifa->cstamp = ifa->tstamp = jiffies;
inet6_ifa_count++;
ifa->idev = idev;
in6_dev_hold(idev);
/* For caller */
......
......@@ -43,6 +43,8 @@
#include <net/checksum.h>
static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
/* Big ac list lock for all the sockets */
static DEFINE_RWLOCK(ipv6_sk_ac_lock);
......@@ -413,7 +415,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr)
return 0;
}
int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr)
{
int ret;
struct inet6_dev *idev = in6_dev_get(dev);
......
......@@ -501,83 +501,6 @@ int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff)
* for headers.
*/
static u8 *ipv6_build_rthdr(struct sk_buff *skb, u8 *prev_hdr,
struct ipv6_rt_hdr *opt, struct in6_addr *addr)
{
struct rt0_hdr *phdr, *ihdr;
int hops;
ihdr = (struct rt0_hdr *) opt;
phdr = (struct rt0_hdr *) skb_put(skb, (ihdr->rt_hdr.hdrlen + 1) << 3);
memcpy(phdr, ihdr, sizeof(struct rt0_hdr));
hops = ihdr->rt_hdr.hdrlen >> 1;
if (hops > 1)
memcpy(phdr->addr, ihdr->addr + 1,
(hops - 1) * sizeof(struct in6_addr));
ipv6_addr_copy(phdr->addr + (hops - 1), addr);
phdr->rt_hdr.nexthdr = *prev_hdr;
*prev_hdr = NEXTHDR_ROUTING;
return &phdr->rt_hdr.nexthdr;
}
static u8 *ipv6_build_exthdr(struct sk_buff *skb, u8 *prev_hdr, u8 type, struct ipv6_opt_hdr *opt)
{
struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb_put(skb, ipv6_optlen(opt));
memcpy(h, opt, ipv6_optlen(opt));
h->nexthdr = *prev_hdr;
*prev_hdr = type;
return &h->nexthdr;
}
u8 *ipv6_build_nfrag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt,
struct in6_addr *daddr, u32 jumbolen)
{
struct ipv6_opt_hdr *h = (struct ipv6_opt_hdr *)skb->data;
if (opt && opt->hopopt)
prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_HOP, opt->hopopt);
if (jumbolen) {
u8 *jumboopt = (u8 *)skb_put(skb, 8);
if (opt && opt->hopopt) {
*jumboopt++ = IPV6_TLV_PADN;
*jumboopt++ = 0;
h->hdrlen++;
} else {
h = (struct ipv6_opt_hdr *)jumboopt;
h->nexthdr = *prev_hdr;
h->hdrlen = 0;
jumboopt += 2;
*prev_hdr = NEXTHDR_HOP;
prev_hdr = &h->nexthdr;
}
jumboopt[0] = IPV6_TLV_JUMBO;
jumboopt[1] = 4;
*(u32*)(jumboopt+2) = htonl(jumbolen);
}
if (opt) {
if (opt->dst0opt)
prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst0opt);
if (opt->srcrt)
prev_hdr = ipv6_build_rthdr(skb, prev_hdr, opt->srcrt, daddr);
}
return prev_hdr;
}
u8 *ipv6_build_frag_opts(struct sk_buff *skb, u8 *prev_hdr, struct ipv6_txoptions *opt)
{
if (opt->dst1opt)
prev_hdr = ipv6_build_exthdr(skb, prev_hdr, NEXTHDR_DEST, opt->dst1opt);
return prev_hdr;
}
static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto,
struct ipv6_rt_hdr *opt,
struct in6_addr **addr_p)
......
......@@ -211,7 +211,7 @@ static __inline__ int opt_unrec(struct sk_buff *skb, __u32 offset)
return (*op & 0xC0) == 0x80;
}
int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
{
struct sk_buff *skb;
struct icmp6hdr *icmp6h;
......
......@@ -311,7 +311,7 @@ int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
return 0;
}
int ip6_call_ra_chain(struct sk_buff *skb, int sel)
static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
{
struct ip6_ra_chain *ra;
struct sock *last = NULL;
......
......@@ -32,8 +32,6 @@ EXPORT_SYMBOL(inet6_getname);
EXPORT_SYMBOL(inet6_ioctl);
EXPORT_SYMBOL(ipv6_get_saddr);
EXPORT_SYMBOL(ipv6_chk_addr);
EXPORT_SYMBOL(in6addr_any);
EXPORT_SYMBOL(in6addr_loopback);
EXPORT_SYMBOL(in6_dev_finish_destroy);
#ifdef CONFIG_XFRM
EXPORT_SYMBOL(xfrm6_rcv);
......
......@@ -121,7 +121,7 @@ struct mld2_query {
struct in6_addr srcs[0];
};
struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
static struct in6_addr mld2_all_mcr = MLD2_ALL_MCR_INIT;
/* Big mc list lock for all the sockets */
static DEFINE_RWLOCK(ipv6_sk_mc_lock);
......@@ -143,11 +143,13 @@ static void mld_clear_delrec(struct inet6_dev *idev);
static int sf_setstate(struct ifmcaddr6 *pmc);
static void sf_markstate(struct ifmcaddr6 *pmc);
static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
int sfcount, struct in6_addr *psfsrc, int delta);
int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
int sfcount, struct in6_addr *psfsrc, int delta);
int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
int sfmode, int sfcount, struct in6_addr *psfsrc,
int delta);
static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
int sfmode, int sfcount, struct in6_addr *psfsrc,
int delta);
static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
struct inet6_dev *idev);
......@@ -272,7 +274,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
return -ENOENT;
}
struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
static struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
{
struct net_device *dev = NULL;
struct inet6_dev *idev = NULL;
......@@ -1723,8 +1725,9 @@ static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
return rv;
}
int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
int sfcount, struct in6_addr *psfsrc, int delta)
static int ip6_mc_del_src(struct inet6_dev *idev, struct in6_addr *pmca,
int sfmode, int sfcount, struct in6_addr *psfsrc,
int delta)
{
struct ifmcaddr6 *pmc;
int changerec = 0;
......@@ -1847,8 +1850,9 @@ static int sf_setstate(struct ifmcaddr6 *pmc)
/*
* Add multicast source filter list to the interface list
*/
int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca, int sfmode,
int sfcount, struct in6_addr *psfsrc, int delta)
static int ip6_mc_add_src(struct inet6_dev *idev, struct in6_addr *pmca,
int sfmode, int sfcount, struct in6_addr *psfsrc,
int delta)
{
struct ifmcaddr6 *pmc;
int isexclude;
......@@ -1951,7 +1955,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma)
spin_unlock_bh(&ma->mca_lock);
}
int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
struct inet6_dev *idev)
{
int err;
......
......@@ -208,8 +208,8 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt,
/*
* pointer to the last default router chosen. BH is disabled locally.
*/
struct rt6_info *rt6_dflt_pointer;
DEFINE_SPINLOCK(rt6_dflt_lock);
static struct rt6_info *rt6_dflt_pointer;
static DEFINE_SPINLOCK(rt6_dflt_lock);
void rt6_reset_dflt_pointer(struct rt6_info *rt)
{
......
......@@ -19,7 +19,7 @@ extern ctl_table ipv6_icmp_table[];
#ifdef CONFIG_SYSCTL
ctl_table ipv6_table[] = {
static ctl_table ipv6_table[] = {
{
.ctl_name = NET_IPV6_ROUTE,
.procname = "route",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment