diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2015-02-16 01:12:20 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2015-02-16 01:12:20 +0000 |
commit | 0b438b0fb87da9ed3e1949059981c87c24ffd833 (patch) | |
tree | e0c2f04d30beef9d9a240fc4825a40c430e9eec8 /sys/netinet6/ip6_output.c | |
parent | b8fc9a86a80cf4920455867c6bfd8a8c6e487ebf (diff) | |
download | src-0b438b0fb87da9ed3e1949059981c87c24ffd833.tar.gz src-0b438b0fb87da9ed3e1949059981c87c24ffd833.zip |
Factor out ip6_deletefraghdr() function, to be shared between IPv6
stack and pf(4).
Submitted by: Kristof Provost
Reviewed by: ae
Differential Revision: D1764
Notes
Notes:
svn path=/head/; revision=278828
Diffstat (limited to 'sys/netinet6/ip6_output.c')
-rw-r--r-- | sys/netinet6/ip6_output.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index a3474d34dc35..dd7ef2cac6cb 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1206,6 +1206,30 @@ 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, |