[Olsr-dev] OLSRD RT refactoring
Sven-Ola Tuecke
(spam-protected)
Sun Aug 26 10:29:44 CEST 2007
Bernd, Hannes,
freeing the struct interface{} was introducted by Andreas Toennesen AFAIK.
There was also some fiddeling to query/detect the actual (maybe changed)
main IP adress in this scope - I remember some development cycles about
that topic. This may be the reason, why there are two data structures
describing ifaces (one static and one malloced/freed) and some
mapping/searching to link those two (grep for if_ifwithname).
To set/remove routes on the operating system, it is sufficient to have the
(O.S. internal) interface number. At least true for rtnetlink(linux) and
Win32. BSD may be similar - I'm no apple envangelist - but the code looks
unefficient IMO and this is something analog with the Linux ioctl() API:
olsrd: take iface num and search name
olsrd: set/del route with that name
bsd: take name and search iface num
bsd: set/del route with iface num
I didn't notice, that if_indextoname() is only avail on Vista. Anyhow, the
function is required for debugging OLSR_PRINT() and with the IPC stuff only
(Windose Switch GUI, old GTK GUI). May be substituted by a new function in
interfaces.c analog to the other "ifwith[...]" functions located there.
Fiddeling with malloced string pointers and refcounters under C/C++ is
always grmbls-w-t-f. So I vote for using the simple number instead of the
pointer ref, that's basically what the 102-*rtfixes*.patch does.
@bernd: the old ioctl() routing API is a compat wrapper for rtnetlink AFAIK.
There _are_ some automatics (e.g. use table 254, add the SCOPE=Link if no
VIA/GW) but in fact it should behave the same. Not setting the SCOPE for
hostroutes was a minor bug. I didn't noticed within my/our setups but you
do. So simply try it - as I wrote it is supposed to work.
// Sven-Ola
Bernd Petrovitsch wrote:
> On Sat, 2007-08-25 at 08:06 +0200, Sven-Ola Tuecke wrote:
>> Bernd,
>>
>> for advance routing implicatons, I recommend reading the
>> http://lartc.org/ . It's supposed to work. But who knows what special
>> stuff users may have configured on their local machines...
>
> Yes, that's basically my concern - and that is not criticism on your
> patch (or the approach as such) - it's just to avoid breaking *lots* of
> setups (and not really knowing why). And the "remove that automatically
> added route on Linux" is IIRC a by you somewhat recommended thing.
>
>> I need that for the freifunk firmware and for the ff-fonera-pack as
>> well - so in my opinion this is something others may want too. If you
>> dislike it, simply don't #ifdef LINUX_POLICY_ROUTING <ggg>
>>
>> Doesn't compile on Win32!? MSDN says that the function is in there. Have
>> a
>
> Well, I just typed "make build_all" on CygWin (like dozen of times
> before).
>
>> look here (you may need the Win32 full SDK installed IMO, maybe a typo?):
>>
>> http://msdn2.microsoft.com/en-us/library/bb408408.aspx
>
> ---- snip ----
> Remarks
> The if_indextoname function is available on Windows Vista and later.
> ---- snip ----
> Sorry, "only" Win-XP (and Win2000 - but I didn't try there) here. And
> given the current spread of Win-Vista, I think we need another solution.
> I (or someone else) should read that page and see if I find another
> function which exists here.
>
>> And as I wrote: Theres a quirks for BSD with IPv6. The analog IPv4
>> implementation looks uneffective too. Because it seeks the local iface
>> config table for every route to set or del for the iface source IP addr.
>
> Yes, it sounds so.
>
> Bernd
More information about the Olsr-dev
mailing list