pyroute2 icon indicating copy to clipboard operation
pyroute2 copied to clipboard

Regression in IPRoute.neigh when ext_ack + strict_check are enabled

Open ffourcot opened this issue 2 years ago • 5 comments

Hello,

I'm currently not sure of what really happens, but after a pyroute2 upgrade I got a regression on neighbours dump:

ipr = IPRoute(strict_check=True, ext_ack=True)
ipr.neigh("dump", family=2)

=> NetlinkError: (22, 'Invalid values in header for neighbor dump request')

I don't have time today to debug deeper. But since I saw a recent refactoring on this method, it has perhaps a link with this issue.

ffourcot avatar Apr 23 '22 00:04 ffourcot

Is it the master branch?

svinota avatar Apr 23 '22 13:04 svinota

Found the commit: 9967caef4e5be365a5a0bac3950a5804554af45e

svinota avatar Apr 23 '22 14:04 svinota

@svinota good catch, thanks! So relevant part is now in file pyroute2.core/pr2modules/iproute/req.py:

class IPNeighRequest(IPRequest):
    def fix_request(self):
        if 'nud' in self:
            self['state'] = self.pop('nud')
            log.warning('use `state` instead of `nud`')
        if 'state' not in self:
            self['state'] = NUD_PERMANENT
        if 'dst' in self and 'family' not in self:
            self['family'] = get_address_family(self['dst'])
        if isinstance(self['state'], basestring):
            self['state'] = ndmsg.states_a2n(self['state'])
        if 'family' not in self:
            self['family'] = AF_INET

We should not set NUD_PERMANENT for dump requests. I'm not familiar with this new req module, what is the best way for you to fix this?

ffourcot avatar Apr 23 '22 20:04 ffourcot

I'm to fix that tonight, just changed the req module to make possible such discrimination.

svinota avatar Apr 24 '22 16:04 svinota

Tests will follow tomorrow

svinota avatar Apr 24 '22 21:04 svinota