All of them are passed to inspect/copy out fields, none of the functions
writes to the struct.

This makes it easier to argue about code (in MP context) and syncs ND6 code
with NetBSD and FreeBSD.

Builds and runs fine on sparc64.

Feedback? OK?

diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index c0b92f059c9..3a40e920746 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -301,7 +301,7 @@ skip1:
  * ND6 timer routine to handle ND6 entries
  */
 void
-nd6_llinfo_settimer(struct llinfo_nd6 *ln, unsigned int secs)
+nd6_llinfo_settimer(const struct llinfo_nd6 *ln, unsigned int secs)
 {
        time_t expire = getuptime() + secs;
 
@@ -547,7 +547,7 @@ nd6_purge(struct ifnet *ifp)
 }
 
 struct rtentry *
-nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp,
+nd6_lookup(const struct in6_addr *addr6, int create, struct ifnet *ifp,
     u_int rtableid)
 {
        struct rtentry *rt;
@@ -641,7 +641,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet 
*ifp,
  * XXX: should take care of the destination of a p2p link?
  */
 int
-nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp)
+nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
 {
        struct in6_ifaddr *ia6;
        struct ifaddr *ifa;
@@ -1079,7 +1079,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
  * code - type dependent information
  */
 void
-nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
+nd6_cache_lladdr(struct ifnet *ifp, const struct in6_addr *from, char *lladdr,
     int lladdrlen, int type, int code)
 {
        struct rtentry *rt = NULL;
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 8ea60eb9c5f..8e25cbb523a 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -157,27 +157,29 @@ union nd_opts {
 void nd6_init(void);
 struct nd_ifinfo *nd6_ifattach(struct ifnet *);
 void nd6_ifdetach(struct nd_ifinfo *);
-int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *);
+int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *);
 void nd6_option_init(void *, int, union nd_opts *);
 struct nd_opt_hdr *nd6_option(union nd_opts *);
 int nd6_options(union nd_opts *);
-struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, u_int);
-void nd6_llinfo_settimer(struct llinfo_nd6 *, unsigned int);
+struct rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *,
+    u_int);
+void nd6_llinfo_settimer(const struct llinfo_nd6 *, unsigned int);
 void nd6_purge(struct ifnet *);
 void nd6_nud_hint(struct rtentry *);
 void nd6_rtrequest(struct ifnet *, int, struct rtentry *);
 int nd6_ioctl(u_long, caddr_t, struct ifnet *);
-void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, 
int);
+void nd6_cache_lladdr(struct ifnet *, const struct in6_addr *, char *,
+    int, int, int);
 int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
         struct sockaddr *, u_char *);
 int nd6_need_cache(struct ifnet *);
 
 void nd6_na_input(struct mbuf *, int, int);
-void nd6_na_output(struct ifnet *, struct in6_addr *,
-       struct in6_addr *, u_long, int, struct sockaddr *);
+void nd6_na_output(struct ifnet *, const struct in6_addr *,
+       const struct in6_addr *, u_long, int, struct sockaddr *);
 void nd6_ns_input(struct mbuf *, int, int);
-void nd6_ns_output(struct ifnet *, struct in6_addr *,
-       struct in6_addr *, struct llinfo_nd6 *, int);
+void nd6_ns_output(struct ifnet *, const struct in6_addr *,
+       const struct in6_addr *, const struct llinfo_nd6 *, int);
 caddr_t nd6_ifptomac(struct ifnet *);
 void nd6_dad_start(struct ifaddr *);
 void nd6_dad_stop(struct ifaddr *);
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 5061a325f55..d922d907bf9 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -357,8 +357,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
  * dad - duplicated address detection
  */
 void
-nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, 
-    struct in6_addr *taddr6, struct llinfo_nd6 *ln, int dad)
+nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6,
+    const struct in6_addr *taddr6, const struct llinfo_nd6 *ln, int dad)
 {
        struct mbuf *m;
        struct ip6_hdr *ip6;
@@ -871,8 +871,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
  * sdl0 - sockaddr_dl (= proxy NA) or NULL
  */
 void
-nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, 
-    struct in6_addr *taddr6, u_long flags, int tlladdr, 
+nd6_na_output(struct ifnet *ifp, const struct in6_addr *daddr6,
+    const struct in6_addr *taddr6, u_long flags, int tlladdr,
     struct sockaddr *sdl0)
 {
        struct mbuf *m;

Reply via email to