@@ -39,23 +39,84 @@ UNKNOWN_MACV6_MC_ADDR1="33:33:01:02:03:05"
39
39
UNKNOWN_MACV6_MC_ADDR2=" 33:33:01:02:03:06"
40
40
UNKNOWN_MACV6_MC_ADDR3=" 33:33:01:02:03:07"
41
41
42
- NON_IP_MC=" 01:02:03:04:05:06"
43
- NON_IP_PKT=" 00:04 48:45:4c:4f"
44
- BC=" ff:ff:ff:ff:ff:ff"
42
+ PTP_1588_L2_SYNC=" \
43
+ 01:1b:19:00:00:00 00:00:de:ad:be:ef 88:f7 00 02 \
44
+ 00 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
45
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
46
+ 00 00 00 00 00 00 00 00 00 00"
47
+ PTP_1588_L2_FOLLOW_UP=" \
48
+ 01:1b:19:00:00:00 00:00:de:ad:be:ef 88:f7 08 02 \
49
+ 00 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
50
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
51
+ 00 00 66 83 c5 f1 17 97 ed f0"
52
+ PTP_1588_L2_PDELAY_REQ=" \
53
+ 01:80:c2:00:00:0e 00:00:de:ad:be:ef 88:f7 02 02 \
54
+ 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
55
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 06 05 7f \
56
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
57
+ 00 00 00 00"
58
+ PTP_1588_IPV4_SYNC=" \
59
+ 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
60
+ 00 48 0a 9a 40 00 01 11 cb 88 c0 00 02 01 e0 00 \
61
+ 01 81 01 3f 01 3f 00 34 a3 c8 00 02 00 2c 00 00 \
62
+ 02 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
63
+ 63 ff fe cf 17 0e 00 01 00 00 00 00 00 00 00 00 \
64
+ 00 00 00 00 00 00"
65
+ PTP_1588_IPV4_FOLLOW_UP="
66
+ 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
67
+ 00 48 0a 9b 40 00 01 11 cb 87 c0 00 02 01 e0 00 \
68
+ 01 81 01 40 01 40 00 34 a3 c8 08 02 00 2c 00 00 \
69
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
70
+ 63 ff fe cf 17 0e 00 01 00 00 02 00 00 00 66 83 \
71
+ c6 0f 1d 9a 61 87"
72
+ PTP_1588_IPV4_PDELAY_REQ=" \
73
+ 01:00:5e:00:00:6b 00:00:de:ad:be:ef 08:00 45 00 \
74
+ 00 52 35 a9 40 00 01 11 a1 85 c0 00 02 01 e0 00 \
75
+ 00 6b 01 3f 01 3f 00 3e a2 bc 02 02 00 36 00 00 \
76
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
77
+ 63 ff fe cf 17 0e 00 01 00 01 05 7f 00 00 00 00 \
78
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
79
+ PTP_1588_IPV6_SYNC=" \
80
+ 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 06 \
81
+ 7c 2f 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
82
+ 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
83
+ 00 00 00 00 01 81 01 3f 01 3f 00 36 2e 92 00 02 \
84
+ 00 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
85
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
86
+ 00 00 00 00 00 00 00 00 00 00 00 00"
87
+ PTP_1588_IPV6_FOLLOW_UP=" \
88
+ 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 0a \
89
+ 00 bc 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
90
+ 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
91
+ 00 00 00 00 01 81 01 40 01 40 00 36 2e 92 08 02 \
92
+ 00 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
93
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
94
+ 00 00 66 83 c6 2a 32 09 bd 74 00 00"
95
+ PTP_1588_IPV6_PDELAY_REQ=" \
96
+ 33:33:00:00:00:6b 00:00:de:ad:be:ef 86:dd 60 0c \
97
+ 5c fd 00 40 11 01 fe 80 00 00 00 00 00 00 3c 37 \
98
+ 63 ff fe cf 17 0e ff 02 00 00 00 00 00 00 00 00 \
99
+ 00 00 00 00 00 6b 01 3f 01 3f 00 40 b4 54 02 02 \
100
+ 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
101
+ 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \
102
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
103
+ 00 00 00 00 00 00"
45
104
46
105
# Disable promisc to ensure we don't receive unknown MAC DA packets
47
106
export TCPDUMP_EXTRA_FLAGS=" -pl"
48
107
49
108
h1=${NETIFS[p1]}
50
109
h2=${NETIFS[p2]}
51
110
52
- send_non_ip ()
111
+ send_raw ()
53
112
{
54
- local if_name=$1
55
- local smac= $2
56
- local dmac= $3
113
+ local if_name=$1 ; shift
114
+ local pkt= " $1 " ; shift
115
+ local smac= $( mac_get $if_name )
57
116
58
- $MZ -q $if_name " $dmac $smac $NON_IP_PKT "
117
+ pkt=" ${pkt/ 00: 00: de: ad: be: ef/ $smac } "
118
+
119
+ $MZ -q $if_name " $pkt "
59
120
}
60
121
61
122
send_uc_ipv4 ()
@@ -109,6 +170,7 @@ run_test()
109
170
{
110
171
local send_if_name=$1 ; shift
111
172
local rcv_if_name=$1 ; shift
173
+ local skip_ptp=$1 ; shift
112
174
local no_unicast_flt=$1 ; shift
113
175
local test_name=" $1 " ; shift
114
176
local smac=$( mac_get $send_if_name )
@@ -150,6 +212,35 @@ run_test()
150
212
mc_route_destroy $rcv_if_name
151
213
mc_route_destroy $send_if_name
152
214
215
+ if [ $skip_ptp = false ]; then
216
+ ip maddress add 01:1b:19:00:00:00 dev $rcv_if_name
217
+ send_raw $send_if_name " $PTP_1588_L2_SYNC "
218
+ send_raw $send_if_name " $PTP_1588_L2_FOLLOW_UP "
219
+ ip maddress del 01:1b:19:00:00:00 dev $rcv_if_name
220
+
221
+ ip maddress add 01:80:c2:00:00:0e dev $rcv_if_name
222
+ send_raw $send_if_name " $PTP_1588_L2_PDELAY_REQ "
223
+ ip maddress del 01:80:c2:00:00:0e dev $rcv_if_name
224
+
225
+ mc_join $rcv_if_name 224.0.1.129
226
+ send_raw $send_if_name " $PTP_1588_IPV4_SYNC "
227
+ send_raw $send_if_name " $PTP_1588_IPV4_FOLLOW_UP "
228
+ mc_leave
229
+
230
+ mc_join $rcv_if_name 224.0.0.107
231
+ send_raw $send_if_name " $PTP_1588_IPV4_PDELAY_REQ "
232
+ mc_leave
233
+
234
+ mc_join $rcv_if_name ff0e::181
235
+ send_raw $send_if_name " $PTP_1588_IPV6_SYNC "
236
+ send_raw $send_if_name " $PTP_1588_IPV6_FOLLOW_UP "
237
+ mc_leave
238
+
239
+ mc_join $rcv_if_name ff02::6b
240
+ send_raw $send_if_name " $PTP_1588_IPV6_PDELAY_REQ "
241
+ mc_leave
242
+ fi
243
+
153
244
sleep 1
154
245
155
246
tcpdump_stop $rcv_if_name
@@ -212,6 +303,44 @@ run_test()
212
303
" $smac > $UNKNOWN_MACV6_MC_ADDR3 , ethertype IPv6 (0x86dd)" \
213
304
true " $test_name "
214
305
306
+ if [ $skip_ptp = false ]; then
307
+ check_rcv $rcv_if_name " 1588v2 over L2 transport, Sync" \
308
+ " ethertype PTP (0x88f7).* PTPv2.* msg type : sync msg" \
309
+ true " $test_name "
310
+
311
+ check_rcv $rcv_if_name " 1588v2 over L2 transport, Follow-Up" \
312
+ " ethertype PTP (0x88f7).* PTPv2.* msg type : follow up msg" \
313
+ true " $test_name "
314
+
315
+ check_rcv $rcv_if_name " 1588v2 over L2 transport, Peer Delay Request" \
316
+ " ethertype PTP (0x88f7).* PTPv2.* msg type : peer delay req msg" \
317
+ true " $test_name "
318
+
319
+ check_rcv $rcv_if_name " 1588v2 over IPv4, Sync" \
320
+ " ethertype IPv4 (0x0800).* PTPv2.* msg type : sync msg" \
321
+ true " $test_name "
322
+
323
+ check_rcv $rcv_if_name " 1588v2 over IPv4, Follow-Up" \
324
+ " ethertype IPv4 (0x0800).* PTPv2.* msg type : follow up msg" \
325
+ true " $test_name "
326
+
327
+ check_rcv $rcv_if_name " 1588v2 over IPv4, Peer Delay Request" \
328
+ " ethertype IPv4 (0x0800).* PTPv2.* msg type : peer delay req msg" \
329
+ true " $test_name "
330
+
331
+ check_rcv $rcv_if_name " 1588v2 over IPv6, Sync" \
332
+ " ethertype IPv6 (0x86dd).* PTPv2.* msg type : sync msg" \
333
+ true " $test_name "
334
+
335
+ check_rcv $rcv_if_name " 1588v2 over IPv6, Follow-Up" \
336
+ " ethertype IPv6 (0x86dd).* PTPv2.* msg type : follow up msg" \
337
+ true " $test_name "
338
+
339
+ check_rcv $rcv_if_name " 1588v2 over IPv6, Peer Delay Request" \
340
+ " ethertype IPv6 (0x86dd).* PTPv2.* msg type : peer delay req msg" \
341
+ true " $test_name "
342
+ fi
343
+
215
344
tcpdump_cleanup $rcv_if_name
216
345
}
217
346
@@ -293,6 +422,7 @@ macvlan_destroy()
293
422
standalone ()
294
423
{
295
424
local no_unicast_flt=true
425
+ local skip_ptp=false
296
426
297
427
if [ $( has_unicast_flt $h2 ) = yes ]; then
298
428
no_unicast_flt=false
@@ -302,7 +432,7 @@ standalone()
302
432
h2_create
303
433
macvlan_create $h2
304
434
305
- run_test $h1 $h2 $no_unicast_flt " $h2 "
435
+ run_test $h1 $h2 $skip_ptp $ no_unicast_flt " $h2 "
306
436
307
437
macvlan_destroy
308
438
h2_destroy
@@ -313,13 +443,15 @@ test_bridge()
313
443
{
314
444
local no_unicast_flt=true
315
445
local vlan_filtering=$1
446
+ local skip_ptp=true
316
447
317
448
h1_create
318
449
bridge_create $vlan_filtering
319
450
simple_if_init br0 $H2_IPV4 /24 $H2_IPV6 /64
320
451
macvlan_create br0
321
452
322
- run_test $h1 br0 $no_unicast_flt " vlan_filtering=$vlan_filtering bridge"
453
+ run_test $h1 br0 $skip_ptp $no_unicast_flt \
454
+ " vlan_filtering=$vlan_filtering bridge"
323
455
324
456
macvlan_destroy
325
457
simple_if_fini br0 $H2_IPV4 /24 $H2_IPV6 /64
@@ -340,6 +472,7 @@ vlan_aware_bridge()
340
472
test_vlan ()
341
473
{
342
474
local no_unicast_flt=true
475
+ local skip_ptp=false
343
476
344
477
if [ $( has_unicast_flt $h2 ) = yes ]; then
345
478
no_unicast_flt=false
@@ -349,7 +482,7 @@ test_vlan()
349
482
h2_vlan_create
350
483
macvlan_create $h2 .100
351
484
352
- run_test $h1 .100 $h2 .100 $no_unicast_flt " VLAN upper"
485
+ run_test $h1 .100 $h2 .100 $skip_ptp $ no_unicast_flt " VLAN upper"
353
486
354
487
macvlan_destroy
355
488
h2_vlan_destroy
@@ -360,6 +493,7 @@ vlan_over_bridged_port()
360
493
{
361
494
local no_unicast_flt=true
362
495
local vlan_filtering=$1
496
+ local skip_ptp=false
363
497
364
498
# br_manage_promisc() will not force a single vlan_filtering port to
365
499
# promiscuous mode, so we should still expect unicast filtering to take
@@ -373,7 +507,7 @@ vlan_over_bridged_port()
373
507
bridge_create $vlan_filtering
374
508
macvlan_create $h2 .100
375
509
376
- run_test $h1 .100 $h2 .100 $no_unicast_flt \
510
+ run_test $h1 .100 $h2 .100 $skip_ptp $ no_unicast_flt \
377
511
" VLAN over vlan_filtering=$vlan_filtering bridged port"
378
512
379
513
macvlan_destroy
@@ -396,6 +530,7 @@ vlan_over_bridge()
396
530
{
397
531
local no_unicast_flt=true
398
532
local vlan_filtering=$1
533
+ local skip_ptp=true
399
534
400
535
h1_vlan_create
401
536
bridge_create $vlan_filtering
@@ -408,7 +543,7 @@ vlan_over_bridge()
408
543
bridge vlan add dev br0 vid 100 self
409
544
fi
410
545
411
- run_test $h1 .100 br0.100 $no_unicast_flt \
546
+ run_test $h1 .100 br0.100 $skip_ptp $ no_unicast_flt \
412
547
" VLAN over vlan_filtering=$vlan_filtering bridge"
413
548
414
549
if [ $vlan_filtering = 1 ]; then
0 commit comments