Skip to content

Commit c0b80b3

Browse files
committed
ip4: calculate ip_capacity without knowing ethernet
1 parent 64ad5e1 commit c0b80b3

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

api/net/ip4/packet_ip4.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ namespace net {
5757
uint16_t ip_data_length() const noexcept
5858
{ return ip_segment_length() - ip_header_length(); }
5959

60-
// TODO: Remove Ethernet dependency, some day...
6160
uint16_t ip_capacity() const noexcept
62-
{ return capacity() - ip_full_header_length() - sizeof(LinkLayer::trailer); }
61+
{ return capacity() - ip_header_length(); }
6362

6463
void set_ip_data_length(uint16_t length) {
6564
Expects(data_end() >= layer_begin());

api/net/packet.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "buffer_store.hpp"
2222
#include "ip4/addr.hpp"
23+
#include <gsl/gsl_assert>
2324
#include <delegate>
2425
#include <cassert>
2526

0 commit comments

Comments
 (0)