File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ use crate::Error;
10
10
use crate :: Result ;
11
11
12
12
/// Holds different fragments of one packet, used for assembling fragmented packets.
13
+ ///
14
+ /// The buffer used for the `PacketAssembler` should either be dynamically sized (ex: Vec<u8>)
15
+ /// or should be statically allocated based upon the MTU of the type of packet being
16
+ /// assembled (ex: 1280 for a IPv6 frame).
13
17
#[ derive( Debug ) ]
14
18
pub struct PacketAssembler < ' a > {
15
19
buffer : ManagedSlice < ' a , u8 > ,
Original file line number Diff line number Diff line change @@ -1660,7 +1660,16 @@ impl<'a> InterfaceInner<'a> {
1660
1660
// This information is the total size of the packet when it is fully assmbled.
1661
1661
// We also pass the header size, since this is needed when other fragments
1662
1662
// (other than the first one) are added.
1663
- check ! ( check!( fragments. reserve_with_key( & key) ) . start(
1663
+ let frag_slot = match fragments. reserve_with_key ( & key) {
1664
+ Ok ( frag) => frag,
1665
+ Err ( Error :: PacketAssemblerSetFull ) => {
1666
+ net_debug ! ( "No available packet assembler for fragmented packet" ) ;
1667
+ return Default :: default ( ) ;
1668
+ }
1669
+ e => check ! ( e) ,
1670
+ } ;
1671
+
1672
+ check ! ( frag_slot. start(
1664
1673
Some (
1665
1674
frag. datagram_size( ) as usize - uncompressed_header_size
1666
1675
+ compressed_header_size
You can’t perform that action at this time.
0 commit comments