wafsamba: fix pidl dependencies to rebuild on pidl changes
[Samba.git] / ctdb / tests / cunit / system_socket_test_001.sh
blob3fe9db39e138b9450ab2a9d9c5d7fd7768dd446a
1 #!/bin/sh
3 . "${TEST_SCRIPTS_DIR}/unit.sh"
5 out_file="${TEST_VAR_DIR}/cunit/packet.out"
7 remove_file ()
9 rm -f "$out_file"
12 test_cleanup remove_file
14 d=$(dirname "$out_file")
15 mkdir -p "$d"
17 ########################################
19 ok_null
20 unit_test system_socket_test types
22 arp_run ()
24 $VALGRIND system_socket_test arp "$@" >"$out_file" || exit $?
25 od -A x -t x1 "$out_file"
28 arp_test ()
30 os=$(uname)
31 if [ "$os" = "Linux" ] ; then
32 unit_test_notrace arp_run "$@"
33 else
34 ok "PACKETSOCKET not supported"
35 unit_test system_socket_test arp "$@"
39 ok <<EOF
40 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
41 000010 08 00 06 04 00 01 12 34 56 78 9a bc c0 a8 01 19
42 000020 00 00 00 00 00 00 c0 a8 01 19 00 00 00 00 00 00
43 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
44 000040
45 EOF
46 arp_test "192.168.1.25" "12:34:56:78:9a:bc"
48 ok <<EOF
49 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
50 000010 08 00 06 04 00 02 12 34 56 78 9a bc c0 a8 01 19
51 000020 12 34 56 78 9a bc c0 a8 01 19 00 00 00 00 00 00
52 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
53 000040
54 EOF
55 arp_test "192.168.1.25" "12:34:56:78:9a:bc" reply
57 ok <<EOF
58 000000 33 33 00 00 00 01 12 34 56 78 9a bc 86 dd 60 00
59 000010 00 00 00 20 3a ff fe 80 00 00 00 00 00 00 6a f7
60 000020 28 ff fe fa d1 36 ff 02 00 00 00 00 00 00 00 00
61 000030 00 00 00 00 00 01 88 00 8d e4 20 00 00 00 fe 80
62 000040 00 00 00 00 00 00 6a f7 28 ff fe fa d1 36 02 01
63 000050 12 34 56 78 9a bc
64 000056
65 EOF
66 arp_test "fe80::6af7:28ff:fefa:d136" "12:34:56:78:9a:bc"
68 tcp_run ()
70 $VALGRIND system_socket_test tcp "$@" >"$out_file" || exit $?
71 od -A x -t x1 "$out_file"
74 tcp_test ()
76 unit_test_notrace tcp_run "$@"
79 ok <<EOF
80 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
81 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
82 000020 50 10 04 d2 50 5f 00 00
83 000028
84 EOF
85 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 0
87 ok <<EOF
88 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
89 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
90 000020 50 14 04 d2 50 5b 00 00
91 000028
92 EOF
93 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 1
95 ok <<EOF
96 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
97 000010 c0 a8 02 4b 01 bd d4 31 39 30 00 00 a0 5b 00 00
98 000020 50 14 04 d2 76 cf 00 00
99 000028
101 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 12345 23456 1
103 ok <<EOF
104 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
105 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
106 000020 6a f7 28 ff fe fb d1 37 01 bd d4 31 00 00 00 00
107 000030 00 00 00 00 50 10 04 d2 0f c0 00 00
108 00003c
110 tcp_test "fe80::6af7:28ff:fefa:d136:445" "fe80::6af7:28ff:fefb:d137:54321" 0 0 0
112 ok <<EOF
113 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
114 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
115 000020 6a f7 28 ff fe fb d1 37 01 bd d4 31 00 00 00 00
116 000030 00 00 00 00 50 14 04 d2 0f bc 00 00
117 00003c
119 tcp_test "fe80::6af7:28ff:fefa:d136:445" "fe80::6af7:28ff:fefb:d137:54321" 0 0 1
121 ok <<EOF
122 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
123 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
124 000020 6a f7 28 ff fe fb d1 37 01 bd d4 31 39 30 00 00
125 000030 a0 5b 00 00 50 14 04 d2 36 30 00 00
126 00003c
128 tcp_test "fe80::6af7:28ff:fefa:d136:445" \
129 "fe80::6af7:28ff:fefb:d137:54321" 12345 23456 1