From owner-freebsd-net@FreeBSD.ORG Mon Jan 12 07:21:52 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F8AE16A4CE for ; Mon, 12 Jan 2004 07:21:52 -0800 (PST) Received: from exchange.wan.no (exchange.wan.no [80.86.128.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CB7F43D69 for ; Mon, 12 Jan 2004 07:21:22 -0800 (PST) (envelope-from sten.daniel.sorsdal@wan.no) Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Mon, 12 Jan 2004 16:21:19 +0100 Message-ID: <0AF1BBDF1218F14E9B4CCE414744E70F5D96C7@exchange.wanglobal.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: verrevpath in ip_input (need help) Thread-Index: AcPZH7qOtNw31iWmT9+RPP1nzEuMfg== From: =?iso-8859-1?Q?Sten_Daniel_S=F8rsdal?= To: Subject: verrevpath in ip_input (need help) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2004 15:21:52 -0000 Has anyone made a patch to add ipfw2's verrev functionality in ip_input = (or similar place) ? I've tried for a few days to write it myself but it keeps panicing on = (among other things) deleting of default route (i suspect that i really = ask the route for 0.0.0.0). I plan to add an ifconfig flag when this basic one works so i can = enable/disable this feature pr interface. this compiles but bombs on "route delete default", i dont have a monitor = on this box because no monitor is available atm, so i cant really see = what happens.=20 compilation flags are: -O -pipe -funroll-loops -ffast-math =20 os version: FreeBSD devil.wan.no 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 = (...) i386 can anyone spot the bug?=20 static int ip_verrevinterface =3D 0; SYSCTL_INT(_net_inet_ip, OID_AUTO, verrevinterface, CTLFLAG_RW, &ip_verrevinterface, 0, "Verify packet reverse path"); ... void ip_input (struct mbuf *m) { struct route verrev_ro; ... iphack: ... right after "if (fr_checkp) {" clause ...=09 if (ip_verrevinterface && m->m_pkthdr.rcvif !=3D NULL && = ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) =3D=3D 0)) { struct sockaddr_in *verrev_dst; verrev_dst =3D (struct sockaddr_in = *)&(verrev_ro.ro_dst); /* Check if we've cached the route from the previous = call. */ verrev_ro.ro_rt =3D NULL; bzero(verrev_dst, sizeof(*verrev_dst)); verrev_dst->sin_family =3D AF_INET; verrev_dst->sin_len =3D sizeof(*verrev_dst); verrev_dst->sin_addr =3D ip->ip_src; rtalloc_ign(&verrev_ro, RTF_CLONING|RTF_PRCLONING); if ((verrev_ro.ro_rt =3D=3D NULL) || = (verrev_ro.ro_rt->rt_ifp->if_index !=3D m->m_pkthdr.rcvif->if_index)) { printf("ip_input: verrevpath expected %d but got = %d\n", m->m_pkthdr.rcvif->if_index, = verrev_ro.ro_rt->rt_ifp->if_index ); } } ... // sten