diff --git a/src/MakeApp.mk b/src/MakeApp.mk index 68df097..abcb365 100644 --- a/src/MakeApp.mk +++ b/src/MakeApp.mk @@ -5,7 +5,7 @@ all: nethogs decpcap_test # nethogs_testsum CFLAGS?=-Wall -Wextra -CXXFLAGS?=-Wall -Wextra +CXXFLAGS?=-Wall -Wextra -Wno-missing-field-initializers OBJS=packet.o connection.o process.o decpcap.o cui.o inode2prog.o conninode.o devices.o diff --git a/src/MakeLib.mk b/src/MakeLib.mk index 42c9d1e..88969dd 100644 --- a/src/MakeLib.mk +++ b/src/MakeLib.mk @@ -23,12 +23,12 @@ ifeq ($(DEBUG),1) $(info Bulding debug version) ODIR:=$(ODIR_BASE)/lib/debug CFLAGS?=-Wall -Wextra -O0 -g -fPIC $(VISIBILITY) - CXXFLAGS?=-Wall -Wextra --std=c++0x -O0 -g -fPIC $(VISIBILITY) $(CXXINCLUDES) + CXXFLAGS?=-Wall -Wextra -Wno-missing-field-initializers --std=c++0x -O0 -g -fPIC $(VISIBILITY) $(CXXINCLUDES) else # Release mode options ODIR:=$(ODIR_BASE)/lib/release CFLAGS?=-Wall -Wextra -O3 -fPIC $(VISIBILITY) - CXXFLAGS?=-Wall -Wextra --std=c++0x -O3 -fPIC $(VISIBILITY) $(CXXINCLUDES) + CXXFLAGS?=-Wall -Wextra -Wno-missing-field-initializers --std=c++0x -O3 -fPIC $(VISIBILITY) $(CXXINCLUDES) endif OBJ_NAMES= libnethogs.o packet.o connection.o process.o decpcap.o inode2prog.o conninode.o devices.o diff --git a/src/conninode.cpp b/src/conninode.cpp index 5a8b17b..430162f 100644 --- a/src/conninode.cpp +++ b/src/conninode.cpp @@ -60,8 +60,8 @@ std::map conninode; */ void addtoconninode(char *buffer) { short int sa_family; - struct in6_addr result_addr_local; - struct in6_addr result_addr_remote; + struct in6_addr result_addr_local = {}; + struct in6_addr result_addr_remote = {}; char rem_addr[128], local_addr[128]; int local_port, rem_port; @@ -102,8 +102,8 @@ void addtoconninode(char *buffer) { if ((in6_local.s6_addr32[0] == 0x0) && (in6_local.s6_addr32[1] == 0x0) && (in6_local.s6_addr32[2] == 0xFFFF0000)) { /* IPv4-compatible address */ - result_addr_local = *((struct in6_addr *)&(in6_local.s6_addr32[3])); - result_addr_remote = *((struct in6_addr *)&(in6_remote.s6_addr32[3])); + result_addr_local.s6_addr32[0] = in6_local.s6_addr32[3]; + result_addr_remote.s6_addr32[0] = in6_remote.s6_addr32[3]; sa_family = AF_INET; } else { /* real IPv6 address */ diff --git a/src/packet.cpp b/src/packet.cpp index 930a449..5946740 100644 --- a/src/packet.cpp +++ b/src/packet.cpp @@ -124,7 +124,6 @@ struct tcp_hdr { #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 -#define TH_FLAGS (TH_FIN | TH_SYN | TH_RST | TH_ACK | TH_URG | TH_ECE | TH_CWR) u_short th_win; /* window */ u_short th_sum; /* checksum */ u_short th_urp; /* urgent pointer */