Author: jhb
Date: Wed Aug 14 23:25:58 2019
New Revision: 351058
URL: https://svnweb.freebsd.org/changeset/base/351058

Log:
  MFC 347465: Apply r280991 to ip6_fragment.
  
  This uses m_dup_pkthdr() to copy all of the metadata about a packet to
  each of its fragments including VLAN tags, mbuf tags, etc. instead of
  hand-copying a few fields.

Modified:
  stable/12/sys/netinet6/ip6_output.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/netinet6/ip6_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/netinet6/ip6_output.c
==============================================================================
--- stable/12/sys/netinet6/ip6_output.c Wed Aug 14 23:05:57 2019        
(r351057)
+++ stable/12/sys/netinet6/ip6_output.c Wed Aug 14 23:25:58 2019        
(r351058)
@@ -228,7 +228,20 @@ ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int h
                        IP6STAT_INC(ip6s_odropped);
                        return (ENOBUFS);
                }
-               m->m_flags = m0->m_flags & M_COPYFLAGS;
+
+               /*
+                * Make sure the complete packet header gets copied
+                * from the originating mbuf to the newly created
+                * mbuf. This also ensures that existing firewall
+                * classification(s), VLAN tags and so on get copied
+                * to the resulting fragmented packet(s):
+                */
+               if (m_dup_pkthdr(m, m0, M_NOWAIT) == 0) {
+                       m_free(m);
+                       IP6STAT_INC(ip6s_odropped);
+                       return (ENOBUFS);
+               }
+
                *mnext = m;
                mnext = &m->m_nextpkt;
                m->m_data += max_linkhdr;
@@ -253,8 +266,6 @@ ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int h
                }
                m_cat(m, m_frgpart);
                m->m_pkthdr.len = fraglen + hlen + sizeof(*ip6f);
-               m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum;
-               m->m_pkthdr.rcvif = NULL;
                ip6f->ip6f_reserved = 0;
                ip6f->ip6f_ident = id;
                ip6f->ip6f_nxt = nextproto;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to