summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-06-17 22:14:12 -0700
committerNathan Binkert <nate@binkert.org>2008-06-17 22:14:12 -0700
commit87d03d00cd204346efb162c89375be724707e5a6 (patch)
tree87a825ad5b3adcc58f9c16f90bc10a0587a90c2e /src/dev
parent8042b8f4c75164c6c6d5a71e171bc7193b85057a (diff)
downloadgem5-87d03d00cd204346efb162c89375be724707e5a6.tar.xz
inet: initialization fixes.
Make sure variables are properly initialized and also make sure that truth testing works properly.
Diffstat (limited to 'src/dev')
-rw-r--r--src/dev/ns_gige.cc33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/dev/ns_gige.cc b/src/dev/ns_gige.cc
index bd48bdca5..5767d8c79 100644
--- a/src/dev/ns_gige.cc
+++ b/src/dev/ns_gige.cc
@@ -2036,19 +2036,34 @@ NSGigE::txKick()
IpPtr ip(txPacket);
if (extsts & EXTSTS_UDPPKT) {
UdpPtr udp(ip);
- udp->sum(0);
- udp->sum(cksum(udp));
- txUdpChecksums++;
+ if (udp) {
+ udp->sum(0);
+ udp->sum(cksum(udp));
+ txUdpChecksums++;
+ } else {
+ debug_break();
+ warn_once("UDPPKT set, but not UDP!\n");
+ }
} else if (extsts & EXTSTS_TCPPKT) {
TcpPtr tcp(ip);
- tcp->sum(0);
- tcp->sum(cksum(tcp));
- txTcpChecksums++;
+ if (tcp) {
+ tcp->sum(0);
+ tcp->sum(cksum(tcp));
+ txTcpChecksums++;
+ } else {
+ debug_break();
+ warn_once("TCPPKT set, but not UDP!\n");
+ }
}
if (extsts & EXTSTS_IPPKT) {
- ip->sum(0);
- ip->sum(cksum(ip));
- txIpChecksums++;
+ if (ip) {
+ ip->sum(0);
+ ip->sum(cksum(ip));
+ txIpChecksums++;
+ } else {
+ debug_break();
+ warn_once("IPPKT set, but not UDP!\n");
+ }
}
}