-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set proper MTU and add maximum packet size check on Tx path
Tx buffer item size was hardcoded to 2048. If userspace manages to deliver larger packet, driver could go boom. Normally this doesn't happen because userspace sets MTU (at least on IPv4) to 1500. But in some strange case this did happen. Besides, user can set the larger MTU on the fly and face dire consequences. Fix this with two things: - Set adapter MTU to 1500 on adapter initialization. As a side effect this prevents user from setting the larger MTU. This makes impossible to trigger this bug. - Add checks to Tx path. Bail out if by some reasons NetAdapter decides to feed us with packet (combined fragments) larger than MTU. Also make Tx buffer code a bit more cleaner: - each pool item of size MTU_MAX (1500) + HEADROOM (24 max crypto overhead + 2 TCP packet size) - remove duplicated code to assign item size - rename OVPN_SOCKET_PACKET_BUFFER_SIZE to OVPN_SOCKET_RX_PACKET_BUFFER_SIZE to indicate that this is RX specific. Rx path can be cleaned up later. Fixes #40 Signed-off-by: Lev Stipakov <[email protected]>
- Loading branch information
Showing
8 changed files
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters