Module Name:    src
Committed By:   maxv
Date:           Tue Jun 16 17:12:18 UTC 2020

Modified Files:
        src/sys/netinet6: in6.c in6_var.h scope6.c scope6_var.h

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/netinet6/in6.c
cvs rdiff -u -r1.103 -r1.104 src/sys/netinet6/in6_var.h
cvs rdiff -u -r1.22 -r1.23 src/sys/netinet6/scope6.c
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet6/scope6_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.280 src/sys/netinet6/in6.c:1.281
--- src/sys/netinet6/in6.c:1.280	Sun Jun 14 14:26:17 2020
+++ src/sys/netinet6/in6.c	Tue Jun 16 17:12:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.280 2020/06/14 14:26:17 roy Exp $	*/
+/*	$NetBSD: in6.c,v 1.281 2020/06/16 17:12:18 maxv Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.280 2020/06/14 14:26:17 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.281 2020/06/16 17:12:18 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2000,32 +2000,6 @@ in6_matchlen(struct in6_addr *src, struc
 	return match;
 }
 
-/* XXX: to be scope conscious */
-int
-in6_are_prefix_equal(struct in6_addr *p1, struct in6_addr *p2, int len)
-{
-	int bytelen, bitlen;
-
-	/* sanity check */
-	if (len < 0 || len > 128) {
-		log(LOG_ERR, "in6_are_prefix_equal: invalid prefix length(%d)\n",
-		    len);
-		return 0;
-	}
-
-	bytelen = len / NBBY;
-	bitlen = len % NBBY;
-
-	if (memcmp(&p1->s6_addr, &p2->s6_addr, bytelen))
-		return 0;
-	if (bitlen != 0 &&
-	    p1->s6_addr[bytelen] >> (NBBY - bitlen) !=
-	    p2->s6_addr[bytelen] >> (NBBY - bitlen))
-		return 0;
-
-	return 1;
-}
-
 void
 in6_prefixlen2mask(struct in6_addr *maskp, int len)
 {

Index: src/sys/netinet6/in6_var.h
diff -u src/sys/netinet6/in6_var.h:1.103 src/sys/netinet6/in6_var.h:1.104
--- src/sys/netinet6/in6_var.h:1.103	Fri Jun 12 11:04:45 2020
+++ src/sys/netinet6/in6_var.h	Tue Jun 16 17:12:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_var.h,v 1.103 2020/06/12 11:04:45 roy Exp $	*/
+/*	$NetBSD: in6_var.h,v 1.104 2020/06/16 17:12:18 maxv Exp $	*/
 /*	$KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -624,7 +624,6 @@ struct in6_ifaddr *
 	    struct psref *);
 struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t);
 int	in6_matchlen(struct in6_addr *, struct in6_addr *);
-int	in6_are_prefix_equal(struct in6_addr *, struct in6_addr *, int);
 void	in6_prefixlen2mask(struct in6_addr *, int);
 void	in6_purge_mcast_references(struct in6_multi *);
 

Index: src/sys/netinet6/scope6.c
diff -u src/sys/netinet6/scope6.c:1.22 src/sys/netinet6/scope6.c:1.23
--- src/sys/netinet6/scope6.c:1.22	Mon Sep 23 23:12:47 2019
+++ src/sys/netinet6/scope6.c	Tue Jun 16 17:12:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: scope6.c,v 1.22 2019/09/23 23:12:47 kamil Exp $	*/
+/*	$NetBSD: scope6.c,v 1.23 2020/06/16 17:12:18 maxv Exp $	*/
 /*	$KAME$	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.22 2019/09/23 23:12:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.23 2020/06/16 17:12:18 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -95,78 +95,6 @@ scope6_ifdetach(struct scope6_id *sid)
 	free(sid, M_IFADDR);
 }
 
-int
-scope6_set(struct ifnet *ifp, const struct scope6_id *idlist)
-{
-	int i;
-	int error = 0;
-	struct scope6_id *sid = SID(ifp);
-
-	if (!sid)	/* paranoid? */
-		return EINVAL;
-
-	/*
-	 * XXX: We need more consistency checks of the relationship among
-	 * scopes (e.g. an organization should be larger than a site).
-	 */
-
-	/*
-	 * TODO(XXX): after setting, we should reflect the changes to
-	 * interface addresses, routing table entries, PCB entries...
-	 */
-
-	for (i = 0; i < 16; i++) {
-		if (idlist->s6id_list[i] &&
-		    idlist->s6id_list[i] != sid->s6id_list[i]) {
-			int s;
-			/*
-			 * An interface zone ID must be the corresponding
-			 * interface index by definition.
-			 */
-			if (i == IPV6_ADDR_SCOPE_INTFACELOCAL &&
-			    idlist->s6id_list[i] != ifp->if_index)
-				return EINVAL;
-
-			s = pserialize_read_enter();
-			if (i == IPV6_ADDR_SCOPE_LINKLOCAL &&
-			    !if_byindex(idlist->s6id_list[i])) {
-				/*
-				 * XXX: theoretically, there should be no
-				 * relationship between link IDs and interface
-				 * IDs, but we check the consistency for
-				 * safety in later use.
-				 */
-				pserialize_read_exit(s);
-				return EINVAL;
-			}
-			pserialize_read_exit(s);
-
-			/*
-			 * XXX: we must need lots of work in this case,
-			 * but we simply set the new value in this initial
-			 * implementation.
-			 */
-			sid->s6id_list[i] = idlist->s6id_list[i];
-		}
-	}
-
-	return error;
-}
-
-int
-scope6_get(const struct ifnet *ifp, struct scope6_id *idlist)
-{
-	/* We only need to lock the interface's afdata for SID() to work. */
-	const struct scope6_id *sid = SID(ifp);
-
-	if (sid == NULL)	/* paranoid? */
-		return EINVAL;
-
-	*idlist = *sid;
-
-	return 0;
-}
-
 /*
  * Get a scope of the address. Interface-local, link-local, site-local
  * or global.
@@ -224,37 +152,6 @@ in6_addrscope(const struct in6_addr *add
 	return IPV6_ADDR_SCOPE_GLOBAL;
 }
 
-/* note that ifp argument might be NULL */
-void
-scope6_setdefault(struct ifnet *ifp)
-{
-
-	/*
-	 * Currently, this function just sets the default "interfaces"
-	 * and "links" according to the given interface.
-	 * We might eventually have to separate the notion of "link" from
-	 * "interface" and provide a user interface to set the default.
-	 */
-	if (ifp) {
-		sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] =
-			ifp->if_index;
-		sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] =
-			ifp->if_index;
-	} else {
-		sid_default.s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = 0;
-		sid_default.s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = 0;
-	}
-}
-
-int
-scope6_get_default(struct scope6_id *idlist)
-{
-
-	*idlist = sid_default;
-
-	return 0;
-}
-
 uint32_t
 scope6_addr2default(const struct in6_addr *addr)
 {

Index: src/sys/netinet6/scope6_var.h
diff -u src/sys/netinet6/scope6_var.h:1.4 src/sys/netinet6/scope6_var.h:1.5
--- src/sys/netinet6/scope6_var.h:1.4	Wed Aug  9 17:20:44 2017
+++ src/sys/netinet6/scope6_var.h	Tue Jun 16 17:12:18 2020
@@ -105,10 +105,6 @@ struct scope6_id {
 void	scope6_init(void);
 struct scope6_id *scope6_ifattach(struct ifnet *);
 void	scope6_ifdetach(struct scope6_id *);
-int	scope6_set(struct ifnet *, const struct scope6_id *);
-int	scope6_get(const struct ifnet *, struct scope6_id *);
-void	scope6_setdefault(struct ifnet *);
-int	scope6_get_default(struct scope6_id *);
 uint32_t scope6_in6_addrscope(struct in6_addr *);
 uint32_t scope6_addr2default(const struct in6_addr *);
 int	sa6_embedscope(struct sockaddr_in6 *, int);

Reply via email to