rtentry and rtrequest
Alan Garfield
alan at fromorbit.com
Wed Apr 18 01:50:10 UTC 2007
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.
More information about the freebsd-net
mailing list