Skip to content

ip.neigh "dump" does not show IPv6 addresses #962

Closed
@ralonsoh

Description

@ralonsoh

Checking the code, I've seen that the version is added in [1]. This is because, regardless of explicitly adding the "family" parameter, the class context is empty [2]. I've dumped what is in self.context in [1]:
ChainMap({}, {})

That means it will try to gather always IPv4 rules.

Example:

root@u20ovn:/var/log# ip netns exec $ns ip neigh
240.0.0.3 dev testca217cd5 lladdr fa:16:3e:1b:1e:fa STALE
240.0.0.2 dev testca217cd5 lladdr fa:16:3e:6d:e0:0f PERMANENT
fd00::3 dev testca217cd5 lladdr fa:16:3e:12:27:93 STALE
fd00::2 dev testca217cd5 lladdr fa:16:3e:39:88:48 PERMANENT

import pyroute2
n=pyroute2.NetNS("ns-96fbd51139109958f", flags=0)
>>> a=n.neigh('dump', ifindex=2, family=10)                                                                                        
>>> 
>>> n.neigh('dump', ifindex=2, family=2)                                                                                                                                                                                                                              
({'family': 2, '__pad': (), 'ifindex': 2, 'state': 4, 'flags': 0, 'ndm_type': 1, 'attrs': [('NDA_DST', '240.0.0.3'), ('NDA_LLADDR', 'fa:16:3e:1b:1e:fa'), ('NDA_PROBES', 0), ('NDA_CACHEINFO', {'ndm_confirmed': 108851, 'ndm_used': 108851, 'ndm_updated': 104777, 'n
dm_refcnt': 0})], 'header': {'length': 76, 'type': 28, 'flags': 2, 'sequence_number': 274, 'pid': 1445087, 'error': None, 'target': 'ns-96fbd51139109958f', 'stats': Stats(qsize=0, delta=0, delay=0)}, 'event': 'RTM_NEWNEIGH'}, {'family': 2, '__pad': (), 'ifindex'
: 2, 'state': 128, 'flags': 0, 'ndm_type': 1, 'attrs': [('NDA_DST', '240.0.0.2'), ('NDA_LLADDR', 'fa:16:3e:6d:e0:0f'), ('NDA_PROBES', 0), ('NDA_CACHEINFO', {'ndm_confirmed': 108854, 'ndm_used': 108854, 'ndm_updated': 108854, 'ndm_refcnt': 0})], 'header': {'lengt
h': 76, 'type': 28, 'flags': 2, 'sequence_number': 274, 'pid': 1445087, 'error': None, 'target': 'ns-96fbd51139109958f', 'stats': Stats(qsize=0, delta=0, delay=0)}, 'event': 'RTM_NEWNEIGH'})

[1]

if 'family' not in context:
context['family'] = AF_INET

[2]
self.context = (
context if isinstance(context, (dict, weakref.ProxyType)) else {}
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions