diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-11-13 02:42:15 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-13 02:42:15 +0000 |
commit | 77f5e9c854ade3ac6c0b602ed338800f61bd6184 (patch) | |
tree | f57546768cafc7aac85db169fb2c8c3253c2ef36 /pkg/tcpip/header | |
parent | 4ad47eb13ee2d819e61b97c796e844cee75a60c5 (diff) | |
parent | 638d64c6337d05b91f0bde81de8e1c8d6d9908d8 (diff) |
Merge release-20201030.0-80-g638d64c63 (automated)
Diffstat (limited to 'pkg/tcpip/header')
-rw-r--r-- | pkg/tcpip/header/ipv4.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/tcpip/header/ipv4.go b/pkg/tcpip/header/ipv4.go index 3d465e28a..713d476d6 100644 --- a/pkg/tcpip/header/ipv4.go +++ b/pkg/tcpip/header/ipv4.go @@ -275,12 +275,12 @@ func (b IPv4) DestinationAddress() tcpip.Address { // IPv4Options is a buffer that holds all the raw IP options. type IPv4Options []byte -// AllocationSize implements stack.NetOptions. +// SizeWithPadding implements stack.NetOptions. // It reports the size to allocate for the Options. RFC 791 page 23 (end of // section 3.1) says of the padding at the end of the options: // The internet header padding is used to ensure that the internet // header ends on a 32 bit boundary. -func (o IPv4Options) AllocationSize() int { +func (o IPv4Options) SizeWithPadding() int { return (len(o) + IPv4IHLStride - 1) & ^(IPv4IHLStride - 1) } @@ -368,8 +368,8 @@ func (b IPv4) Encode(i *IPv4Fields) { // worth a bit of optimisation here to keep the copy out of the fast path. hdrLen := IPv4MinimumSize if len(i.Options) != 0 { - // AllocationSize is always >= len(i.Options). - aLen := i.Options.AllocationSize() + // SizeWithPadding is always >= len(i.Options). + aLen := i.Options.SizeWithPadding() hdrLen += aLen if hdrLen > len(b) { panic(fmt.Sprintf("encode received %d bytes, wanted >= %d", len(b), hdrLen)) |