mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 05:24:26 +01:00
Added some fixes to the build system. Fixed bugs in DNS and ICMPv6 triggered in big-endian architectures.
This commit is contained in:
@@ -95,7 +95,6 @@ const DHCPv6::dhcpv6_option *DHCPv6::search_option(Option id) const {
|
||||
uint8_t* DHCPv6::write_option(const dhcpv6_option &option, uint8_t* buffer) const {
|
||||
*(uint16_t*)buffer = Endian::host_to_be(option.option());
|
||||
*(uint16_t*)&buffer[sizeof(uint16_t)] = Endian::host_to_be(option.data_size());
|
||||
std::cout << "Size: " << option.data_size() << std::endl;
|
||||
return std::copy(
|
||||
option.data_ptr(),
|
||||
option.data_ptr() + option.data_size(),
|
||||
|
||||
@@ -174,7 +174,7 @@ bool DNSResourceRecord::matches(const std::string &dname) const {
|
||||
// OffsetedRecord
|
||||
|
||||
OffsetedDNSRRImpl::OffsetedDNSRRImpl(uint16_t off)
|
||||
: offset_(off | 0xc0)
|
||||
: offset_(off | Endian::host_to_be<uint16_t>(0xc000))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -606,7 +606,9 @@ ICMPv6::addr_list_type ICMPv6::search_addr_list(Options type) const {
|
||||
ICMPv6::rsa_sign_type ICMPv6::rsa_signature() const {
|
||||
const icmpv6_option *opt = search_option(RSA_SIGN);
|
||||
// 2 bytes reserved + at least 1 byte signature.
|
||||
if(!opt || opt->data_size() < 2 + sizeof(rsa_sign_type::key_hash) + 1)
|
||||
// 16 == sizeof(rsa_sign_type::key_hash), removed the sizeof
|
||||
// expression since gcc 4.2 doesn't like it
|
||||
if(!opt || opt->data_size() < 2 + 16 + 1)
|
||||
throw option_not_found();
|
||||
const uint8_t *ptr = opt->data_ptr() + 2;
|
||||
rsa_sign_type output;
|
||||
|
||||
Reference in New Issue
Block a user