Page MenuHomeFreeBSD

Enforce consistent length when sending IPv4 packets using raw sockets
ClosedPublic

Authored by tuexen on Jan 12 2017, 8:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 8:04 AM
Unknown Object (File)
Wed, Apr 17, 7:52 AM
Unknown Object (File)
Sun, Apr 7, 10:29 AM
Unknown Object (File)
Mar 23 2024, 12:41 PM
Unknown Object (File)
Mar 15 2024, 1:37 PM
Unknown Object (File)
Mar 15 2024, 12:55 PM
Unknown Object (File)
Mar 14 2024, 4:23 AM
Unknown Object (File)
Feb 29 2024, 1:18 PM
Subscribers

Details

Summary

When using a raw socket to send IPv4 packets and providing the IPv4 header, there are two different methods to provide the length:

  1. The length of the buffer
  2. The length in the IPv4 header

This patch enforces that both values are the same. If not, the send call returns -1 and errno is set to EINVAL.
Before this patch it was only enforced that the length in the header is not larger than the buffer.

This patch should mitigate problems when application provide the wrong length in the header, for example due to a byte ordering issue (network byte order versus host byte order).

This came up in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212283

Test Plan

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen retitled this revision from to Enforce consistent length when sending IPv4 packets using raw sockets.
tuexen updated this object.
tuexen edited the test plan for this revision. (Show Details)
tuexen added reviewers: transport, ae.
tuexen set the repository for this revision to rS FreeBSD src repository - subversion.
gnn added a reviewer: gnn.
This revision is now accepted and ready to land.Jan 12 2017, 8:26 PM
ae edited edge metadata.

This doesn't fixes all issues, but at least reduces the number. Thanks!

This revision was automatically updated to reflect the committed changes.