diff options
author | Kevin Krakauer <krakauer@google.com> | 2019-02-22 13:33:49 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-22 13:34:47 -0800 |
commit | b75aa515044367094e762985a4b1a1f0580e3ad6 (patch) | |
tree | 426b486ae27b30c8e74b623f6904d3487eeeec2a /pkg/tcpip/transport | |
parent | 532f4b2fbaf66382a3d9e118b5a7a3ee272c8edc (diff) |
Rename ping endpoints to icmp endpoints.
PiperOrigin-RevId: 235248572
Change-Id: I5b0538b6feb365a98712c2a2d56d856fe80a8a09
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/icmp/BUILD (renamed from pkg/tcpip/transport/ping/BUILD) | 20 | ||||
-rw-r--r-- | pkg/tcpip/transport/icmp/endpoint.go (renamed from pkg/tcpip/transport/ping/endpoint.go) | 18 | ||||
-rw-r--r-- | pkg/tcpip/transport/icmp/endpoint_state.go (renamed from pkg/tcpip/transport/ping/endpoint_state.go) | 10 | ||||
-rw-r--r-- | pkg/tcpip/transport/icmp/protocol.go (renamed from pkg/tcpip/transport/ping/protocol.go) | 24 |
4 files changed, 36 insertions, 36 deletions
diff --git a/pkg/tcpip/transport/ping/BUILD b/pkg/tcpip/transport/icmp/BUILD index 4d4241d4b..74d9ff253 100644 --- a/pkg/tcpip/transport/ping/BUILD +++ b/pkg/tcpip/transport/icmp/BUILD @@ -4,26 +4,26 @@ load("//tools/go_generics:defs.bzl", "go_template_instance") load("//tools/go_stateify:defs.bzl", "go_library") go_template_instance( - name = "ping_packet_list", - out = "ping_packet_list.go", - package = "ping", - prefix = "pingPacket", + name = "icmp_packet_list", + out = "icmp_packet_list.go", + package = "icmp", + prefix = "icmpPacket", template = "//pkg/ilist:generic_list", types = { - "Element": "*pingPacket", - "Linker": "*pingPacket", + "Element": "*icmpPacket", + "Linker": "*icmpPacket", }, ) go_library( - name = "ping", + name = "icmp", srcs = [ "endpoint.go", "endpoint_state.go", - "ping_packet_list.go", + "icmp_packet_list.go", "protocol.go", ], - importpath = "gvisor.googlesource.com/gvisor/pkg/tcpip/transport/ping", + importpath = "gvisor.googlesource.com/gvisor/pkg/tcpip/transport/icmp", imports = ["gvisor.googlesource.com/gvisor/pkg/tcpip/buffer"], visibility = ["//visibility:public"], deps = [ @@ -39,7 +39,7 @@ go_library( filegroup( name = "autogen", srcs = [ - "ping_packet_list.go", + "icmp_packet_list.go", ], visibility = ["//:sandbox"], ) diff --git a/pkg/tcpip/transport/ping/endpoint.go b/pkg/tcpip/transport/icmp/endpoint.go index c8263a512..d87bfe048 100644 --- a/pkg/tcpip/transport/ping/endpoint.go +++ b/pkg/tcpip/transport/icmp/endpoint.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package ping +package icmp import ( "encoding/binary" @@ -27,8 +27,8 @@ import ( ) // +stateify savable -type pingPacket struct { - pingPacketEntry +type icmpPacket struct { + icmpPacketEntry senderAddress tcpip.FullAddress data buffer.VectorisedView `state:".(buffer.VectorisedView)"` timestamp int64 @@ -46,10 +46,10 @@ const ( stateClosed ) -// endpoint represents a ping endpoint. This struct serves as the interface -// between users of the endpoint and the protocol implementation; it is legal to -// have concurrent goroutines make calls into the endpoint, they are properly -// synchronized. +// endpoint represents an ICMP (ping) endpoint. This struct serves as the +// interface between users of the endpoint and the protocol implementation; it +// is legal to have concurrent goroutines make calls into the endpoint, they +// are properly synchronized. type endpoint struct { // The following fields are initialized at creation time and do not // change throughout the lifetime of the endpoint. @@ -62,7 +62,7 @@ type endpoint struct { // protected by rcvMu. rcvMu sync.Mutex `state:"nosave"` rcvReady bool - rcvList pingPacketList + rcvList icmpPacketList rcvBufSizeMax int `state:".(int)"` rcvBufSize int rcvClosed bool @@ -669,7 +669,7 @@ func (e *endpoint) HandlePacket(r *stack.Route, id stack.TransportEndpointID, vv wasEmpty := e.rcvBufSize == 0 // Push new packet into receive list and increment the buffer size. - pkt := &pingPacket{ + pkt := &icmpPacket{ senderAddress: tcpip.FullAddress{ NIC: r.NICID(), Addr: id.RemoteAddress, diff --git a/pkg/tcpip/transport/ping/endpoint_state.go b/pkg/tcpip/transport/icmp/endpoint_state.go index 80721d227..21008d089 100644 --- a/pkg/tcpip/transport/ping/endpoint_state.go +++ b/pkg/tcpip/transport/icmp/endpoint_state.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package ping +package icmp import ( "gvisor.googlesource.com/gvisor/pkg/tcpip" @@ -20,15 +20,15 @@ import ( "gvisor.googlesource.com/gvisor/pkg/tcpip/stack" ) -// saveData saves pingPacket.data field. -func (p *pingPacket) saveData() buffer.VectorisedView { +// saveData saves icmpPacket.data field. +func (p *icmpPacket) saveData() buffer.VectorisedView { // We cannot save p.data directly as p.data.views may alias to p.views, // which is not allowed by state framework (in-struct pointer). return p.data.Clone(nil) } -// loadData loads pingPacket.data field. -func (p *pingPacket) loadData(data buffer.VectorisedView) { +// loadData loads icmpPacket.data field. +func (p *icmpPacket) loadData(data buffer.VectorisedView) { // NOTE: We cannot do the p.data = data.Clone(p.views[:]) optimization // here because data.views is not guaranteed to be loaded by now. Plus, // data.views will be allocated anyway so there really is little point diff --git a/pkg/tcpip/transport/ping/protocol.go b/pkg/tcpip/transport/icmp/protocol.go index 1d504773b..9f0a2bf71 100644 --- a/pkg/tcpip/transport/ping/protocol.go +++ b/pkg/tcpip/transport/icmp/protocol.go @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package ping contains the implementation of the ICMP and IPv6-ICMP transport +// Package icmp contains the implementation of the ICMP and IPv6-ICMP transport // protocols for use in ping. To use it in the networking stack, this package // must be added to the project, and -// activated on the stack by passing ping.ProtocolName (or "ping") and/or -// ping.ProtocolName6 (or "ping6") as one of the transport protocols when +// activated on the stack by passing icmp.ProtocolName (or "icmp") and/or +// icmp.ProtocolName6 (or "icmp6") as one of the transport protocols when // calling stack.New(). Then endpoints can be created by passing -// ping.ProtocolNumber or ping.ProtocolNumber6 as the transport protocol number +// icmp.ProtocolNumber or icmp.ProtocolNumber6 as the transport protocol number // when calling Stack.NewEndpoint(). -package ping +package icmp import ( "encoding/binary" @@ -34,14 +34,14 @@ import ( ) const ( - // ProtocolName4 is the string representation of the ping protocol name. - ProtocolName4 = "ping4" + // ProtocolName4 is the string representation of the icmp protocol name. + ProtocolName4 = "icmp4" // ProtocolNumber4 is the ICMP protocol number. ProtocolNumber4 = header.ICMPv4ProtocolNumber - // ProtocolName6 is the string representation of the ping protocol name. - ProtocolName6 = "ping6" + // ProtocolName6 is the string representation of the icmp protocol name. + ProtocolName6 = "icmp6" // ProtocolNumber6 is the IPv6-ICMP protocol number. ProtocolNumber6 = header.ICMPv6ProtocolNumber @@ -66,7 +66,7 @@ func (p *protocol) netProto() tcpip.NetworkProtocolNumber { panic(fmt.Sprint("unknown protocol number: ", p.number)) } -// NewEndpoint creates a new ping endpoint. +// NewEndpoint creates a new icmp endpoint. func (p *protocol) NewEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, *tcpip.Error) { if netProto != p.netProto() { return nil, tcpip.ErrUnknownProtocol @@ -74,7 +74,7 @@ func (p *protocol) NewEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtoco return newEndpoint(stack, netProto, p.number, waiterQueue), nil } -// MinimumPacketSize returns the minimum valid ping packet size. +// MinimumPacketSize returns the minimum valid icmp packet size. func (p *protocol) MinimumPacketSize() int { switch p.number { case ProtocolNumber4: @@ -85,7 +85,7 @@ func (p *protocol) MinimumPacketSize() int { panic(fmt.Sprint("unknown protocol number: ", p.number)) } -// ParsePorts returns the source and destination ports stored in the given ping +// ParsePorts returns the source and destination ports stored in the given icmp // packet. func (p *protocol) ParsePorts(v buffer.View) (src, dst uint16, err *tcpip.Error) { switch p.number { |