I am currently working on a small project which captures packets and triggers an external application or script when a specific limit exceeds to handle following steps (which could be for example alerting, null routing etc).
I tried to create a really simple trigger with this code ("trigger" contains the path to binary or script):
char * trigger_complete;
sprintf(trigger_complete, "%s %u %u %s %s %Lf", trigger, data[II].count, data[II].proto, inet_ntoa(data[II].src_ip), inet_ntoa(data[II].dst_ip), rate);
system (trigger_complete);
On my Ubuntu 12.04.1 LTS it seems to work without issues, I tested with the "echo" application.
linux-gate.so.1 => (0xb779f000)
libpcap.so.0.8 => /usr/lib/i386-linux-gnu/libpcap.so.0.8 (0xb7752000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75a8000)
/lib/ld-linux.so.2 (0xb77a0000)
On a Debian Wheezy and an instance of "grml" I receive Segmentation Fault when executing the binary. (I verified that this issue is caused by the piece of code above by commenting it out and re-try.)
linux-vdso.so.1 => (0x00007fff875ff000)
libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007fa9c6048000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa9c5cbe000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa9c608d000)
The only difference I see is the architecture, the Ubuntu system is a 32 bit os while the Debian is a 64 bit os.
I am not sure if this is the issue, but it seems like it is.
Can anyone help me out with this?
Thank you in advance!