[haiku-bugs] Re: [Haiku] #13681: tcp: 2018: implementing TCP SACK option

  • From: "axeld" <trac@xxxxxxxxxxxx>
  • Date: Fri, 25 Aug 2017 06:35:23 -0000

#13681: tcp: 2018: implementing TCP SACK option
--------------------------------------+----------------------------
   Reporter:  a-star                  |      Owner:  axeld
       Type:  enhancement             |     Status:  new
   Priority:  normal                  |  Milestone:  Unscheduled
  Component:  Network & Internet/TCP  |    Version:  R1/Development
 Resolution:                          |   Keywords:  tcp, sack
 Blocked By:                          |   Blocking:
Has a Patch:  1                       |   Platform:  All
--------------------------------------+----------------------------

Comment (by axeld):

 First, the coding style issues:
 - BufferQueue.cpp, line 438: Two blank lines between functions
 - Line 440: We use camel case for variables: sack_count -> sackCount.
 - Line 443: "ptr" is a bad variable name. It should be "buffer" in this
 case, as it refers to a net_buffer.
 - Line 447: Extraneous parenthesis.
 - TCPEndpoint.cpp, line 2035: Operators go to the next line.

 Then
 - If the loop in BufferQueue.cpp line 446 ends with sack_count ==
 maxSackCount, the code in line 462 may overwrite memory behind the array.
 - Since the PopulateSackInfo() method does not have a return value yet,
 I'd prefer to return the sack count instead of setting it via a by-
 reference variable.
 - In TCPEndpoint.cpp 2039, the code does not handle a failed allocation
 gracefully; in fact, it'll crash trying to access segment.sacks later on.

--
Ticket URL: <https://dev.haiku-os.org/ticket/13681#comment:4>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: