From 12d9cf6fabb53d18da3602564f45ff6fbbf032d6 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 26 Feb 2019 14:57:27 -0800 Subject: Adds a WriteRawPacket method to the InjectableLinkEndpoint interface. Also exposes ipv4.MaxTotalSize since it is a generally useful constant. PiperOrigin-RevId: 235799755 Change-Id: I1fa8d5294bf355acf5527cfdf274b3687d3c8b13 --- pkg/tcpip/network/ipv4/ipv4.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/tcpip/network') diff --git a/pkg/tcpip/network/ipv4/ipv4.go b/pkg/tcpip/network/ipv4/ipv4.go index c0d334b56..0c41519df 100644 --- a/pkg/tcpip/network/ipv4/ipv4.go +++ b/pkg/tcpip/network/ipv4/ipv4.go @@ -38,9 +38,9 @@ const ( // ProtocolNumber is the ipv4 protocol number. ProtocolNumber = header.IPv4ProtocolNumber - // maxTotalSize is maximum size that can be encoded in the 16-bit + // MaxTotalSize is maximum size that can be encoded in the 16-bit // TotalLength field of the ipv4 header. - maxTotalSize = 0xffff + MaxTotalSize = 0xffff // buckets is the number of identifier buckets. buckets = 2048 @@ -204,8 +204,8 @@ func (p *protocol) Option(option interface{}) *tcpip.Error { // calculateMTU calculates the network-layer payload MTU based on the link-layer // payload mtu. func calculateMTU(mtu uint32) uint32 { - if mtu > maxTotalSize { - mtu = maxTotalSize + if mtu > MaxTotalSize { + mtu = MaxTotalSize } return mtu - header.IPv4MinimumSize } -- cgit v1.2.3