From 9c4102896d8ffbe6a90b57e7aca85f912dcadd9c Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Wed, 11 Nov 2020 10:57:32 -0800 Subject: Teach netstack how to add options to IPv4 packets Most packets don't have options but they are an integral part of the standard. Teaching the ipv4 code how to handle them will simplify future testing and use. Because Options are so rare it is worth making sure that the extra work is kept out of the fast path as much as possible. Prior to this change, all usages of the IHL field of the IPv4Fields/Encode system set it to the same constant value except in a couple of tests for bad values. From this change IHL will not be a constant as it will depend on the size of any Options. Since ipv4.Encode() now handles the options it becomes a possible source of errors to let the callers set this value, so remove it entirely and calculate the value from the size of the Options if present (or not) therefore guaranteeing a correct value. Fixes #4709 RELNOTES: n/a PiperOrigin-RevId: 341864765 --- test/packetimpact/testbench/testbench.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/packetimpact/testbench/testbench.go') diff --git a/test/packetimpact/testbench/testbench.go b/test/packetimpact/testbench/testbench.go index 3c85ebbee..c1db95d8c 100644 --- a/test/packetimpact/testbench/testbench.go +++ b/test/packetimpact/testbench/testbench.go @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package testbench is the packetimpact test API. +// Package testbench has utilities to send and receive packets, and also command +// the DUT to run POSIX functions. It is the packetimpact test API. package testbench import ( -- cgit v1.2.3