On 05/27/2015 11:32 AM, Christy Perez wrote:
Thanks guys! I'll look into both those.
On 05/27/2015 11:21 AM, CrÃstian Deives wrote:
> On 27-05-2015 13:19, Aline Manera wrote:
>>
>> Hi Christy,
>>
>> Your patch looks good.
>>
>> I just have one suggestion. There is a python module name scapy that
>> has some ARP methods.
>> On Ubuntu the package is python-scapy.
>> I am not sure it is available in all major Linux distribution, but I
>> think we could take a look on it.
I looked into the scapy package, and it looks like a *lot* of overhead
to get arp cache entries. The documentation's not that great (the scapy
website search even hung), so I grepped the source and poked around in
layers/l2.py. I couldn't find a straight-forward way to get ARP cache
entries. There's a method called getmacbyip, but it looks like it
requires some setup:
>> scapy.layers.l2.getmacbyip('192.168.0.1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/scapy/layers/l2.py", line 57,
in getmacbyip
iff,a,gw = conf.route.route(ip)
AttributeError: 'NoneType' object has no attribute 'route'
So, unless you know there's a simple way to do this and I'm missing it,
I don't think this package will actually beneficial to us.
>
> Or you could read the file /proc/net/arp. It's pretty much the same
> output of "arp -n" and it doesn't require new dependencies..
>
Is it guaranteed that this file will exist on every distro? This seems
to be the simplest way to go.