Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2007 11:50:09 +1000
From:      Alan Garfield <alan@fromorbit.com>
To:        freebsd-net@freebsd.org
Subject:   rtentry and rtrequest
Message-ID:  <1176861009.4426.21.camel@hiro.auspc.com.au>

next in thread | raw e-mail | index | archive | help
Hi all!

One word.... HOW! :)

I've no clue what this FreeBSD ARP stuff is all about, there is little
or no documentation, there are 14 different sock_addr's which seem to
have a bazillion different fields, and I cannot output a simple debug
statement without getting 'error: dereferencing pointer to incomplete
type' errors!

Sorry for the rant, I'm just frustrated. :) I've been going great on
this port, but now I've struck ARP and have been stuck for days and I
cannot seem to get myself out no matter how much kernel code I grep it
still all looks Greek to me.

I understand what ARP is and how it does it's thing. I even understand
how Linux does it, but I cannot get a handle on how/why FreeBSD does
what it does.

Can someone point me in the direction or give an example to output debug
from an rtrequest method. Currently I've got :-

----
static void     
jnet_rtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo
*info)                                                               
{
        struct ifnet *ifp = rt->rt_ifp;
        struct jnet_softc *sc =
ifp->if_softc;                                                                                      

        RT_LOCK_ASSERT(rt);

        switch (cmd)
{                                                                                                              

                 case
RTM_ADD:                                                                                                      
                         device_printf(sc->dev, "RTM_ADD. \n");
                                                                                                                                    
                         if (SIN(rt_key(rt))->sin_family == AF_INET)
{                                                              
                                 device_printf(sc->dev, "AF_INET
\n");                                                               
                         }


break;                                                                                                     

                 case RTM_RESOLVE:
                         device_printf(sc->dev, "RTM_RESOLVE.
\n");                                                                 

break;                                                                                                     

                 case RTM_DELETE:
                         device_printf(sc->dev, "RTM_DELETE.
\n");                                                                  
                         break;
        }

        rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;
}
----

I just want an idea of the structures involved, and what I need to
implement to intercept and injecting a fake MAC so my buffer driver can
communicate with the other side without ARP errors.

Any help would be more than appreciated (eg. I'd I'll buy you a case of
beer next time you're in Sydney Australia).

Thanks,
Alan.




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