Move ip6_deletefraghdr() to frag6.c.

Suggested by:	bz
This commit is contained in:
glebius 2015-02-16 05:58:32 +00:00
parent 9faacbf76a
commit f3e67710e4
2 changed files with 24 additions and 24 deletions

View File

@ -764,3 +764,27 @@ frag6_drain(void)
IP6Q_UNLOCK();
VNET_LIST_RUNLOCK_NOSLEEP();
}
int
ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
{
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct mbuf *t;
/* Delete frag6 header. */
if (m->m_len >= offset + sizeof(struct ip6_frag)) {
/* This is the only possible case with !PULLDOWN_TEST. */
bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
offset);
m->m_data += sizeof(struct ip6_frag);
m->m_len -= sizeof(struct ip6_frag);
} else {
/* This comes with no copy if the boundary is on cluster. */
if ((t = m_split(m, offset, wait)) == NULL)
return (ENOMEM);
m_adj(t, sizeof(struct ip6_frag));
m_cat(m, t);
}
return (0);
}

View File

@ -1206,30 +1206,6 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen,
return (0);
}
int
ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
{
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
struct mbuf *t;
/* Delete frag6 header. */
if (m->m_len >= offset + sizeof(struct ip6_frag)) {
/* This is the only possible case with !PULLDOWN_TEST. */
bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
offset);
m->m_data += sizeof(struct ip6_frag);
m->m_len -= sizeof(struct ip6_frag);
} else {
/* This comes with no copy if the boundary is on cluster. */
if ((t = m_split(m, offset, wait)) == NULL)
return (ENOMEM);
m_adj(t, sizeof(struct ip6_frag));
m_cat(m, t);
}
return (0);
}
static int
ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
struct ifnet *ifp, struct in6_addr *dst, u_long *mtup,