Skip to content

Commit 5a15050

Browse files
committed
Merge branch '4.3' into Bug_#418_2nd_packet_no_delay
* 4.3: (22 commits) Bug #418 don't ignore 2nd packet timing Bug #411 allow TAP on all platforms Bug #174 ensure --with-testnic does not affect replay Bug #406 change packet length to network order Bug #413 fix manpage typos Bug #485 Heap overflow fixed in #484 Enhancement_#482 update CHANGELOG/CREDITS Enhancement_#482 test Makefile merge error fixup Enhancement_#482 test Makefile cleanup Bug #489 free after memcpy Bug #488 heap overflow csum replace4 (#496) Bug #486 CVE-2018-17974 realloc memory if packet size increases (#492) Enhancement #493 - fixes for Codacy identified issues Bug #486 Enforce max snaplen rather than doing realloc Bug #486 CVE-2018-17974 realloc memory if packet size increases Bug #484 CVE-2018-17582 Check for corrupt PCAP files 4.3 - revert travis updates from merge Simplify plugin Makefiles allow out-of-tree build Remove dead code ...
2 parents f4ed4bd + a5f7532 commit 5a15050

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+995
-805
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Tcpreplay
22
=========
33
[![Build Status](https://travis-ci.org/appneta/tcpreplay.svg?branch=master)](https://travis-ci.org/appneta/tcpreplay)
44
[![Coverity Scan Build Status](https://scan.coverity.com/projects/12017/badge.svg)](https://scan.coverity.com/projects/12017)
5-
[![Code Climate](https://codeclimate.com/github/appneta/tcpreplay.png)](https://codeclimate.com/github/appneta/tcpreplay)
65
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e49d208c69e440182ba21109ecaf31d)](https://www.codacy.com/app/fklassen/tcpreplay?utm_source=github.com&utm_medium=referral&utm_content=appneta/tcpreplay&utm_campaign=badger)
76
[![Website](https://img.shields.io/website-up-down-green-red/http/shields.io.svg)](http://tcpreplay.appneta.com)
87

autogen.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/bin/sh
2+
3+
set -e
4+
5+
cd $(dirname $0)
6+
27
rm -f config/config.guess config/config.sub config/ltmain.sh 2>/dev/null
38
rm -f aclocal.m4 2>/dev/null
49
aclocal -I libopts/m4/

configure.ac

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dnl $Id$
44
AC_PREREQ([2.69])
55

66
dnl Set version info here!
7-
AC_INIT([tcpreplay],[4.3.0-beta1],
7+
AC_INIT([tcpreplay],[4.3.0-beta2],
88
[https://github.com/appneta/tcpreplay/issues],
99
[tcpreplay],
1010
[http://tcpreplay.sourceforge.net/])
@@ -544,6 +544,7 @@ AC_ARG_ENABLE(dynamic-link,
544544
AC_MSG_ERROR([Cannot specify both --enable-dynamic-link and --enable-static-link])
545545
fi
546546
])
547+
547548
if test $static_link = yes; then
548549
AC_DEFINE([ENABLE_STATIC_LINK], [1], [Use static libraries ( .a or .A.tbd )])
549550
else
@@ -587,10 +588,11 @@ AC_ARG_ENABLE([tuntap],
587588
linux*)
588589
AC_CHECK_HEADER([linux/if_tun.h], [have_tuntap=yes])
589590
;;
590-
freebsd*)
591+
*)
591592
AC_CHECK_HEADER([net/if_tun.h], [have_tuntap=yes])
592593
;;
593594
esac])
595+
594596
if test $have_tuntap = yes ; then
595597
AC_DEFINE([HAVE_TUNTAP], [1],
596598
[Do we have TUNTAP device support?])
@@ -1760,38 +1762,71 @@ AC_ARG_WITH(testnic,
17601762
nic2=$withval
17611763
AC_MSG_RESULT([Using --with-testnic=$withval])],
17621764
[
1765+
case $host in
1766+
*-*-linux*)
1767+
nic1=eth0
1768+
nic2=eth0
1769+
;;
1770+
1771+
*-*-solaris*)
1772+
nic1=hme0
1773+
nic2=hme0
1774+
;;
1775+
1776+
*-*-sunos*)
1777+
nic1=hme0
1778+
nic2=hme0
1779+
;;
1780+
1781+
*-apple-darwin*)
1782+
nic1=en0
1783+
nic2=en0
1784+
;;
1785+
1786+
*-*-openbsd*)
1787+
nic1=xl0
1788+
nic2=xl0
1789+
;;
1790+
1791+
*-*-freebsd*)
1792+
nic1=em0
1793+
nic2=em0
1794+
;;
1795+
1796+
*-*-cygwin)
1797+
nic1=%0
1798+
nic2=%0
1799+
;;
1800+
1801+
*)
1802+
AC_MSG_RESULT([$host is unknown! Using first non-loopback interface])
1803+
nic1=%0
1804+
nic2=%0
1805+
;;
1806+
esac])
17631807

17641808
dnl There's a bug in OS X which causes pcap_findalldevs() to make the wifi NIC to disassociate
17651809
dnl so under OSX we disable the interface list feature
17661810
disable_pcap_findalldevs=no
1767-
17681811
osx_frameworks=no
17691812
dnl these need to be dynamic based on OS
17701813
case $host in
17711814
*-*-linux*)
1772-
nic1=eth0
1773-
nic2=eth0
17741815
AC_DEFINE([HAVE_LINUX], [1], [Building Linux])
17751816
AC_MSG_RESULT(Linux)
17761817
;;
17771818

17781819
*-*-solaris*)
1779-
nic1=hme0
1780-
nic2=hme0
17811820
AC_DEFINE([HAVE_SOLARIS], [1], [Building Solaris])
17821821
AC_MSG_RESULT(Solaris)
17831822
;;
17841823

17851824
*-*-sunos*)
1786-
nic1=hme0
1787-
nic2=hme0
17881825
AC_DEFINE([HAVE_SUNOS], [1], [Building SunOS])
17891826
AC_MSG_RESULT(SunOS)
17901827
;;
17911828

17921829
*-apple-darwin*)
1793-
nic1=en0
1794-
nic2=en0
17951830
if test x$libpcap_version_096 = xno ; then
17961831
disable_pcap_findalldevs=yes
17971832
fi
@@ -1801,33 +1836,24 @@ case $host in
18011836
;;
18021837

18031838
*-*-openbsd*)
1804-
nic1=xl0
1805-
nic2=xl0
18061839
AC_DEFINE([HAVE_OPENBSD], [1], [Building Open BSD])
18071840
AC_MSG_RESULT(OpenBSD)
18081841
;;
18091842

18101843
*-*-freebsd*)
1811-
nic1=em0
1812-
nic2=em0
18131844
AC_DEFINE([HAVE_FREEBSD], [1], [Building Free BSD])
18141845
AC_MSG_RESULT(FreeBSD)
18151846
;;
18161847

18171848
*-*-cygwin)
18181849
AC_MSG_RESULT(Win32/Cygwin)
1819-
nic1=%0
1820-
nic2=%0
18211850
AC_DEFINE([HAVE_CYGWIN], [1], [Building Cygwin])
18221851
;;
18231852

18241853
*)
1825-
AC_MSG_RESULT([$host is unknown! Using first non-loopback interface])
1826-
nic1=%0
1827-
nic2=%0
1854+
AC_MSG_RESULT([$host is unknown!])
18281855
;;
1829-
esac])
1830-
1856+
esac
18311857
AM_CONDITIONAL([ENABLE_OSX_FRAMEWORKS], test "$osx_frameworks" = "yes")
18321858

18331859
AC_ARG_WITH(testnic2,

docs/CHANGELOG

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
10/18/2018 Version 4.3.0 beta2
2+
- fix issues identifed by Codacy (#493)
3+
- CVE-2018-18408 use-after-free in post_args (#489)
4+
- CVE-2018-18407 heap-buffer-overflow csum_replace4 (#488)
5+
- CVE-2018-17974 heap-buffer-overflow dlt_en10mb_encode (#486)
6+
- CVE-2018-17580 heap-buffer-overflow fast_edit_packet (#485)
7+
- CVE-2018-17582 heap-buffer-overflow in get_next_packet (#484)
8+
- Out-of-tree build (#482)
9+
- Fails to open tap0 on Zephyr (#411)
10+
- CVE-2018-13112 heap-buffer-overflow in get_l2len (#477 dup #408)
11+
- Respect 2nd packet timing (#418)
12+
- manpage typos (#413)
13+
- Fix replay when using --with-testnic (#178)
14+
115
01/18/2018 Version 4.3.0 beta1
216
- Travis CI build fails due to new build images (#432)
317
- Unable to build with libpcap 1.8.1 (#430)
@@ -51,7 +65,7 @@
5165
- Packet destortion --fuzz-seed option by Gabriel Ganne (#302)
5266
- Add --unique-ip-loops option to modify IPs every few loops (#296)
5367
- Netmap startup delay increase (#290)
54-
- tcpcapinfo buffer overflow vulnerablily (#278)
68+
- CVE-2017-6429 tcpcapinfo buffer overflow vulnerablily (#278)
5569
- Update git-clone instructions by Kyle McDonald (#277)
5670
- Allow fractions for --pps option (#270)
5771
- Print per-loop stats with --stats=0 (#269)

docs/CREDIT

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Bojan Smojver <[email protected]>
5858
Stas Grabois <[email protected]>
5959
- For his efforts to add IPv6 support to tcpprep and the tcpedit engine
6060
- For adding IPv6 support to fragroute
61-
61+
6262
Fred Klassen <[email protected]> - AppNeta
6363
- New maintainer of Tcpreplay
6464
- Added netmap support for wire-rate performance on commodity hardware
@@ -78,3 +78,4 @@ Pedro Arthur Duarte [aka JEdi] <GitHub @pedroarthur>
7878

7979
Gabriel Ganne <GitHub @GabrielGanne>
8080
- Data fuzz rewrite feature
81+
- Out-of-tree build

src/Makefile.am

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ autoopts: tcpreplay_opts.c tcprewrite_opts.c tcpbridge_opts.c tcpliveplay_opts.c
2727
opts_list=-L tcpedit
2828

2929
tcpprep.1: tcpprep_opts.def
30-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpprep_opts.def
30+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
3131

3232
tcprewrite.1: tcprewrite_opts.def tcpedit/tcpedit_opts.def
33-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcprewrite_opts.def
33+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
3434

3535
tcpreplay-edit.1: tcpreplay_opts.def
36-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN tcpreplay_opts.def
36+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) -DTCPREPLAY_EDIT -DTCPREPLAY_EDIT_MAN $<
3737

3838
tcpreplay.1: tcpreplay_opts.def
39-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpreplay_opts.def
39+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
4040

4141
tcpbridge.1: tcpbridge_opts.def
42-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpbridge_opts.def
42+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
4343

4444
tcpliveplay.1: tcpliveplay_opts.def
45-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpliveplay_opts.def
45+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
4646

4747
tcpcapinfo.1: tcpcapinfo_opts.def
48-
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) tcpcapinfo_opts.def
48+
@AUTOGEN@ -T agman-cmd.tpl $(opts_list) $<
4949

5050
man_MANS = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpreplay-edit.1 tcpcapinfo.1
5151
EXTRA_DIST = tcpreplay.1 tcpprep.1 tcprewrite.1 tcpbridge.1 tcpreplay-edit.1 \
@@ -62,43 +62,43 @@ bin_PROGRAMS += tcpliveplay
6262
man_MANS += tcpliveplay.1
6363
endif
6464

65-
tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
65+
tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
6666
tcpreplay_edit_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
6767
tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
6868
tcpreplay_edit_OBJECTS: tcpreplay_opts.h
6969
tcpreplay_edit_opts.h: tcpreplay_edit_opts.c
7070

7171
BUILT_SOURCES += tcpreplay_edit_opts.h
7272
tcpreplay_edit_opts.c: tcpreplay_opts.def
73-
@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def
73+
@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts $<
7474

75-
tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
75+
tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
7676
tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
7777
tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
7878
tcpreplay_OBJECTS: tcpreplay_opts.h
7979
tcpreplay_opts.h: tcpreplay_opts.c
8080

8181
BUILT_SOURCES += tcpreplay_opts.h
8282
tcpreplay_opts.c: tcpreplay_opts.def
83-
@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ tcpreplay_opts.def
83+
@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ $<
8484

8585
if ENABLE_OSX_FRAMEWORKS
8686
tcpreplay_LDFLAGS = -framework CoreServices -framework Carbon
8787
tcpreplay_edit_LDFLAGS = -framework CoreServices -framework Carbon
8888
endif
8989

90-
tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
90+
tcpliveplay_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) -DTCPREPLAY -DTCPLIVEPLAY
9191
tcpliveplay_SOURCES = tcpliveplay_opts.c tcpliveplay.c
9292
tcpliveplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
9393
tcpliveplay_OBJECTS: tcpliveplay_opts.h
9494
tcpliveplay_opts.h: tcpliveplay_opts.c
9595

9696
BUILT_SOURCES += tcpliveplay_opts.h
9797
tcpliveplay_opts.c: tcpliveplay_opts.def
98-
@AUTOGEN@ $(opts_list) tcpliveplay_opts.def
98+
@AUTOGEN@ $(opts_list) $<
9999

100100

101-
tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
101+
tcprewrite_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit @LDNETINC@ $(LNAV_CFLAGS) -DTCPREWRITE -DHAVE_CACHEFILE_SUPPORT
102102
tcprewrite_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
103103
$(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@ \
104104
$(LIBFRAGROUTE)
@@ -108,9 +108,9 @@ tcprewrite_opts.h: tcprewrite_opts.c
108108

109109
BUILT_SOURCES += tcprewrite_opts.h
110110
tcprewrite_opts.c: tcprewrite_opts.def tcpedit/tcpedit_opts.def
111-
@AUTOGEN@ $(opts_list) tcprewrite_opts.def
111+
@AUTOGEN@ $(opts_list) $<
112112

113-
tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
113+
tcpcapinfo_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPCAPINFO
114114
tcpcapinfo_LDADD = ./common/libcommon.a \
115115
$(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
116116
tcpcapinfo_SOURCES = tcpcapinfo_opts.c tcpcapinfo.c
@@ -119,9 +119,9 @@ tcpcapinfo_opts.h: tcpcapinfo_opts.c
119119

120120
BUILT_SOURCES += tcpcapinfo_opts.h
121121
tcpcapinfo_opts.c: tcpcapinfo_opts.def
122-
@AUTOGEN@ $(opts_list) tcpcapinfo_opts.def
122+
@AUTOGEN@ $(opts_list) $<
123123

124-
tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
124+
tcpprep_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPPREP
125125
tcpprep_LDADD = ./common/libcommon.a \
126126
$(LIBSTRL) @LPCAPLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
127127
tcpprep_SOURCES = tcpprep_opts.c tcpprep.c tree.c tcpprep_api.c
@@ -130,9 +130,9 @@ tcpprep_opts.h: tcpprep_opts.c
130130

131131
BUILT_SOURCES += tcpprep_opts.h
132132
tcpprep_opts.c: tcpprep_opts.def
133-
@AUTOGEN@ tcpprep_opts.def
133+
@AUTOGEN@ $<
134134

135-
tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
135+
tcpbridge_CFLAGS = $(LIBOPTS_CFLAGS) -I$(srcdir)/.. -I$(srcdir)/tcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPBRIDGE
136136
tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
137137
$(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD) @DMALLOC_LIB@
138138
if ENABLE_OSX_FRAMEWORKS
@@ -144,7 +144,7 @@ tcpbridge_opts.h: tcpbridge_opts.c
144144

145145
BUILT_SOURCES += tcpbridge_opts.h
146146
tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
147-
@AUTOGEN@ $(opts_list) tcpbridge_opts.def
147+
@AUTOGEN@ $(opts_list) $<
148148

149149
noinst_HEADERS = tcpreplay.h tcpprep.h bridge.h defines.h tree.h tcpliveplay.h \
150150
send_packets.h signal_handler.h common.h tcpreplay_opts.h tcpliveplay_opts.h \

src/bridge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ live_callback(struct live_data_t *livedata, struct pcap_pkthdr *pkthdr,
339339

340340
/* look for include or exclude CIDR match */
341341
if (livedata->options->xX.cidr != NULL) {
342-
if (!process_xX_by_cidr_ipv4(livedata->options->xX.mode, livedata->options->xX.cidr, ip_hdr)) {
342+
if (!ip_hdr ||
343+
!process_xX_by_cidr_ipv4(livedata->options->xX.mode, livedata->options->xX.cidr, ip_hdr)) {
343344
dbg(2, "Skipping IPv4 packet due to CIDR match");
344345
return (1);
345346
}

src/common/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if COMPILE_NETMAP
2525
libcommon_a_SOURCES += netmap.c
2626
endif
2727

28-
AM_CFLAGS = -I.. -I../.. $(LNAV_CFLAGS) @LDNETINC@
28+
AM_CFLAGS = -I$(srcdir)/.. -I$(srcdir)/../.. $(LNAV_CFLAGS) @LDNETINC@
2929

3030
if ! SYSTEM_STRLCPY
3131
libcommon_a_LIBADD = ../../lib/libstrl.a

src/common/cidr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ cidr2cidr(char *cidr)
241241
if (octets[count] > 255)
242242
goto error;
243243

244-
snprintf(tempoctet, sizeof(octets[count]), "%d", octets[count]);
244+
snprintf(tempoctet, sizeof(octets[count]), "%u", octets[count]);
245245
strcat(networkip, tempoctet);
246246
/* we don't want a '.' at the end of the last octet */
247247
if (count < 3)

src/common/flows.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr *
158158
const u_char *pktdata, const int datalink, const int expiry)
159159
{
160160
uint16_t ether_type = 0;
161-
vlan_hdr_t *vlan_hdr;
162161
ipv4_hdr_t *ip_hdr = NULL;
163162
ipv6_hdr_t *ip6_hdr = NULL;
164163
tcp_hdr_t *tcp_hdr;
@@ -231,10 +230,11 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr *
231230
if ((pktdata[3] & 0x80) == 0x80) {
232231
l2_len = ntohs(*((uint16_t*)&pktdata[4]));
233232
l2_len += 6;
234-
} else
233+
} else {
235234
l2_len = 4; /* no header extensions */
235+
}
236236

237-
/* fall through */
237+
/* no break */
238238
case DLT_EN10MB:
239239
/* set l2_len if we did not fell through */
240240
if (l2_len == 0)
@@ -246,7 +246,7 @@ flow_entry_type_t flow_decode(flow_hash_table_t *fht, const struct pcap_pkthdr *
246246
ether_type = ntohs(((eth_hdr_t*)(pktdata + l2_len))->ether_type);
247247

248248
while (ether_type == ETHERTYPE_VLAN) {
249-
vlan_hdr = (vlan_hdr_t *)(pktdata + l2_len);
249+
vlan_hdr_t *vlan_hdr = (vlan_hdr_t *)(pktdata + l2_len);
250250
entry.vlan = vlan_hdr->vlan_priority_c_vid & htons(0xfff);
251251
ether_type = ntohs(vlan_hdr->vlan_len);
252252
l2_len += 4;

0 commit comments

Comments
 (0)