summaryrefslogtreecommitdiff
path: root/src/base/inet.cc
diff options
context:
space:
mode:
authorAnthony Gutierrez <atgutier@umich.edu>2014-07-02 13:19:13 -0400
committerAnthony Gutierrez <atgutier@umich.edu>2014-07-02 13:19:13 -0400
commit3956ec0a893f2fe37fe9239c3c790de570e1eb8b (patch)
treee84c35f355967e4b0c4141796274c9225198ea99 /src/base/inet.cc
parentb998a0c6acdda83aefa8b6e0a182c75d73332a13 (diff)
downloadgem5-3956ec0a893f2fe37fe9239c3c790de570e1eb8b.tar.xz
base: fix some bugs in EthAddr
per the IEEE 802 spec: 1) fixed broadcast() to ensure that all bytes are equal to 0xff. 2) fixed unicast() to ensure that bit 0 of the first byte is equal to 0 3) fixed multicast() to ensure that bit 0 of the first byte is equal to 1, and that it is not a broadcast. also the constructors in EthAddr are fixed so that all bytes of data are initialized.
Diffstat (limited to 'src/base/inet.cc')
-rw-r--r--src/base/inet.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/base/inet.cc b/src/base/inet.cc
index e18858f3c..bdd1b57ad 100644
--- a/src/base/inet.cc
+++ b/src/base/inet.cc
@@ -62,12 +62,14 @@ EthAddr::EthAddr()
EthAddr::EthAddr(const uint8_t ea[ETH_ADDR_LEN])
{
- *data = *ea;
+ for (int i = 0; i < ETH_ADDR_LEN; ++i)
+ data[i] = ea[i];
}
EthAddr::EthAddr(const eth_addr &ea)
{
- *data = *ea.data;
+ for (int i = 0; i < ETH_ADDR_LEN; ++i)
+ data[i] = ea.data[i];
}
EthAddr::EthAddr(const std::string &addr)