From owner-freebsd-net@FreeBSD.ORG  Tue Jan 21 13:34:03 2014
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 83E57F11;
 Tue, 21 Jan 2014 13:34:03 +0000 (UTC)
Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0316B1DC0;
 Tue, 21 Jan 2014 13:34:02 +0000 (UTC)
Received: from cell.glebius.int.ru (localhost [127.0.0.1])
 by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id s0LDXxVL068199
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Tue, 21 Jan 2014 17:33:59 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
Received: (from glebius@localhost)
 by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id s0LDXxVP068198;
 Tue, 21 Jan 2014 17:33:59 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to
 glebius@FreeBSD.org using -f
Date: Tue, 21 Jan 2014 17:33:59 +0400
From: Gleb Smirnoff <glebius@FreeBSD.org>
To: Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= <olivier@cochard.me>
Subject: Re: Regression on 10-RC5 with a multicast routing daemon
Message-ID: <20140121133359.GB66160@glebius.int.ru>
References: <CA+q+TcpFs_vff-r5e-Hw=F7QvGLc-9HGM-vm5TB1C4zik+0d8A@mail.gmail.com>
 <20140115113430.GK26504@FreeBSD.org>
 <CA+q+TcrCVmH9-9jNGbeTTjV9wUs=jrK2uFGvDRY0Du5oUVEGvQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="yEPQxsgoJgBvi8ip"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CA+q+TcrCVmH9-9jNGbeTTjV9wUs=jrK2uFGvDRY0Du5oUVEGvQ@mail.gmail.com>
User-Agent: Mutt/1.5.22 (2013-10-16)
Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>,
 "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>,
 Andre Oppermann <andre@freebsd.org>
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Jan 2014 13:34:03 -0000


--yEPQxsgoJgBvi8ip
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

On Sun, Jan 19, 2014 at 02:42:32AM +0100, Olivier Cochard-Labbé wrote:
O> >   Olivier,
O> >
O> >
O> > TL;DR version: you need not subtract iphdrlen in 10.0. Code in
O> > igmp.c:accept_igmp()
O> > should be smth like:
O> >
O> >     iphdrlen  = ip->ip_hl << 2;
O> > #ifdef RAW_INPUT_IS_RAW /* Linux */
O> >     ipdatalen = ntohs(ip->ip_len) - iphdrlen;
O> > #else
O> >  #if __FreeBSD_version >= 1000000
O> >     ipdatalen = ip->ip_len - iphdrlen;
O> >  #else
O> >     ipdatalen = ip->ip_len;
O> >  #endif
O> > #endif
O> >
O> >
O> With this patch I've no more the message "warning - Received packet from
O> x.x.x.x shorter (28 bytes) than hdr+data length (20+28)":Thanks!
O> But there is still a regression regarding the PIM socket behavior not
O> related to the packet format.
O> The pim.c include 2 functions (pim_read and pim_accept) that are called
O> when the socket received a packet: There functions are never triggered when
O> PIM packets are received on 10.0.
O> In the same time igmp_read() and igmp_accept() are correctly triggered on
O> 9.2 and 10.0.
O> tcpdump in non-promiscious mode correctly see input of PIM packet: This
O> should confirm that once this daemon is started, it correctly open a PIM
O> socket and the multicast filter is updated.

Can you please try this patch to kernel?

If it doesn't work, can you please gather ktr(4) information with KTR_IPMF
compiled into kernel.

-- 
Totus tuus, Glebius.

--yEPQxsgoJgBvi8ip
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="ip_mroute.c.diff"

Index: sys/netinet/ip_mroute.c
===================================================================
--- sys/netinet/ip_mroute.c	(revision 260904)
+++ sys/netinet/ip_mroute.c	(working copy)
@@ -2557,14 +2557,13 @@ pim_encapcheck(const struct mbuf *m, int off, int
  * is passed to if_simloop().
  */
 void
-pim_input(struct mbuf *m, int off)
+pim_input(struct mbuf *m, int iphlen)
 {
     struct ip *ip = mtod(m, struct ip *);
     struct pim *pim;
     int minlen;
-    int datalen = ntohs(ip->ip_len);
+    int datalen = ntohs(ip->ip_len) - iphlen;
     int ip_tos;
-    int iphlen = off;
 
     /* Keep statistics */
     PIMSTAT_INC(pims_rcv_total_msgs);
@@ -2594,8 +2593,7 @@ void
      * Get the IP and PIM headers in contiguous memory, and
      * possibly the PIM REGISTER header.
      */
-    if ((m->m_flags & M_EXT || m->m_len < minlen) &&
-	(m = m_pullup(m, minlen)) == 0) {
+    if (m->m_len < minlen && (m = m_pullup(m, minlen)) == 0) {
 	CTR1(KTR_IPMF, "%s: m_pullup() failed", __func__);
 	return;
     }

--yEPQxsgoJgBvi8ip--