summaryrefslogtreecommitdiff
path: root/netsniff-ng/Makefile
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-08-04 19:30:19 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-08-05 10:55:10 +0200
commit20a5e15443bfbbb7e6624a754832cdce19d462a0 (patch)
treee1bfc3dd5ae574279a53f2bc669a3ca863957117 /netsniff-ng/Makefile
parentc831bcda3e2638c55b286bd538415ea79f510cdb (diff)
netsniff-ng: Allow to compile without libnl
One might not want to install libnl just for sniffing packets, for example if netsniff-ng will be compiled on embedded or switch system. Hide libnl dependend code if CONFIG_LIBNL=0. In case the `--rfraw' option is used, the user will get a panic message. In case of netlink messages being sniffed, they will not be dissected. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'netsniff-ng/Makefile')
-rw-r--r--netsniff-ng/Makefile27
1 files changed, 17 insertions, 10 deletions
diff --git a/netsniff-ng/Makefile b/netsniff-ng/Makefile
index 6f9d0b2..d1d8a85 100644
--- a/netsniff-ng/Makefile
+++ b/netsniff-ng/Makefile
@@ -1,7 +1,4 @@
-netsniff-ng-libs = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-3.0) \
- $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-genl-3.0) \
- $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-route-3.0) \
- -lpthread
+netsniff-ng-libs = -lpthread
ifeq ($(CONFIG_LIBPCAP), 1)
netsniff-ng-libs += -lpcap
@@ -10,6 +7,11 @@ ifeq ($(CONFIG_GEOIP), 1)
netsniff-ng-libs += -lGeoIP \
-lz
endif
+ifeq ($(CONFIG_LIBNL), 1)
+netsniff-ng-libs += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-3.0) \
+ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-genl-3.0) \
+ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --libs libnl-route-3.0)
+endif
netsniff-ng-objs = dissector.o \
dissector_sll.o \
@@ -34,7 +36,6 @@ netsniff-ng-objs = dissector.o \
proto_ipv6_no_nxt_hdr.o \
proto_ipv6_routing.o \
proto_lldp.o \
- proto_nlmsg.o \
proto_none.o \
proto_tcp.o \
proto_udp.o \
@@ -63,7 +64,6 @@ netsniff-ng-objs = dissector.o \
ring.o \
tprintf.o \
timer.o \
- mac80211.o \
die.o \
sysctl.o \
netsniff-ng.o
@@ -77,11 +77,18 @@ endif
ifeq ($(CONFIG_HWTSTAMP), 1)
netsniff-ng-objs += tstamping.o
endif
+ifeq ($(CONFIG_LIBNL), 1)
+netsniff-ng-objs += mac80211.o \
+ proto_nlmsg.o
+endif
+
+netsniff-ng-eflags = -DNEED_TCPDUMP_LIKE_FILTER
-netsniff-ng-eflags = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-3.0) \
- $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-genl-3.0) \
- $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-route-3.0) \
- -DNEED_TCPDUMP_LIKE_FILTER
+ifeq ($(CONFIG_LIBNL), 1)
+netsniff-ng-eflags += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-3.0) \
+ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-genl-3.0) \
+ $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags libnl-route-3.0)
+endif
netsniff-ng-confs = ether.conf \
tcp.conf \