aboutsummaryrefslogtreecommitdiffstats
path: root/spike/libpcap_pcap_lookupnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'spike/libpcap_pcap_lookupnet.c')
-rw-r--r--spike/libpcap_pcap_lookupnet.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/spike/libpcap_pcap_lookupnet.c b/spike/libpcap_pcap_lookupnet.c
new file mode 100644
index 0000000..f330001
--- /dev/null
+++ b/spike/libpcap_pcap_lookupnet.c
@@ -0,0 +1,16 @@
+#include <pcap.h>
+
+int
+main(void) {
+ int err;
+ char errbuf[PCAP_ERRBUF_SIZE];
+ bpf_u_int32 netp, maskp;
+
+ err = pcap_lookupnet("eth0", &netp, &maskp, errbuf);
+ if (err < 0) {
+ printf("pcap_lookupnet failed %d\n", err);
+ return err;
+ }
+ printf("result: %x %x\n", netp, maskp);
+ return 0;
+}