Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/netinet6 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/7469649ec19c
branches:  netbsd-8
changeset: 434789:7469649ec19c
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Mar 30 11:23:20 2018 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #664):

        sys/netinet6/dest6.c: revision 1.21

Fix the calculation of the ICMP6 error pointer. It is not correct to use

        pointer = opt - mtod(m, u_int8_t *)

because m may have gone through m_pulldown, and it is possible that
m->m_data is no longer the beginning of the packet.

diffstat:

 sys/netinet6/dest6.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r 9c01f1d14cb8 -r 7469649ec19c sys/netinet6/dest6.c
--- a/sys/netinet6/dest6.c      Fri Mar 30 11:19:45 2018 +0000
+++ b/sys/netinet6/dest6.c      Fri Mar 30 11:23:20 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dest6.c,v 1.20 2017/01/11 13:08:29 ozaki-r Exp $       */
+/*     $NetBSD: dest6.c,v 1.20.8.1 2018/03/30 11:23:20 martin Exp $    */
 /*     $KAME: dest6.c,v 1.25 2001/02/22 01:39:16 itojun Exp $  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.20 2017/01/11 13:08:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dest6.c,v 1.20.8.1 2018/03/30 11:23:20 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,7 +56,7 @@
 dest6_input(struct mbuf **mp, int *offp, int proto)
 {
        struct mbuf *m = *mp;
-       int off = *offp, dstoptlen, optlen;
+       int off = *offp, erroff, dstoptlen, optlen;
        struct ip6_dest *dstopts;
        u_int8_t *opt;
 
@@ -89,8 +89,8 @@
                        optlen = *(opt + 1) + 2;
                        break;
                default:                /* unknown option */
-                       optlen = ip6_unknown_opt(opt, m,
-                           opt - mtod(m, u_int8_t *));
+                       erroff = *offp + (opt - (u_int8_t *)dstopts);
+                       optlen = ip6_unknown_opt(opt, m, erroff);
                        if (optlen == -1)
                                return (IPPROTO_DONE);
                        optlen += 2;
@@ -99,9 +99,9 @@
        }
 
        *offp = off;
-       return (dstopts->ip6d_nxt);
+       return dstopts->ip6d_nxt;
 
-  bad:
+bad:
        m_freem(m);
-       return (IPPROTO_DONE);
+       return IPPROTO_DONE;
 }



Home | Main Index | Thread Index | Old Index