Thread (87 messages) 87 messages, 6 authors, 2006-07-09

Re: [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device

From: Ben Greear <hidden>
Date: 2006-06-30 15:40:43

jamal wrote:
On Fri, 2006-30-06 at 16:15 +0200, Thomas Graf wrote:
quoted
You agreed in
your last posting that the 3rd option, being that not caring about
whether a device might disappear but having a way to check for it,
is what we agreed on and what makes most sense, 

yes, i recalled that as the last discussion we had.

quoted
yet you fail to see
that using ifindex is exactly what reflects this descision.

The choice is between using an ifindex and a pointer to the device. 
Why is it solvable via an ifindex but not a device pointer?
I may have misunderstood you, so look at this as a fresh opportunity to
enlighten me. Forget about all the discussion weve had thus far.
If you use a pointer, without taking it's reference, then that device
can go away, and leave you with a stale memory access, ie kernel crash
or worse.

If you take a reference for every packet (which means an atomic op), then
you slow down every packet, even those that will never use the reference.

If you instead use the if-index, then you do not need to take a reference
for every packet, but only when you actually want to look at that device.
If the device has since disappeared, then you get a null when trying to find
by reference, and the code can take appropriate action.  No chance for
access of stale memory.

Ben

-- 
Ben Greear [off-list ref]
Candela Technologies Inc  http://www.candelatech.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help