Skip to content

Commit

Permalink
Merge pull request mfontanini#437 from ceerRep/master
Browse files Browse the repository at this point in the history
Fix wrong address endian
  • Loading branch information
mfontanini authored Mar 28, 2021
2 parents b447c66 + 222611b commit e90e377
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/tins/icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class TINS_API ICMP : public PDU {
* \return Returns the gateway field value.
*/
address_type gateway() const {
return address_type(Endian::be_to_host(header_.un.gateway));
return address_type(header_.un.gateway);
}

/**
Expand Down Expand Up @@ -383,7 +383,7 @@ class TINS_API ICMP : public PDU {
* \return Returns the address mask value.
*/
address_type address_mask() const {
return address_type(Endian::be_to_host(orig_timestamp_or_address_mask_));
return address_type(orig_timestamp_or_address_mask_);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/icmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void ICMP::sequence(uint16_t new_seq) {
}

void ICMP::gateway(address_type new_gw) {
header_.un.gateway = Endian::host_to_be(static_cast<uint32_t>(new_gw));
header_.un.gateway = static_cast<uint32_t>(new_gw);
}

void ICMP::mtu(uint16_t new_mtu) {
Expand All @@ -122,7 +122,7 @@ void ICMP::transmit_timestamp(uint32_t new_timestamp) {
}

void ICMP::address_mask(address_type new_mask) {
orig_timestamp_or_address_mask_ = Endian::host_to_be(static_cast<uint32_t>(new_mask));
orig_timestamp_or_address_mask_ = static_cast<uint32_t>(new_mask);
}

uint32_t ICMP::header_size() const {
Expand Down

0 comments on commit e90e377

Please sign in to comment.