Skip to content

Commit 39061a5

Browse files
Merge pull request #280 from robertdavidgraham/libpcap
dynamically load pcap
2 parents 6c9abcb + 7872876 commit 39061a5

33 files changed

+690
-3256
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endif
1313
# environment where things likely will work -- as well as anything
1414
# works on the bajillion of different Linux environments
1515
ifneq (, $(findstring linux, $(SYS)))
16-
LIBS = -lpcap -lm -lrt -ldl -lpthread
16+
LIBS = -lm -lrt -ldl -lpthread
1717
INCLUDES =
1818
FLAGS2 =
1919
endif
@@ -23,7 +23,7 @@ endif
2323
# my regularly regression-test environment. That means at any point
2424
# in time, something might be minorly broken in Mac OS X.
2525
ifneq (, $(findstring darwin, $(SYS)))
26-
LIBS = -lpcap -lm
26+
LIBS = -lm
2727
INCLUDES = -I.
2828
FLAGS2 =
2929
INSTALL_DATA = -pm755
@@ -37,7 +37,7 @@ endif
3737
# intended environment, so it make break in the future.
3838
ifneq (, $(findstring mingw, $(SYS)))
3939
INCLUDES = -Ivs10/include
40-
LIBS = -L vs10/lib -lwpcap -lIPHLPAPI -lWs2_32
40+
LIBS = -L vs10/lib -lIPHLPAPI -lWs2_32
4141
FLAGS2 = -march=i686
4242
endif
4343

@@ -47,20 +47,20 @@ endif
4747
# head with a hammer and want to feel a different sort of pain.
4848
ifneq (, $(findstring cygwin, $(SYS)))
4949
INCLUDES = -I.
50-
LIBS = -lwpcap
50+
LIBS =
5151
FLAGS2 =
5252
endif
5353

5454
# OpenBSD
5555
ifneq (, $(findstring openbsd, $(SYS)))
56-
LIBS = -lpcap -lm -pthread
56+
LIBS = -lm -pthread
5757
INCLUDES = -I.
5858
FLAGS2 =
5959
endif
6060

6161
# FreeBSD
6262
ifneq (, $(findstring freebsd, $(SYS)))
63-
LIBS = -lpcap -lm -pthread
63+
LIBS = -lm -pthread
6464
INCLUDES = -I.
6565
FLAGS2 =
6666
endif

src/in-report.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ cndb_add(unsigned ip, const unsigned char *name, size_t name_length)
7070

7171
/***************************************************************************
7272
***************************************************************************/
73+
#if 0
7374
static void
7475
cndb_add_cn(unsigned ip, const unsigned char *data, size_t length)
7576
{
@@ -106,9 +107,11 @@ cndb_add_cn(unsigned ip, const unsigned char *data, size_t length)
106107
/* now insert into database */
107108
cndb_add(ip, data+name_offset, name_length);
108109
}
110+
#endif
109111

110112
/***************************************************************************
111113
***************************************************************************/
114+
#if 0
112115
static unsigned
113116
found(const char *str, size_t str_len, const unsigned char *p, size_t length)
114117
{
@@ -123,6 +126,7 @@ found(const char *str, size_t str_len, const unsigned char *p, size_t length)
123126
}
124127
return 0;
125128
}
129+
#endif
126130

127131
enum {
128132
XUnknown,

src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,14 +1428,15 @@ main_scan(struct Masscan *masscan)
14281428

14291429

14301430

1431+
void pcap_init(void);
14311432

14321433
/***************************************************************************
14331434
***************************************************************************/
14341435
int main(int argc, char *argv[])
14351436
{
14361437
struct Masscan masscan[1];
14371438
unsigned i;
1438-
1439+
14391440
usec_start = pixie_gettime();
14401441
#if defined(WIN32)
14411442
{WSADATA x; WSAStartup(0x101, &x);}
@@ -1506,6 +1507,7 @@ int main(int argc, char *argv[])
15061507

15071508
/* We need to do a separate "raw socket" initialization step. This is
15081509
* for Windows and PF_RING. */
1510+
pcap_init();
15091511
rawsock_init();
15101512

15111513
/* Init some protocol parser data structures */

src/masscan-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef MASSCAN_VERSION
22

3-
#define MASSCAN_VERSION "1.0.3"
3+
#define MASSCAN_VERSION "1.0.4"
44

55
#endif
66

0 commit comments

Comments
 (0)