[IPV6]: Make address arguments const.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Thu, 10 Apr 2008 06:42:10 +0000 (15:42 +0900)
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Sat, 12 Apr 2008 04:43:18 +0000 (13:43 +0900)
- net/ipv6/addrconf.c:
ipv6_get_ifaddr(), ipv6_dev_get_saddr()
- net/ipv6/mcast.c:
ipv6_sock_mc_join(), ipv6_sock_mc_drop(),
inet6_mc_check(),
ipv6_dev_mc_inc(), __ipv6_dev_mc_dec(), ipv6_dev_mc_dec(),
ipv6_chk_mcast_addr()
- net/ipv6/route.c:
rt6_lookup(), icmp6_dst_alloc()
- net/ipv6/ip6_output.c:
ip6_nd_hdr()
- net/ipv6/ndisc.c:
ndisc_send_ns(), ndisc_send_rs(), ndisc_send_redirect(),
ndisc_get_neigh(), __ndisc_send()

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
include/net/addrconf.h
include/net/ip6_route.h
include/net/ipv6.h
include/net/ndisc.h
net/ipv6/addrconf.c
net/ipv6/ip6_output.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/route.c

index 8317c1b..92af23d 100644 (file)
@@ -76,12 +76,12 @@ extern int                  ipv6_chk_prefix(struct in6_addr *addr,
                                                struct net_device *dev);
 
 extern struct inet6_ifaddr      *ipv6_get_ifaddr(struct net *net,
-                                                struct in6_addr *addr,
+                                                const struct in6_addr *addr,
                                                 struct net_device *dev,
                                                 int strict);
 
 extern int                     ipv6_dev_get_saddr(struct net_device *dev, 
-                                              struct in6_addr *daddr,
+                                              const struct in6_addr *daddr,
                                               unsigned int srcprefs,
                                               struct in6_addr *saddr);
 extern int                     ipv6_get_lladdr(struct net_device *dev,
@@ -105,25 +105,27 @@ extern u32                        ipv6_addr_label(const struct in6_addr *addr,
 /*
  *     multicast prototypes (mcast.c)
  */
-extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, 
-                 struct in6_addr *addr);
-extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, 
-                 struct in6_addr *addr);
+extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
+                            const struct in6_addr *addr);
+extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
+                            const struct in6_addr *addr);
 extern void ipv6_sock_mc_close(struct sock *sk);
-extern int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr,
-               struct in6_addr *src_addr);
+extern int inet6_mc_check(struct sock *sk,
+                         const struct in6_addr *mc_addr,
+                         const struct in6_addr *src_addr);
 
-extern int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr);
-extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr);
-extern int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr);
+extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
+extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
+extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
 extern void ipv6_mc_up(struct inet6_dev *idev);
 extern void ipv6_mc_down(struct inet6_dev *idev);
 extern void ipv6_mc_init_dev(struct inet6_dev *idev);
 extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
 extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
 
-extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group,
-               struct in6_addr *src_addr);
+extern int ipv6_chk_mcast_addr(struct net_device *dev,
+                              const struct in6_addr *group,
+                              const struct in6_addr *src_addr);
 extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr);
 
 extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
index 9080076..9313491 100644 (file)
@@ -61,13 +61,13 @@ extern int                  ip6_ins_rt(struct rt6_info *);
 extern int                     ip6_del_rt(struct rt6_info *);
 
 extern struct rt6_info         *rt6_lookup(struct net *net,
-                                           struct in6_addr *daddr,
-                                           struct in6_addr *saddr,
+                                           const struct in6_addr *daddr,
+                                           const struct in6_addr *saddr,
                                            int oif, int flags);
 
 extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
                                         struct neighbour *neigh,
-                                        struct in6_addr *addr);
+                                        const struct in6_addr *addr);
 extern int icmp6_dst_gc(int *more);
 
 extern void fib6_force_start_gc(struct net *net);
index a0c285b..49c4898 100644 (file)
@@ -451,8 +451,8 @@ extern int                  ip6_xmit(struct sock *sk,
 extern int                     ip6_nd_hdr(struct sock *sk,
                                           struct sk_buff *skb,
                                           struct net_device *dev,
-                                          struct in6_addr *saddr,
-                                          struct in6_addr *daddr,
+                                          const struct in6_addr *saddr,
+                                          const struct in6_addr *daddr,
                                           int proto, int len);
 
 extern int                     ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
index 1642423..9c451ff 100644 (file)
@@ -94,17 +94,17 @@ extern int                  ndisc_rcv(struct sk_buff *skb);
 
 extern void                    ndisc_send_ns(struct net_device *dev,
                                              struct neighbour *neigh,
-                                             struct in6_addr *solicit,
-                                             struct in6_addr *daddr,
-                                             struct in6_addr *saddr);
+                                             const struct in6_addr *solicit,
+                                             const struct in6_addr *daddr,
+                                             const struct in6_addr *saddr);
 
 extern void                    ndisc_send_rs(struct net_device *dev,
-                                             struct in6_addr *saddr,
-                                             struct in6_addr *daddr);
+                                             const struct in6_addr *saddr,
+                                             const struct in6_addr *daddr);
 
 extern void                    ndisc_send_redirect(struct sk_buff *skb,
                                                    struct neighbour *neigh,
-                                                   struct in6_addr *target);
+                                                   const struct in6_addr *target);
 
 extern int                     ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
 
@@ -134,7 +134,7 @@ extern int                  ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
 extern void                    inet6_ifinfo_notify(int event,
                                                    struct inet6_dev *idev);
 
-static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
+static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
 {
 
        if (dev)
index d15f3e0..4048c2b 100644 (file)
@@ -940,7 +940,7 @@ struct ipv6_saddr_score {
 };
 
 struct ipv6_saddr_dst {
-       struct in6_addr *addr;
+       const struct in6_addr *addr;
        int ifindex;
        int scope;
        int label;
@@ -1074,7 +1074,7 @@ out:
 }
 
 int ipv6_dev_get_saddr(struct net_device *dst_dev,
-                      struct in6_addr *daddr, unsigned int prefs,
+                      const struct in6_addr *daddr, unsigned int prefs,
                       struct in6_addr *saddr)
 {
        struct ipv6_saddr_score scores[2],
@@ -1309,7 +1309,7 @@ int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev)
 
 EXPORT_SYMBOL(ipv6_chk_prefix);
 
-struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr,
+struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *addr,
                                     struct net_device *dev, int strict)
 {
        struct inet6_ifaddr * ifp;
index c0dbe54..0af2e05 100644 (file)
@@ -286,7 +286,7 @@ EXPORT_SYMBOL(ip6_xmit);
  */
 
 int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
-              struct in6_addr *saddr, struct in6_addr *daddr,
+              const struct in6_addr *saddr, const struct in6_addr *daddr,
               int proto, int len)
 {
        struct ipv6_pinfo *np = inet6_sk(sk);
index 2e6a53f..0a0132a 100644 (file)
@@ -127,8 +127,6 @@ 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);
 
-int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr);
-
 static void igmp6_join_group(struct ifmcaddr6 *ma);
 static void igmp6_leave_group(struct ifmcaddr6 *ma);
 static void igmp6_timer_handler(unsigned long data);
@@ -177,7 +175,7 @@ int sysctl_mld_max_msf __read_mostly = IPV6_MLD_MAX_MSF;
  *     socket join on multicast group
  */
 
-int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
+int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
 {
        struct net_device *dev = NULL;
        struct ipv6_mc_socklist *mc_lst;
@@ -252,7 +250,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
 /*
  *     socket leave on multicast group
  */
-int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
+int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
 {
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct ipv6_mc_socklist *mc_lst, **lnk;
@@ -664,8 +662,8 @@ done:
        return err;
 }
 
-int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr,
-       struct in6_addr *src_addr)
+int inet6_mc_check(struct sock *sk, const struct in6_addr *mc_addr,
+                  const struct in6_addr *src_addr)
 {
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct ipv6_mc_socklist *mc;
@@ -871,7 +869,7 @@ static void mld_clear_delrec(struct inet6_dev *idev)
 /*
  *     device multicast group inc (add if not found)
  */
-int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr)
+int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr)
 {
        struct ifmcaddr6 *mc;
        struct inet6_dev *idev;
@@ -942,7 +940,7 @@ int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr)
 /*
  *     device multicast group del
  */
-int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr)
+int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr)
 {
        struct ifmcaddr6 *ma, **map;
 
@@ -967,7 +965,7 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr)
        return -ENOENT;
 }
 
-int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr)
+int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr)
 {
        struct inet6_dev *idev = in6_dev_get(dev);
        int err;
@@ -1012,8 +1010,8 @@ int ipv6_is_mld(struct sk_buff *skb, int nexthdr)
 /*
  *     check if the interface/address pair is valid
  */
-int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group,
-       struct in6_addr *src_addr)
+int ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
+                       const struct in6_addr *src_addr)
 {
        struct inet6_dev *idev;
        struct ifmcaddr6 *mc;
index b3295d8..5b9ad5e 100644 (file)
@@ -442,8 +442,9 @@ static void pndisc_destructor(struct pneigh_entry *n)
  */
 static void __ndisc_send(struct net_device *dev,
                         struct neighbour *neigh,
-                        struct in6_addr *daddr, struct in6_addr *saddr,
-                        struct icmp6hdr *icmp6h, struct in6_addr *target,
+                        const struct in6_addr *daddr,
+                        const struct in6_addr *saddr,
+                        struct icmp6hdr *icmp6h, const struct in6_addr *target,
                         int llinfo)
 {
        struct flowi fl;
@@ -529,12 +530,13 @@ static void __ndisc_send(struct net_device *dev,
 }
 
 static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
-                  struct in6_addr *daddr, struct in6_addr *solicited_addr,
-                  int router, int solicited, int override, int inc_opt)
+                         const struct in6_addr *daddr,
+                         const struct in6_addr *solicited_addr,
+                         int router, int solicited, int override, int inc_opt)
 {
        struct in6_addr tmpaddr;
        struct inet6_ifaddr *ifp;
-       struct in6_addr *src_addr;
+       const struct in6_addr *src_addr;
        struct icmp6hdr icmp6h = {
                .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT,
        };
@@ -564,8 +566,8 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
 }
 
 void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
-                  struct in6_addr *solicit,
-                  struct in6_addr *daddr, struct in6_addr *saddr)
+                  const struct in6_addr *solicit,
+                  const struct in6_addr *daddr, const struct in6_addr *saddr)
 {
        struct in6_addr addr_buf;
        struct icmp6hdr icmp6h = {
@@ -584,8 +586,8 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
                     !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0);
 }
 
-void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
-                  struct in6_addr *daddr)
+void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
+                  const struct in6_addr *daddr)
 {
        struct icmp6hdr icmp6h = {
                .icmp6_type = NDISC_ROUTER_SOLICITATION,
@@ -1447,7 +1449,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 }
 
 void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
-                        struct in6_addr *target)
+                        const struct in6_addr *target)
 {
        struct net_device *dev = skb->dev;
        struct net *net = dev_net(dev);
index 269b760..6293cb9 100644 (file)
@@ -556,8 +556,8 @@ out:
 
 }
 
-struct rt6_info *rt6_lookup(struct net *net, struct in6_addr *daddr,
-                           struct in6_addr *saddr, int oif, int strict)
+struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
+                           const struct in6_addr *saddr, int oif, int strict)
 {
        struct flowi fl = {
                .oif = oif,
@@ -925,7 +925,7 @@ static DEFINE_SPINLOCK(icmp6_dst_lock);
 
 struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
                                  struct neighbour *neigh,
-                                 struct in6_addr *addr)
+                                 const struct in6_addr *addr)
 {
        struct rt6_info *rt;
        struct inet6_dev *idev = in6_dev_get(dev);