Skip to content

Commit

Permalink
Fix for failed arp entries, minor display modification (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny committed Dec 7, 2018
1 parent 17519cf commit 2a7c301
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/nbrshow
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ class NbrBase(object):
mac = unicode(ent[1].upper())
fdb_ent = next((fdb for fdb in self.bridge_mac_list[:]
if fdb[0] == vlanid and fdb[1] == mac), None)
vlan = vlanid
if fdb_ent is not None:
vlan = vlanid
ent[2] = fdb_ent[2]

else:
ent[2] = '-'
ent.insert(vpos, vlan)
output.append(ent)

Expand Down Expand Up @@ -171,6 +172,9 @@ class ArpShow(NbrBase):
return

for line in self.arpraw.splitlines()[1:]:
if 'ether' not in line.split():
continue

ent = line.split()[::2]
self.nbrdata.append(ent)

Expand Down Expand Up @@ -208,7 +212,14 @@ class NeighShow(NbrBase):
return

for line in self.arpraw.splitlines()[:]:
ent = line.split()[::2]
split = line.split()
if 'lladdr' not in split:
continue

ent = split[::2]

if 'router' not in split:
ent.append(split[-1])

if self.iface is not None:
ent.insert(2, self.iface)
Expand Down

0 comments on commit 2a7c301

Please sign in to comment.