Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndb: fix FDB non-uniquness on different FLAGS #1200

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

pkulev
Copy link
Contributor

@pkulev pkulev commented Jun 27, 2024

Closes: #1159

I didn't read logs carefully, unfortunately :)

Every time we got FDB missing we got the following 3 reschedules followed by drop as well:

2024-06-27 10:30:36,747    DEBUG pyroute2.ndb.139893147176048.main: reschedule {'family': 7, '__pad': (), 'ifindex': 28, 'state': 128, 'flags': 2, 'ndm_type': 0, 'attrs': [('NDA_LLADDR', '1c:34:da:3c:71:2c'), ('NDA_IFINDEX', 28), ('NDA_DST', ''), ('NDA_VLAN', 0)], 'header': {'length': 40, 'type': 28, 'flags': 2, 'sequence_number': 257, 'pid': 4060981674, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0), 'rcounter': 1}, 'event': 'RTM_NEWNEIGH'}
2024-06-27 10:30:37,040    DEBUG pyroute2.ndb.139893147176048.main: reschedule {'family': 7, '__pad': (), 'ifindex': 28, 'state': 128, 'flags': 2, 'ndm_type': 0, 'attrs': [('NDA_LLADDR', '1c:34:da:3c:71:2c'), ('NDA_IFINDEX', 28), ('NDA_DST', ''), ('NDA_VLAN', 0)], 'header': {'length': 40, 'type': 28, 'flags': 2, 'sequence_number': 257, 'pid': 4060981674, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0), 'rcounter': 2}, 'event': 'RTM_NEWNEIGH'}
2024-06-27 10:30:37,079    DEBUG pyroute2.ndb.139893147176048.main: reschedule {'family': 7, '__pad': (), 'ifindex': 28, 'state': 128, 'flags': 2, 'ndm_type': 0, 'attrs': [('NDA_LLADDR', '1c:34:da:3c:71:2c'), ('NDA_IFINDEX', 28), ('NDA_DST', ''), ('NDA_VLAN', 0)], 'header': {'length': 40, 'type': 28, 'flags': 2, 'sequence_number': 257, 'pid': 4060981674, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0), 'rcounter': 3}, 'event': 'RTM_NEWNEIGH'}
2024-06-27 10:30:37,084    ERROR pyroute2.ndb.139893147176048.main: drop {'family': 7, '__pad': (), 'ifindex': 28, 'state': 128, 'flags': 2, 'ndm_type': 0, 'attrs': [('NDA_LLADDR', '1c:34:da:3c:71:2c'), ('NDA_IFINDEX', 28), ('NDA_DST', ''), ('NDA_VLAN', 0)], 'header': {'length': 40, 'type': 28, 'flags': 2, 'sequence_number': 257, 'pid': 4060981674, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0), 'rcounter': 3}, 'event': 'RTM_NEWNEIGH'}

After logging the error I understood that there were 2 FDBs very similar, only difference was flags and master:

In [40]: ip.fdb('dump')
Out[40]:

(
    ...
    {
        'family': 7,
        '__pad': (),
        'ifindex': 28,
        'state': 128,
        'flags': 0,
        'ndm_type': 0,
        'attrs': [
            ('NDA_LLADDR', '1c:34:da:3c:71:2c'),
            ('NDA_MASTER', 39),
            ('NDA_CACHEINFO', {'ndm_confirmed': 0, 'ndm_used': 3401745381, 'ndm_updated': 3401745381, 'ndm_refcnt': 0})
        ],
        'header': {
            'length': 68,
            'type': 28,
            'flags': 2,
            'sequence_number': 266,
            'pid': 3070174158,
            'error': None,
            'target': 'localhost',
            'stats': Stats(qsize=0, delta=0, delay=0)
        },
        'event': 'RTM_NEWNEIGH'
    },
    {
        'family': 7,
        '__pad': (),
        'ifindex': 28,
        'state': 128,
        'flags': 2,
        'ndm_type': 0,
        'attrs': [('NDA_LLADDR', '1c:34:da:3c:71:2c')],
        'header': {
            'length': 40,
            'type': 28,
            'flags': 2,
            'sequence_number': 266,
            'pid': 3070174158,
            'error': None,
            'target': 'localhost',
            'stats': Stats(qsize=0, delta=0, delay=0)
        },
        'event': 'RTM_NEWNEIGH'
    },
    ...
)
In [34]: list(ndb.fdb.dump())
Out[34]:

[
    ...
    ('localhost', 0, 7, 28, 128, 0, 0, '', '1c:34:da:3c:71:2c', None, 0, None, None, 28, 39, None, None),
    ...
]

After making flags field a part of unique index that entry did showed up in the DB:

In [1]: list(ndb.fdb.dump())
Out[1]:
[
    ...
    ('localhost', 0, 7, 28, 128, 0, 0, '', '1c:34:da:3c:71:2c', None, 0, None, None, 28, 39, None, None)
    ('localhost', 0, 7, 28, 128, 2, 0, '', '1c:34:da:3c:71:2c', None, 0, None, None, 28, None, None, None)
    ...
]

@svinota svinota merged commit 6655907 into svinota:master Jul 1, 2024
16 of 18 checks passed
@svinota
Copy link
Owner

svinota commented Jul 1, 2024

Thanks!

@odivlad odivlad deleted the bugfix/fdb-missing-event branch July 2, 2024 12:11
@odivlad odivlad restored the bugfix/fdb-missing-event branch July 2, 2024 12:12
@pkulev pkulev deleted the bugfix/fdb-missing-event branch July 9, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants