Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Remove unused function.



details:   https://anonhg.NetBSD.org/src/rev/ab6015ac644b
branches:  trunk
changeset: 995472:ab6015ac644b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Dec 24 15:57:15 2018 +0000

description:
Remove unused function.

diffstat:

 sys/netipsec/keysock.c |  96 +------------------------------------------------
 sys/netipsec/keysock.h |   5 +-
 2 files changed, 4 insertions(+), 97 deletions(-)

diffs (136 lines):

diff -r 8edf6d2f16fa -r ab6015ac644b sys/netipsec/keysock.c
--- a/sys/netipsec/keysock.c    Mon Dec 24 14:55:41 2018 +0000
+++ b/sys/netipsec/keysock.c    Mon Dec 24 15:57:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keysock.c,v 1.66 2018/11/08 04:30:38 roy Exp $ */
+/*     $NetBSD: keysock.c,v 1.67 2018/12/24 15:57:15 maxv Exp $        */
 /*     $FreeBSD: keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $     */
 /*     $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $        */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.66 2018/11/08 04:30:38 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.67 2018/12/24 15:57:15 maxv Exp $");
 
 /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */
 
@@ -218,98 +218,6 @@
        return error;
 }
 
-/* XXX this interface should be obsoleted. */
-int
-key_sendup(struct socket *so, struct sadb_msg *msg, u_int len,
-          int target)  /*target of the resulting message*/
-{
-       struct mbuf *m, *n, *mprev;
-       int tlen;
-
-       KASSERT(so != NULL);
-       KASSERT(msg != NULL);
-
-       if (KEYDEBUG_ON(KEYDEBUG_KEY_DUMP)) {
-               printf("key_sendup: \n");
-               kdebug_sadb(msg);
-       }
-
-       /*
-        * we increment statistics here, just in case we have ENOBUFS
-        * in this function.
-        */
-       {
-               uint64_t *ps = PFKEY_STAT_GETREF();
-               ps[PFKEY_STAT_IN_TOTAL]++;
-               ps[PFKEY_STAT_IN_BYTES] += len;
-               ps[PFKEY_STAT_IN_MSGTYPE + msg->sadb_msg_type]++;
-               PFKEY_STAT_PUTREF();
-       }
-
-       /*
-        * Get mbuf chain whenever possible (not clusters),
-        * to save socket buffer.  We'll be generating many SADB_ACQUIRE
-        * messages to listening key sockets.  If we simply allocate clusters,
-        * sbappendaddr() will raise ENOBUFS due to too little sbspace().
-        * sbspace() computes # of actual data bytes AND mbuf region.
-        *
-        * TODO: SADB_ACQUIRE filters should be implemented.
-        */
-       tlen = len;
-       m = mprev = NULL;
-       while (tlen > 0) {
-               int mlen;       
-               if (tlen == len) {
-                       MGETHDR(n, M_DONTWAIT, MT_DATA);
-                       mlen = MHLEN;
-               } else {
-                       MGET(n, M_DONTWAIT, MT_DATA);
-                       mlen = MLEN;
-               }
-               if (!n) {
-                       PFKEY_STATINC(PFKEY_STAT_IN_NOMEM);
-                       return ENOBUFS;
-               }
-               n->m_len = mlen;
-               if (tlen >= MCLBYTES) { /*XXX better threshold? */
-                       MCLGET(n, M_DONTWAIT);
-                       if ((n->m_flags & M_EXT) == 0) {
-                               m_free(n);
-                               m_freem(m);
-                               PFKEY_STATINC(PFKEY_STAT_IN_NOMEM);
-                               return ENOBUFS;
-                       }
-                       n->m_len = MCLBYTES;
-               }
-
-               if (tlen < n->m_len)
-                       n->m_len = tlen;
-               n->m_next = NULL;
-               if (m == NULL)
-                       m = mprev = n;
-               else {
-                       mprev->m_next = n;
-                       mprev = n;
-               }
-               tlen -= n->m_len;
-               n = NULL;
-       }
-       m->m_pkthdr.len = len;
-       m_reset_rcvif(m);
-       m_copyback(m, 0, len, msg);
-
-       /* avoid duplicated statistics */
-       {
-               uint64_t *ps = PFKEY_STAT_GETREF();
-               ps[PFKEY_STAT_IN_TOTAL]--;
-               ps[PFKEY_STAT_IN_BYTES] -= len;
-               ps[PFKEY_STAT_IN_MSGTYPE + msg->sadb_msg_type]--;
-               PFKEY_STAT_PUTREF();
-       }
-
-       return key_sendup_mbuf(so, m, target);
-}
-
 /* so can be NULL if target != KEY_SENDUP_ONE */
 static int
 _key_sendup_mbuf(struct socket *so, struct mbuf *m,
diff -r 8edf6d2f16fa -r ab6015ac644b sys/netipsec/keysock.h
--- a/sys/netipsec/keysock.h    Mon Dec 24 14:55:41 2018 +0000
+++ b/sys/netipsec/keysock.h    Mon Dec 24 15:57:15 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: keysock.h,v 1.11 2018/04/19 08:27:39 maxv Exp $        */
+/*     $NetBSD: keysock.h,v 1.12 2018/12/24 15:57:15 maxv Exp $        */
 /*     $FreeBSD: keysock.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $     */
 /*     $KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $       */
 
@@ -74,8 +74,7 @@
 
 void key_init_so(void);
 
-int key_sendup (struct socket *, struct sadb_msg *, u_int, int);
-int key_sendup_mbuf (struct socket *, struct mbuf *, int);
+int key_sendup_mbuf(struct socket *, struct mbuf *, int);
 #endif /* _KERNEL */
 
 #endif /* !_NETIPSEC_KEYSOCK_H_ */



Home | Main Index | Thread Index | Old Index