Subject: Re: Q's from if_detach work
To: None <firstname.lastname@example.org>
From: Chuck Cranor <email@example.com>
Date: 07/15/1997 20:30:44
>The main question is that the atm code seems to change the interface
>on a received packet arbitrarily. In sys/net/if_atmsubr.c, in
>atm_input (around line 236 or so), in the #ifdef NATM section,
>m->m_pkthdr.rcvif gets set to rxhand.
Demux for ATM network interfaces is done in hardware (based on the VC
number). The code you are looking at is designed to take advantage of
this (e.g. why do a linked list search (or hash search?) for a protcol
control block when the hardware has already told you what VC the data
>But what is rxhand?
rxhand is a cookie which was passed to the driver at the time the VC
was opened (see PRU_CONNECT in netnatm/natm.c). the driver blindly
passes a VC's cookie to atm_input() as data comes in on that VC (this
is the code if sys/net/if_atmsubr.c you are looking at). for IP
this is not useful since we will get many different TCP/UDP connections
on the same VC (so we need to look at the address and port number info
in the IP header anyway). thus, for IP rxhand (the cookie) will
always be NULL. when rxhand is NULL, nothing messes with
m_pkthdr.rcvif (i.e. the traditional case...).
however, for NATM we have one connection per VC. we can let the
hardware do all the demux work for us. so, the netnatm protocol
passes the address of the NATM PCB in as the cookie. the
m_pkthdr.rcvif gets overloaded with this cookie info (note "XXX"
comments). note that this behavior only happens with protocols that
ask for it (netnatm).
>Do we loose contact with the interface from which this packet came?
no, because a copy of the interface pointer is stored in the NATM
protocol block (see "struct natmpcb" in netnatm/natm.h). once
you cast rxhand to a (struct natmpcb *) you have access to the ifnet
>Other q: I've got a tentative routine to walk the routing tables and
>delete straggling routes. But I'm not sure how to actually delete the
>route. I looked in the headers, and didn't see a routine for, "here's
>the rtentry, delete it."
netnatm doesn't use the routing table. however, for IP using ATM
you have to add a static route to use a VC:
route add -iface 188.8.131.52 -link en0:184.108.40.206
when you add this route, the code in netinet/if_atm.c calls down
to the hardware to enable the specified VC (in the above case it
would say that 220.127.116.11 is on VCI 4 using AAL5). when you are
done with the VC you use a route delete. the code in netinet/if_atm.c
will then call down to the driver to disable the specified VC.
i'm not sure how that fits in with your if_detach plans.