> On 16 Feb 2015, at 01:12 , Gleb Smirnoff <gleb...@freebsd.org> wrote:
> 
> Author: glebius
> Date: Mon Feb 16 01:12:20 2015
> New Revision: 278828
> URL: https://svnweb.freebsd.org/changeset/base/278828
> 
> Log:
>  Factor out ip6_deletefraghdr() function, to be shared between IPv6
>  stack and pf(4).
> 
>  Submitted by:        Kristof Provost
>  Reviewed by: ae
>  Differential Revision:       D1764
> 
> Modified:
>  head/sys/netinet6/frag6.c
>  head/sys/netinet6/ip6_output.c

Why did it have to move file?


>  head/sys/netinet6/ip6_var.h
> 
> Modified: head/sys/netinet6/frag6.c
> ==============================================================================
> --- head/sys/netinet6/frag6.c Sun Feb 15 23:58:57 2015        (r278827)
> +++ head/sys/netinet6/frag6.c Mon Feb 16 01:12:20 2015        (r278828)
> @@ -541,27 +541,16 @@ insert:
>       *q6->ip6q_nxtp = (u_char)(nxt & 0xff);
> #endif
> 
> -     /* Delete frag6 header */
> -     if (m->m_len >= offset + sizeof(struct ip6_frag)) {
> -             /* This is the only possible case with !PULLDOWN_TEST */
> -             ovbcopy((caddr_t)ip6, (caddr_t)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, M_NOWAIT)) == NULL) {
> -                     frag6_remque(q6);
> -                     V_frag6_nfrags -= q6->ip6q_nfrag;
> +     if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) {
> +             frag6_remque(q6);
> +             V_frag6_nfrags -= q6->ip6q_nfrag;
> #ifdef MAC
> -                     mac_ip6q_destroy(q6);
> +             mac_ip6q_destroy(q6);
> #endif
> -                     free(q6, M_FTABLE);
> -                     V_frag6_nfragpackets--;
> -                     goto dropfrag;
> -             }
> -             m_adj(t, sizeof(struct ip6_frag));
> -             m_cat(m, t);
> +             free(q6, M_FTABLE);
> +             V_frag6_nfragpackets--;
> +
> +             goto dropfrag;
>       }
> 
>       /*
> 
> Modified: head/sys/netinet6/ip6_output.c
> ==============================================================================
> --- head/sys/netinet6/ip6_output.c    Sun Feb 15 23:58:57 2015        
> (r278827)
> +++ head/sys/netinet6/ip6_output.c    Mon Feb 16 01:12:20 2015        
> (r278828)
> @@ -1206,6 +1206,30 @@ ip6_insertfraghdr(struct mbuf *m0, struc
>       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,
> 
> Modified: head/sys/netinet6/ip6_var.h
> ==============================================================================
> --- head/sys/netinet6/ip6_var.h       Sun Feb 15 23:58:57 2015        
> (r278827)
> +++ head/sys/netinet6/ip6_var.h       Mon Feb 16 01:12:20 2015        
> (r278828)
> @@ -388,6 +388,7 @@ int       ip6_setpktopts(struct mbuf *, struct
> void  ip6_clearpktopts(struct ip6_pktopts *, int);
> struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
> int   ip6_optlen(struct inpcb *);
> +int  ip6_deletefraghdr(struct mbuf *, int, int);
> 
> int   route6_input(struct mbuf **, int *, int);
> 
> 

— 
Bjoern A. Zeeb                                  Charles Haddon Spurgeon:
"Friendship is one of the sweetest joys of life.  Many might have failed
 beneath the bitterness of their trial  had they not found a friend."

_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to