On 2016/06/08 16:23, Martin Pieuchot wrote:
> Being able to remove the requirement of an configured address for every
> route entry would have multiple benefit:
> 
>   . We could add route before the interface gets an address (useful in
>     some p2p configurations)
>   . The kernel wouldn't have to manage stale ifas
>   . The network data structures would be less coupled, making it easier
>     to write SMP safe code (yes I found new bugs!)
> 
> In order to achieve such goal we should preserve the "source routing"
> feature.  Which mean that route entry MUST still carry an address.
> 
> So the diff below adds a `rt_addr' field that will for the moment be a
> copy of `rt_ifa->ifa_addr'.  Once all the `rt_ifa' occurrences are
> converted to `rt_addr' we can relax the logic for adding a route.

The diff looks correct to me (and hasn't blown up yet) and
I like the free() cleanup in rtfree().

rt_ifa is shared when multiple route table entries use the same
local address and all the route table entries are updated if the
local address changes (i.e. we don't just change the address
inside rt_ifa->ifa_addr), so this change of approach doesn't
really add extra work if a well-used local address is changed.
(I thought about this for a few minutes because we don't want
a bunch of unexpected extra work for full-table routers).

I checked that rt_addr gets updated correctly when we change
local address, this works fine.

OK sthen@.

Do you want to add 'db_printf(" addr="); db_print_sa(rt->rt_addr);'
to db_show_rtentry as well?

Reply via email to