~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/psock_snd.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  4 # Run a series of packet socket send regression tests
  5 
  6 set -e
  7 
  8 readonly mtu=1500
  9 readonly iphlen=20
 10 readonly udphlen=8
 11 
 12 readonly vnet_hlen=10
 13 readonly eth_hlen=14
 14 
 15 readonly mss="$((${mtu} - ${iphlen} - ${udphlen}))"
 16 readonly mss_exceeds="$((${mss} + 1))"
 17 
 18 readonly max_mtu=65535
 19 readonly max_mss="$((${max_mtu} - ${iphlen} - ${udphlen}))"
 20 readonly max_mss_exceeds="$((${max_mss} + 1))"
 21 
 22 # functional checks (not a full cross-product)
 23 
 24 echo "dgram"
 25 ./in_netns.sh ./psock_snd -d
 26 
 27 echo "dgram bind"
 28 ./in_netns.sh ./psock_snd -d -b
 29 
 30 echo "raw"
 31 ./in_netns.sh ./psock_snd
 32 
 33 echo "raw bind"
 34 ./in_netns.sh ./psock_snd -b
 35 
 36 echo "raw qdisc bypass"
 37 ./in_netns.sh ./psock_snd -q
 38 
 39 echo "raw vlan"
 40 ./in_netns.sh ./psock_snd -V
 41 
 42 echo "raw vnet hdr"
 43 ./in_netns.sh ./psock_snd -v
 44 
 45 echo "raw csum_off"
 46 ./in_netns.sh ./psock_snd -v -c
 47 
 48 echo "raw csum_off with bad offset (expected to fail)"
 49 (! ./in_netns.sh ./psock_snd -v -c -C)
 50 
 51 
 52 # bounds check: send {max, max + 1, min, min - 1} lengths
 53 
 54 echo "raw min size"
 55 ./in_netns.sh ./psock_snd -l 0
 56 
 57 echo "raw mtu size"
 58 ./in_netns.sh ./psock_snd -l "${mss}"
 59 
 60 echo "raw mtu size + 1 (expected to fail)"
 61 (! ./in_netns.sh ./psock_snd -l "${mss_exceeds}")
 62 
 63 # fails due to ARPHRD_ETHER check in packet_extra_vlan_len_allowed
 64 #
 65 # echo "raw vlan mtu size"
 66 # ./in_netns.sh ./psock_snd -V -l "${mss}"
 67 
 68 echo "raw vlan mtu size + 1 (expected to fail)"
 69 (! ./in_netns.sh ./psock_snd -V -l "${mss_exceeds}")
 70 
 71 echo "dgram mtu size"
 72 ./in_netns.sh ./psock_snd -d -l "${mss}"
 73 
 74 echo "dgram mtu size + 1 (expected to fail)"
 75 (! ./in_netns.sh ./psock_snd -d -l "${mss_exceeds}")
 76 
 77 echo "raw truncate hlen (expected to fail: does not arrive)"
 78 (! ./in_netns.sh ./psock_snd -t "$((${vnet_hlen} + ${eth_hlen}))")
 79 
 80 echo "raw truncate hlen - 1 (expected to fail: EINVAL)"
 81 (! ./in_netns.sh ./psock_snd -t "$((${vnet_hlen} + ${eth_hlen} - 1))")
 82 
 83 
 84 # gso checks: implies -l, because with gso len must exceed gso_size
 85 
 86 echo "raw gso min size"
 87 ./in_netns.sh ./psock_snd -v -c -g -l "${mss_exceeds}"
 88 
 89 echo "raw gso max size"
 90 ./in_netns.sh ./psock_snd -v -c -g -l "${max_mss}"
 91 
 92 echo "raw gso max size + 1 (expected to fail)"
 93 (! ./in_netns.sh ./psock_snd -v -c -g -l "${max_mss_exceeds}")
 94 
 95 echo "OK. All tests passed"

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php