File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ namespace net {
8686
8787 /* * Get the IP header checksum field as-is */
8888 uint16_t ip_checksum () const noexcept
89- { return ntohs ( ip_header ().check ) ; }
89+ { return ip_header ().check ; }
9090
9191 /* * Get source address */
9292 const ip4::Addr& ip_src () const noexcept
@@ -171,7 +171,7 @@ namespace net {
171171
172172 /* * Set IP header checksum field directly */
173173 void set_ip_checksum (uint16_t sum) noexcept
174- { ip_header ().check = ntohs ( sum) ; }
174+ { ip_header ().check = sum; }
175175
176176 /* * Calculate and set IP header checksum field */
177177 void set_ip_checksum () noexcept {
Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ class Packet : public PacketIP4 {
8484 inline uint16_t win () const
8585 { return ntohs (tcp_header ().window_size ); }
8686
87+ uint16_t tcp_checksum () const noexcept
88+ { return tcp_header ().checksum ; }
89+
8790 inline Socket source () const
8891 { return Socket{ip_src (), src_port ()}; }
8992
You can’t perform that action at this time.
0 commit comments