mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-11 11:51:46 +00:00
nic_router: fix Tcp_packet header fields
data_offset and NS flag were incorrectly read due to missing endianess conversion. Also fix name of CWR flag. Fixes genodelabs/genode#4227 genodelabs/genode#4227
This commit is contained in:
parent
ee045a68cc
commit
2afb7c5567
@ -46,10 +46,7 @@ class Net::Tcp_packet
|
|||||||
uint16_t _dst_port;
|
uint16_t _dst_port;
|
||||||
uint32_t _seq_nr;
|
uint32_t _seq_nr;
|
||||||
uint32_t _ack_nr;
|
uint32_t _ack_nr;
|
||||||
unsigned _data_offset : 4;
|
uint16_t _flags;
|
||||||
unsigned _reserved : 3;
|
|
||||||
unsigned _flags_msb : 1;
|
|
||||||
uint8_t _flags_lsb;
|
|
||||||
uint16_t _window_size;
|
uint16_t _window_size;
|
||||||
uint16_t _checksum;
|
uint16_t _checksum;
|
||||||
uint16_t _urgent_ptr;
|
uint16_t _urgent_ptr;
|
||||||
@ -64,8 +61,9 @@ class Net::Tcp_packet
|
|||||||
struct Ack : Bitfield<4, 1> { };
|
struct Ack : Bitfield<4, 1> { };
|
||||||
struct Urg : Bitfield<5, 1> { };
|
struct Urg : Bitfield<5, 1> { };
|
||||||
struct Ece : Bitfield<6, 1> { };
|
struct Ece : Bitfield<6, 1> { };
|
||||||
struct Crw : Bitfield<7, 1> { };
|
struct Cwr : Bitfield<7, 1> { };
|
||||||
struct Ns : Bitfield<8, 1> { };
|
struct Ns : Bitfield<8, 1> { };
|
||||||
|
struct Data_offset : Bitfield<12, 4> { };
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -83,14 +81,14 @@ class Net::Tcp_packet
|
|||||||
Port dst_port() const { return Port(host_to_big_endian(_dst_port)); }
|
Port dst_port() const { return Port(host_to_big_endian(_dst_port)); }
|
||||||
uint32_t seq_nr() const { return host_to_big_endian(_seq_nr); }
|
uint32_t seq_nr() const { return host_to_big_endian(_seq_nr); }
|
||||||
uint32_t ack_nr() const { return host_to_big_endian(_ack_nr); }
|
uint32_t ack_nr() const { return host_to_big_endian(_ack_nr); }
|
||||||
uint8_t data_offset() const { return _data_offset; }
|
uint8_t data_offset() const { return Flags::Data_offset::get(flags()); }
|
||||||
uint16_t flags() const { return _flags_lsb | _flags_msb << 8; }
|
uint16_t flags() const { return host_to_big_endian(_flags); }
|
||||||
uint16_t window_size() const { return host_to_big_endian(_window_size); }
|
uint16_t window_size() const { return host_to_big_endian(_window_size); }
|
||||||
uint16_t checksum() const { return host_to_big_endian(_checksum); }
|
uint16_t checksum() const { return host_to_big_endian(_checksum); }
|
||||||
uint16_t urgent_ptr() const { return host_to_big_endian(_urgent_ptr); }
|
uint16_t urgent_ptr() const { return host_to_big_endian(_urgent_ptr); }
|
||||||
bool ns() const { return Flags::Ns::get(flags()); };
|
bool ns() const { return Flags::Ns::get(flags()); };
|
||||||
bool ece() const { return Flags::Ece::get(flags()); };
|
bool ece() const { return Flags::Ece::get(flags()); };
|
||||||
bool crw() const { return Flags::Crw::get(flags()); };
|
bool cwr() const { return Flags::Cwr::get(flags()); };
|
||||||
bool fin() const { return Flags::Fin::get(flags()); };
|
bool fin() const { return Flags::Fin::get(flags()); };
|
||||||
bool syn() const { return Flags::Syn::get(flags()); };
|
bool syn() const { return Flags::Syn::get(flags()); };
|
||||||
bool rst() const { return Flags::Rst::get(flags()); };
|
bool rst() const { return Flags::Rst::get(flags()); };
|
||||||
|
@ -32,7 +32,7 @@ void Net::Tcp_packet::print(Genode::Output &output) const
|
|||||||
if (ack()) { Genode::print(output, "a"); }
|
if (ack()) { Genode::print(output, "a"); }
|
||||||
if (urg()) { Genode::print(output, "u"); }
|
if (urg()) { Genode::print(output, "u"); }
|
||||||
if (ece()) { Genode::print(output, "e"); }
|
if (ece()) { Genode::print(output, "e"); }
|
||||||
if (crw()) { Genode::print(output, "c"); }
|
if (cwr()) { Genode::print(output, "c"); }
|
||||||
if (ns()) { Genode::print(output, "n"); }
|
if (ns()) { Genode::print(output, "n"); }
|
||||||
Genode::print(output, "' ");
|
Genode::print(output, "' ");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user