-
Notifications
You must be signed in to change notification settings - Fork 154
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
reduce size by using search.h for hashtable. #15
Comments
Also by commenting out the usage I was able to reduce the binary by 20 KB! |
Something like this: https://gist.github.com/cirocosta/e61e52cc6afe2633500b |
I did fix some stuff over at https://github.com/nihilus/arp-scan |
You can easily look at the changes related to the hashmap. However I am not sur how this handles dupes. |
I'll look at using the hcreate(), hsearch() and hdestroy() posix functions instead of the hash table implementation that I borrowed from gas. The main thing I need to check is that these functions are available on all platforms that arp-scan is used on. That is basically the various flavours of Linux and BSD, as Solaris is not used as much as it used to be. I'm interested in the reasons behind the changes you've made. I see that you've slimmed things down a lot - is this to reduce the memory footprint of the resulting executable? |
@royhills yeah, a footprint of 350kb (MIPS32r2 ISA) when statically linked aginst plain libpcap is undesirable on an embedded Linux system so I figured out I better forked it off and tailored it after my needs. Contrary to the reentrant hashmap functions (e.g. hsearch_r()) my changes were made to work on OS X. |
I've implemented your suggestion, and it seems to work fine: it builds and passes checks on Linux (Debian Jessie), FreeBSD 10.2 and Solaris 10 u11, all on x86_64 architecture. I'll check out the other popular systems when I get time. If you know you'll always be running on Linux, and never BSD or Solaris, you could reduce your footprint a bit by removing link-bpf and link-dlpi and just keeping link-packet-socket. You could also remove the configure.ac logic that chooses between the various link layer implementations to obtain the MAC address. |
The new version also works on FreeBSD 9.3, NetBSD 6.0.1 and NetBSD 7.0.1. So I suspect it's pretty portable. I'm closing this issue now, as I believe it is resolved. |
For embedded Linux where space is a constraint it would be good if the hashtable used standard <search.h> hashtable functions.
The text was updated successfully, but these errors were encountered: