Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 2004 16:21:19 +0100
From:      =?iso-8859-1?Q?Sten_Daniel_S=F8rsdal?= <sten.daniel.sorsdal@wan.no>
To:        <freebsd-net@freebsd.org>
Subject:   verrevpath in ip_input (need help)
Message-ID:  <0AF1BBDF1218F14E9B4CCE414744E70F5D96C7@exchange.wanglobal.net>

next in thread | raw e-mail | index | archive | help


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. 


compilation flags are: -O -pipe -funroll-loops -ffast-math  
os version: FreeBSD devil.wan.no 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 (...) i386
can anyone spot the bug? 


static int      ip_verrevinterface = 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
...	
        if (ip_verrevinterface && m->m_pkthdr.rcvif != NULL && ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0)) {

                struct sockaddr_in *verrev_dst;

                verrev_dst = (struct sockaddr_in *)&(verrev_ro.ro_dst);

                /* Check if we've cached the route from the previous call. */
                verrev_ro.ro_rt = NULL;

                bzero(verrev_dst, sizeof(*verrev_dst));
                verrev_dst->sin_family = AF_INET;
                verrev_dst->sin_len = sizeof(*verrev_dst);
                verrev_dst->sin_addr = ip->ip_src;
                rtalloc_ign(&verrev_ro, RTF_CLONING|RTF_PRCLONING);

                if ((verrev_ro.ro_rt == NULL) || (verrev_ro.ro_rt->rt_ifp->if_index != 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0AF1BBDF1218F14E9B4CCE414744E70F5D96C7>