Thread (13 messages) flat view 13 messages, 5 authors, 2012-02-15

Re: [RFC V2 PATCH] rtnetlink: Fix problem with buffer allocation

From: David Miller <davem@davemloft.net>
Date: 2012-02-14 21:31:41

From: "Rose, Gregory V" <redacted>
Date: Tue, 14 Feb 2012 21:27:59 +0000
That's a real sticky problem.  When the dump request comes in we
don't know how big the required buffer might actually get.  That's
why we used to have the min_ifinfo_dump_size.  However there were
problems with that also so Dave asked me to get rid of it.  The only
thing I could come up with just allocating a really big buffer.  If
someone could point out to me how to get a maximum ifinfo dump size
before rtnl_dump_ifinfo starts filtering through the matching
interfaces then that would really help.  But at the point the dump
request comes in we don't know beforehand how to calculate the info
dump size because if_nlmsg_size() requires a pointer to a netdevice.
Two quick ideas:

1) Have a first pass which iterates over the devices and calculates
   the maximum of all if_nlmsg_size() calculations over those devices
   then uses that for the dump buffer allocation size.

2) Replace min_ifinfo_dump_size() with an array of sizes, one for
   each combination of extended features.  The only concern with this
   one is that whilst it's practical to do this now with only 1 or
   a few feature bits, in the future it may be a lot less practical.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help