gvisor/pkg/tcpip/header
Ghanan Gowripalan 3b4bb94751 Add loopback interface as an ethernet-based device
...to match Linux behaviour.

We can see evidence of Linux representing loopback as an ethernet-based
device below:
```
# EUI-48 based MAC addresses.
$ ip link show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

# tcpdump showing ethernet frames when sniffing loopback and logging the
# link-type as EN10MB (Ethernet).
$ sudo tcpdump -i lo -e -c 2 -n
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes
03:09:05.002034 00:00:00:00:00:00 > 00:00:00:00:00:00, ethertype IPv4 (0x0800), length 66: 127.0.0.1.9557 > 127.0.0.1.36828: Flags [.], ack 3562800815, win 15342, options [nop,nop,TS val 843174495 ecr 843159493], length 0
03:09:05.002094 00:00:00:00:00:00 > 00:00:00:00:00:00, ethertype IPv4 (0x0800), length 66: 127.0.0.1.36828 > 127.0.0.1.9557: Flags [.], ack 1, win 6160, options [nop,nop,TS val 843174496 ecr 843159493], length 0
2 packets captured
116 packets received by filter
0 packets dropped by kernel
```

Wireshark shows a similar result as the tcpdump example above.

Linux's loopback setup: 5bfc75d92e/drivers/net/loopback.c (L162)

PiperOrigin-RevId: 391836719
2021-08-19 13:54:53 -07:00
..
parse Migrate PacketBuffer to use pkg/buffer 2021-05-13 13:56:16 -07:00
BUILD Use nicer formatting for IP addresses in tests 2021-04-15 15:11:04 -07:00
arp.go
checksum.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00
checksum_test.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00
eth.go Add loopback interface as an ethernet-based device 2021-08-19 13:54:53 -07:00
eth_test.go Add loopback interface as an ethernet-based device 2021-08-19 13:54:53 -07:00
gue.go
icmpv4.go Make dedicated methods for data operations in PacketBuffer 2021-03-03 16:05:16 -08:00
icmpv6.go Make dedicated methods for data operations in PacketBuffer 2021-03-03 16:05:16 -08:00
igmp.go Use time.Duration for IGMP Max Response Time field 2020-11-23 22:47:55 -08:00
igmp_test.go Use nicer formatting for IP addresses in tests 2021-04-15 15:11:04 -07:00
interfaces.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00
ipv4.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00
ipv4_test.go Do not forward link-local packets 2021-04-08 15:30:53 -07:00
ipv6.go Rename IsV6LinkLocalAddress to IsV6LinkLocalUnicastAddress 2021-04-09 13:23:01 -07:00
ipv6_extension_headers.go Validate router alert's data length 2020-12-15 17:45:22 -08:00
ipv6_extension_headers_test.go Validate router alert's data length 2020-12-15 17:45:22 -08:00
ipv6_fragment.go Introduce IPv6 extension header serialization facilities 2020-12-12 09:07:44 -08:00
ipv6_test.go Use nicer formatting for IP addresses in tests 2021-04-15 15:11:04 -07:00
ipversion_test.go Teach netstack how to add options to IPv4 packets 2020-11-11 10:59:35 -08:00
mld.go Support listener-side MLDv1 2020-11-25 18:00:41 -08:00
mld_test.go Add types to parse MLD messages 2020-11-19 16:19:24 -08:00
ndp_neighbor_advert.go
ndp_neighbor_solicit.go
ndp_options.go Support parsing NDP Route Information option 2021-06-29 21:32:09 -07:00
ndp_router_advert.go Implement fmt.Stringer for NDPRoutePreference 2021-06-30 18:33:49 -07:00
ndp_router_solicit.go
ndp_test.go Implement fmt.Stringer for NDPRoutePreference 2021-06-30 18:33:49 -07:00
ndpoptionidentifier_string.go Unexport methods on NDPOption 2021-03-16 12:04:52 -07:00
tcp.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00
tcp_test.go Give TCP flags a dedicated type 2021-03-09 18:00:03 -08:00
udp.go Incrementally update checksum when NAT-ing 2021-06-24 22:45:17 -07:00