Remove unused function.

This commit is contained in:
maxv 2018-12-24 15:57:15 +00:00
parent 2465aa9cb2
commit 8172cc2f5e
2 changed files with 4 additions and 97 deletions

View File

@ -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 @@ key_sendup0(
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,

View File

@ -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 @@ struct keycb {
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_ */