kernel protocol ignores default preference during scan

Maria Matejka maria.matejka at nic.cz
Tue Sep 27 11:53:30 CEST 2022


Hello!

I've used your original patch, for now I don't like doing much 
refactoring like this to keep merging with v3 as simple as possible.

Anyway, thank you for sending the patch, I've implemented a 
kernel-route-learn test, found out that indeed there is the bug you 
found and applied it.

Have a nice day!
Maria

On 9/22/22 21:19, Alexander Zubkov wrote:
> And just an idea. I've attached the patch as an example, although it
> should be functional too. I mentioned that functions krt_learn_async()
> and krt_learn_scan() are very similar and I thought that it may be
> useful to join them into a single function. If I did not make a
> mistake, all code pathes should be almost the same, with a couple of
> minor exceptions:
> 1) old_best is set in the beginning, but was earlier only for async version
> 2) g = NULL after rte_free(g) in one of the branches, but it does not
> affect anything and may be dropped
> 
> On Wed, Sep 21, 2022 at 6:00 PM Maria Matejka via Bird-users
> <bird-users at network.cz> wrote:
>>
>> Hello!
>>
>> Thank you for finding and fixing. Will check and include.
>>
>> Maria
>>
>> On 9/21/22 17:15, Alexander Zubkov via Bird-users wrote:
>>> I made a trivial patch for the case.
>>>
>>> On Tue, Sep 20, 2022 at 6:23 PM Alexander Zubkov <green at qrator.net> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Bird from master branch ignores the default preference set in channel
>>>> for a kernel protocol, like that:
>>>>
>>>> protocol kernel {
>>>>           learn yes;
>>>>           ipv4 {
>>>>                   preference 200;
>>>>                   import all;
>>>>                   export none;
>>>>           };
>>>> }
>>>>
>>>> Version 2.0.10 seems ok. I suppose the change was introduced with this commit:
>>>>
>>>> https://gitlab.nic.cz/labs/bird/-/commit/eb937358c087eaeb6f209660cc7ecfe6d6eff739
>>>>
>>>> It adds setting of the preference to the krt_learn_async() function.
>>>> But as I understand when route is learned with netlink hook it is
>>>> processed like this:
>>>> nl_parse_route -> krt_got_route_async -> krt_learn_async
>>>> But when it is learned from scan, it is processed like this:
>>>> nl_parse_route -> krt_got_route -> krt_learn_scan
>>>>
>>>> And setting preference was not added to krt_learn_scan() function.
>>>>
>>>> I also saw that in my test - when I added a new route to the kernel
>>>> while bird was running, it appeared in bird with correct preference.
>>>> But some time after, the scan updated the route and it was replaced
>>>> with the default preference.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2839 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20220927/69141fe0/attachment.p7s>


More information about the Bird-users mailing list