From 3dbb72b3ac23b12700a8c1b4694b3b845db70b8b Mon Sep 17 00:00:00 2001 From: rd235 Date: Wed, 5 Apr 2006 16:11:17 +0000 Subject: [PATCH] gcc 4.0.3 aliasing problem solved (slirpvde) git-svn-id: https://vde.svn.sourceforge.net/svnroot/vde/trunk@84 d37a7db1-d92d-0410-89df-f68f52f87b57 --- vde-2/slirpvde/Makefile.am | 3 +-- vde-2/slirpvde/tcp_input.c | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vde-2/slirpvde/Makefile.am b/vde-2/slirpvde/Makefile.am index 6c8f9cd..26273b3 100644 --- a/vde-2/slirpvde/Makefile.am +++ b/vde-2/slirpvde/Makefile.am @@ -42,7 +42,6 @@ slirpvde_SOURCES = \ INCLUDES = -DVDE -# workaround for gcc 4.0.3 -CFLAGS = -g -O1 +CFLAGS = -g -O2 EXTRA_DIST = README diff --git a/vde-2/slirpvde/tcp_input.c b/vde-2/slirpvde/tcp_input.c index ef309fc..7a2eca2 100644 --- a/vde-2/slirpvde/tcp_input.c +++ b/vde-2/slirpvde/tcp_input.c @@ -299,12 +299,13 @@ tcp_input(m, iphlen, inso) */ ip=mtod(m, struct ip *); save_ip = *ip; - save_ip.ip_len+= iphlen; /* * Checksum extended TCP header and data. */ - tlen = ((struct ip *)ti)->ip_len; + //tlen = ((struct ip *)ti)->ip_len; + // use save_ip instead of ti to be avoid gcc aliasing optimization problems + tlen=save_ip.ip_len; ti->ti_next = ti->ti_prev = 0; ti->ti_x1 = 0; ti->ti_len = htons((u_int16_t)tlen); @@ -317,6 +318,8 @@ tcp_input(m, iphlen, inso) goto drop; } + save_ip.ip_len+= iphlen; + /* * Check that TCP offset makes sense, * pull out TCP options and adjust length. XXX -- 2.11.4.GIT