forked from florianl/go-tc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
f_flower.go
633 lines (626 loc) · 21.4 KB
/
f_flower.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
package tc
import (
"fmt"
"net"
"github.com/mdlayher/netlink"
)
const (
tcaFlowerUnspec = iota
tcaFlowerClassID
tcaFlowerIndev
tcaFlowerAct
tcaFlowerKeyEthDst
tcaFlowerKeyEthDstMask
tcaFlowerKeyEthSrc
tcaFlowerKeyEthSrcMask
tcaFlowerKeyEthType
tcaFlowerKeyIPProto
tcaFlowerKeyIPv4Src
tcaFlowerKeyIPv4SrcMask
tcaFlowerKeyIPv4Dst
tcaFlowerKeyIPv4DstMask
tcaFlowerKeyIPv6Src
tcaFlowerKeyIPv6SrcMask
tcaFlowerKeyIPv6Dst
tcaFlowerKeyIPV6DstMask
tcaFlowerKeyTCPSrc
tcaFlowerKeyTCPDst
tcaFlowerKeyUDPSrc
tcaFlowerKeyUDPDst
tcaFlowerFlags
tcaFlowerKeyVlanID
tcaFlowerKeyVlanPrio
tcaFlowerKeyVlanEthType
tcaFlowerKeyEncKeyID
tcaFlowerKeyEncIPv4Src
tcaFlowerKeyEncIPv4SrcMask
tcaFlowerKeyEncIPv4Dst
tcaFlowerKeyEncIPv4DstMask
tcaFlowerKeyEncIPv6Src
tcaFlowerKeyEncIPv6SrcMask
tcaFlowerKeyEncIPv6Dst
tcaFlowerKeyEncIPv6DstMask
tcaFlowerKeyTCPSrcMask
tcaFlowerKeyTCPDstMask
tcaFlowerKeyUDPSrcMask
tcaFlowerKeyUDPDstMask
tcaFlowerKeySCTPSrcMask
tcaFlowerKeySCTPDstMask
tcaFlowerKeySCTPSrc
tcaFlowerKeySCTPDst
tcaFlowerKeyEncUDPSrcPort
tcaFlowerKeyEncUDPSrcPortMask
tcaFlowerKeyEncUDPDstPort
tcaFlowerKeyEncUDPDstPortMask
tcaFlowerKeyFlags
tcaFlowerKeyFlagsMask
tcaFlowerKeyIcmpv4Code
tcaFlowerKeyIcmpv4CodeMask
tcaFlowerKeyIcmpv4Type
tcaFlowerKeyIcmpv4TypeMask
tcaFlowerKeyIcmpv6Code
tcaFlowerKeyIcmpv6CodeMask
tcaFlowerKeyIcmpv6Type
tcaFlowerKeyIcmpv6TypeMask
tcaFlowerKeyArpSIP
tcaFlowerKeyArpSIPMask
tcaFlowerKeyArpTIP
tcaFlowerKeyArpTIPMask
tcaFlowerKeyArpOp
tcaFlowerKeyArpOpMask
tcaFlowerKeyArpSha
tcaFlowerKeyArpShaMask
tcaFlowerKeyArpTha
tcaFlowerKeyArpThaMask
tcaFlowerKeyMplsTTL
tcaFlowerKeyMplsBos
tcaFlowerKeyMplsTc
tcaFlowerKeyMplsLabel
tcaFlowerKeyTCPFlags
tcaFlowerKeyTCPFlagsMask
tcaFlowerKeyIPTOS
tcaFlowerKeyIPTOSMask
tcaFlowerKeyIPTTL
tcaFlowerKeyIPTTLMask
tcaFlowerKeyCVlanID
tcaFlowerKeyCVlanPrio
tcaFlowerKeyCVlanEthType
tcaFlowerKeyEncIPTOS
tcaFlowerKeyEncIPTOSMask
tcaFlowerKeyEncIPTTL
tcaFlowerKeyEncIPTTLMask
tcaFlowerKeyEncOpts
tcaFlowerKeyEncOptsMask
tcaFlowerInHwCount
)
// Flower contains attrobutes of the flower discipline
type Flower struct {
ClassID *uint32
Indev *string
Actions *[]*Action
KeyEthDst *net.HardwareAddr
KeyEthDstMask *net.HardwareAddr
KeyEthSrc *net.HardwareAddr
KeyEthSrcMask *net.HardwareAddr
KeyEthType *uint16
KeyIPProto *uint8
KeyIPv4Src *net.IP
KeyIPv4SrcMask *net.IP
KeyIPv4Dst *net.IP
KeyIPv4DstMask *net.IP
KeyTCPSrc *uint16
KeyTCPDst *uint16
KeyUDPSrc *uint16
KeyUDPDst *uint16
Flags *uint32
KeyVlanID *uint16
KeyVlanPrio *uint8
KeyVlanEthType *uint16
KeyEncKeyID *uint32
KeyEncIPv4Src *net.IP
KeyEncIPv4SrcMask *net.IP
KeyEncIPv4Dst *net.IP
KeyEncIPv4DstMask *net.IP
KeyTCPSrcMask *uint16
KeyTCPDstMask *uint16
KeyUDPSrcMask *uint16
KeyUDPDstMask *uint16
KeySctpSrc *uint16
KeySctpDst *uint16
KeyEncUDPSrcPort *uint16
KeyEncUDPSrcPortMask *uint16
KeyEncUDPDstPort *uint16
KeyEncUDPDstPortMask *uint16
KeyFlags *uint32
KeyFlagsMask *uint32
KeyIcmpv4Code *uint8
KeyIcmpv4CodeMask *uint8
KeyIcmpv4Type *uint8
KeyIcmpv4TypeMask *uint8
KeyIcmpv6Code *uint8
KeyIcmpv6CodeMask *uint8
KeyArpSIP *uint32
KeyArpSIPMask *uint32
KeyArpTIP *uint32
KeyArpTIPMask *uint32
KeyArpOp *uint8
KeyArpOpMask *uint8
KeyMplsTTL *uint8
KeyMplsBos *uint8
KeyMplsTc *uint8
KeyMplsLabel *uint32
KeyTCPFlags *uint16
KeyTCPFlagsMask *uint16
KeyIPTOS *uint8
KeyIPTOSMask *uint8
KeyIPTTL *uint8
KeyIPTTLMask *uint8
KeyCVlanID *uint16
KeyCVlanPrio *uint8
KeyCVlanEthType *uint16
KeyEncIPTOS *uint8
KeyEncIPTOSMask *uint8
KeyEncIPTTL *uint8
KeyEncIPTTLMask *uint8
InHwCount *uint32
}
// unmarshalFlower parses the Flower-encoded data and stores the result in the value pointed to by info.
func unmarshalFlower(data []byte, info *Flower) error {
ad, err := netlink.NewAttributeDecoder(data)
if err != nil {
return err
}
var multiError error
for ad.Next() {
switch ad.Type() {
case tcaFlowerClassID:
tmp := ad.Uint32()
info.ClassID = &tmp
case tcaFlowerIndev:
tmp := ad.String()
info.Indev = &tmp
case tcaFlowerAct:
actions := &[]*Action{}
err := unmarshalActions(ad.Bytes(), actions)
multiError = concatError(multiError, err)
info.Actions = actions
case tcaFlowerKeyEthDst:
tmp := bytesToHardwareAddr(ad.Bytes())
info.KeyEthDst = &tmp
case tcaFlowerKeyEthDstMask:
tmp := bytesToHardwareAddr(ad.Bytes())
info.KeyEthDstMask = &tmp
case tcaFlowerKeyEthSrc:
tmp := bytesToHardwareAddr(ad.Bytes())
info.KeyEthSrc = &tmp
case tcaFlowerKeyEthSrcMask:
tmp := bytesToHardwareAddr(ad.Bytes())
info.KeyEthSrcMask = &tmp
case tcaFlowerKeyEthType:
tmp := ad.Uint16()
info.KeyEthType = &tmp
case tcaFlowerKeyIPProto:
tmp := ad.Uint8()
info.KeyIPProto = &tmp
case tcaFlowerKeyIPv4Src:
tmp := uint32ToIP(ad.Uint32())
info.KeyIPv4Src = &tmp
case tcaFlowerKeyIPv4SrcMask:
tmp := uint32ToIP(ad.Uint32())
info.KeyIPv4SrcMask = &tmp
case tcaFlowerKeyIPv4Dst:
tmp := uint32ToIP(ad.Uint32())
info.KeyIPv4Dst = &tmp
case tcaFlowerKeyIPv4DstMask:
tmp := uint32ToIP(ad.Uint32())
info.KeyIPv4DstMask = &tmp
case tcaFlowerKeyTCPSrc:
tmp := ad.Uint16()
info.KeyTCPSrc = &tmp
case tcaFlowerKeyTCPDst:
tmp := ad.Uint16()
info.KeyTCPDst = &tmp
case tcaFlowerKeyUDPSrc:
tmp := ad.Uint16()
info.KeyUDPSrc = &tmp
case tcaFlowerKeyUDPDst:
tmp := ad.Uint16()
info.KeyUDPDst = &tmp
case tcaFlowerFlags:
tmp := ad.Uint32()
info.Flags = &tmp
case tcaFlowerKeyVlanID:
tmp := ad.Uint16()
info.KeyVlanID = &tmp
case tcaFlowerKeyVlanPrio:
tmp := ad.Uint8()
info.KeyVlanPrio = &tmp
case tcaFlowerKeyVlanEthType:
tmp := ad.Uint16()
info.KeyVlanEthType = &tmp
case tcaFlowerKeyEncKeyID:
tmp := ad.Uint32()
info.KeyEncKeyID = &tmp
case tcaFlowerKeyEncIPv4Src:
tmp := uint32ToIP(ad.Uint32())
info.KeyEncIPv4Src = &tmp
case tcaFlowerKeyEncIPv4SrcMask:
tmp := uint32ToIP(ad.Uint32())
info.KeyEncIPv4SrcMask = &tmp
case tcaFlowerKeyEncIPv4Dst:
tmp := uint32ToIP(ad.Uint32())
info.KeyEncIPv4Dst = &tmp
case tcaFlowerKeyEncIPv4DstMask:
tmp := uint32ToIP(ad.Uint32())
info.KeyEncIPv4DstMask = &tmp
case tcaFlowerKeyTCPSrcMask:
tmp := ad.Uint16()
info.KeyTCPSrcMask = &tmp
case tcaFlowerKeyTCPDstMask:
tmp := ad.Uint16()
info.KeyTCPDstMask = &tmp
case tcaFlowerKeyUDPSrcMask:
tmp := ad.Uint16()
info.KeyUDPSrcMask = &tmp
case tcaFlowerKeyUDPDstMask:
tmp := ad.Uint16()
info.KeyUDPDstMask = &tmp
case tcaFlowerKeySCTPSrc:
tmp := ad.Uint16()
info.KeySctpSrc = &tmp
case tcaFlowerKeySCTPDst:
tmp := ad.Uint16()
info.KeySctpDst = &tmp
case tcaFlowerKeyEncUDPSrcPort:
tmp := ad.Uint16()
info.KeyEncUDPSrcPort = &tmp
case tcaFlowerKeyEncUDPSrcPortMask:
tmp := ad.Uint16()
info.KeyEncUDPSrcPortMask = &tmp
case tcaFlowerKeyEncUDPDstPort:
tmp := ad.Uint16()
info.KeyEncUDPDstPort = &tmp
case tcaFlowerKeyEncUDPDstPortMask:
tmp := ad.Uint16()
info.KeyEncUDPDstPortMask = &tmp
case tcaFlowerKeyFlags:
tmp := ad.Uint32()
info.KeyFlags = &tmp
case tcaFlowerKeyFlagsMask:
tmp := ad.Uint32()
info.KeyFlagsMask = &tmp
case tcaFlowerKeyIcmpv4Code:
tmp := ad.Uint8()
info.KeyIcmpv4Code = &tmp
case tcaFlowerKeyIcmpv4CodeMask:
tmp := ad.Uint8()
info.KeyIcmpv4CodeMask = &tmp
case tcaFlowerKeyIcmpv4Type:
tmp := ad.Uint8()
info.KeyIcmpv4Type = &tmp
case tcaFlowerKeyIcmpv4TypeMask:
tmp := ad.Uint8()
info.KeyIcmpv4TypeMask = &tmp
case tcaFlowerKeyIcmpv6Code:
tmp := ad.Uint8()
info.KeyIcmpv6Code = &tmp
case tcaFlowerKeyIcmpv6CodeMask:
tmp := ad.Uint8()
info.KeyIcmpv6CodeMask = &tmp
case tcaFlowerKeyArpSIP:
tmp := ad.Uint32()
info.KeyArpSIP = &tmp
case tcaFlowerKeyArpSIPMask:
tmp := ad.Uint32()
info.KeyArpSIPMask = &tmp
case tcaFlowerKeyArpTIP:
tmp := ad.Uint32()
info.KeyArpTIP = &tmp
case tcaFlowerKeyArpTIPMask:
tmp := ad.Uint32()
info.KeyArpTIPMask = &tmp
case tcaFlowerKeyArpOp:
tmp := ad.Uint8()
info.KeyArpOp = &tmp
case tcaFlowerKeyArpOpMask:
tmp := ad.Uint8()
info.KeyArpOpMask = &tmp
case tcaFlowerKeyMplsTTL:
tmp := ad.Uint8()
info.KeyMplsTTL = &tmp
case tcaFlowerKeyMplsBos:
tmp := ad.Uint8()
info.KeyMplsBos = &tmp
case tcaFlowerKeyMplsTc:
tmp := ad.Uint8()
info.KeyMplsTc = &tmp
case tcaFlowerKeyMplsLabel:
tmp := ad.Uint32()
info.KeyMplsLabel = &tmp
case tcaFlowerKeyTCPFlags:
tmp := ad.Uint16()
info.KeyTCPFlags = &tmp
case tcaFlowerKeyTCPFlagsMask:
tmp := ad.Uint16()
info.KeyTCPFlagsMask = &tmp
case tcaFlowerKeyIPTOS:
tmp := ad.Uint8()
info.KeyIPTOS = &tmp
case tcaFlowerKeyIPTOSMask:
tmp := ad.Uint8()
info.KeyIPTOSMask = &tmp
case tcaFlowerKeyIPTTL:
tmp := ad.Uint8()
info.KeyIPTTL = &tmp
case tcaFlowerKeyIPTTLMask:
tmp := ad.Uint8()
info.KeyIPTTLMask = &tmp
case tcaFlowerKeyCVlanID:
tmp := ad.Uint16()
info.KeyCVlanID = &tmp
case tcaFlowerKeyCVlanPrio:
tmp := ad.Uint8()
info.KeyCVlanPrio = &tmp
case tcaFlowerKeyCVlanEthType:
tmp := ad.Uint16()
info.KeyCVlanEthType = &tmp
case tcaFlowerKeyEncIPTOS:
tmp := ad.Uint8()
info.KeyEncIPTOS = &tmp
case tcaFlowerKeyEncIPTOSMask:
tmp := ad.Uint8()
info.KeyEncIPTOSMask = &tmp
case tcaFlowerKeyEncIPTTL:
tmp := ad.Uint8()
info.KeyEncIPTTL = &tmp
case tcaFlowerKeyEncIPTTLMask:
tmp := ad.Uint8()
info.KeyEncIPTTLMask = &tmp
case tcaFlowerInHwCount:
tmp := ad.Uint32()
info.InHwCount = &tmp
default:
return fmt.Errorf("unmarshalFlower()\t%d\n\t%v", ad.Type(), ad.Bytes())
}
}
return concatError(multiError, ad.Err())
}
// marshalFlower returns the binary encoding of Flow
func marshalFlower(info *Flower) ([]byte, error) {
options := []tcOption{}
if info == nil {
return []byte{}, fmt.Errorf("Flower: %w", ErrNoArg)
}
var multiError error
// TODO: improve logic and check combinations
if info.ClassID != nil {
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerClassID, Data: *info.ClassID})
}
if info.Indev != nil {
options = append(options, tcOption{Interpretation: vtString, Type: tcaFlowerIndev, Data: *info.Indev})
}
if info.Actions != nil {
data, err := marshalActions(*info.Actions)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaFlowerAct, Data: data})
}
if info.KeyEthDst != nil {
tmp := hardwareAddrToBytes(*info.KeyEthDst)
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaFlowerKeyEthDst, Data: tmp})
}
if info.KeyEthDstMask != nil {
tmp := hardwareAddrToBytes(*info.KeyEthDstMask)
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaFlowerKeyEthDstMask, Data: tmp})
}
if info.KeyEthSrc != nil {
tmp := hardwareAddrToBytes(*info.KeyEthSrc)
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaFlowerKeyEthSrc, Data: tmp})
}
if info.KeyEthSrcMask != nil {
tmp := hardwareAddrToBytes(*info.KeyEthSrcMask)
options = append(options, tcOption{Interpretation: vtBytes, Type: tcaFlowerKeyEthSrcMask, Data: tmp})
}
if info.KeyEthType != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyEthType, Data: *info.KeyEthType})
}
if info.KeyIPProto != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIPProto, Data: *info.KeyIPProto})
}
if info.KeyIPv4Src != nil {
tmp, err := ipToUint32(*info.KeyIPv4Src)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyIPv4Src, Data: tmp})
}
if info.KeyIPv4SrcMask != nil {
tmp, err := ipToUint32(*info.KeyIPv4SrcMask)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyIPv4SrcMask, Data: tmp})
}
if info.KeyIPv4Dst != nil {
tmp, err := ipToUint32(*info.KeyIPv4Dst)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyIPv4Dst, Data: tmp})
}
if info.KeyIPv4DstMask != nil {
tmp, err := ipToUint32(*info.KeyIPv4DstMask)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyIPv4DstMask, Data: tmp})
}
if info.KeyTCPSrc != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPSrc, Data: *info.KeyTCPSrc})
}
if info.KeyTCPDst != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPDst, Data: *info.KeyTCPDst})
}
if info.KeyUDPSrc != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyUDPSrc, Data: *info.KeyUDPSrc})
}
if info.KeyUDPDst != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyUDPDst, Data: *info.KeyUDPDst})
}
if info.Flags != nil {
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerFlags, Data: *info.Flags})
}
if info.KeyVlanID != nil {
options = append(options, tcOption{Interpretation: vtUint16, Type: tcaFlowerKeyVlanID, Data: *info.KeyVlanID})
}
if info.KeyVlanPrio != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyVlanPrio, Data: *info.KeyVlanPrio})
}
if info.KeyVlanEthType != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyVlanEthType, Data: *info.KeyVlanEthType})
}
if info.KeyEncKeyID != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyEncKeyID, Data: *info.KeyEncKeyID})
}
if info.KeyEncIPv4Src != nil {
tmp, err := ipToUint32(*info.KeyEncIPv4Src)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyEncIPv4Src, Data: tmp})
}
if info.KeyEncIPv4SrcMask != nil {
tmp, err := ipToUint32(*info.KeyEncIPv4SrcMask)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyEncIPv4SrcMask, Data: tmp})
}
if info.KeyEncIPv4Dst != nil {
tmp, err := ipToUint32(*info.KeyEncIPv4Dst)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyEncIPv4Dst, Data: tmp})
}
if info.KeyEncIPv4DstMask != nil {
tmp, err := ipToUint32(*info.KeyEncIPv4DstMask)
multiError = concatError(multiError, err)
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyEncIPv4DstMask, Data: tmp})
}
if info.KeyTCPSrcMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPSrcMask, Data: *info.KeyTCPSrcMask})
}
if info.KeyTCPDstMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPDstMask, Data: *info.KeyTCPDstMask})
}
if info.KeyUDPSrcMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyUDPSrcMask, Data: *info.KeyUDPSrcMask})
}
if info.KeyUDPDstMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyUDPDstMask, Data: *info.KeyUDPDstMask})
}
if info.KeySctpSrc != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeySCTPSrc, Data: *info.KeySctpSrc})
}
if info.KeySctpDst != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeySCTPDst, Data: *info.KeySctpDst})
}
if info.KeyEncUDPSrcPort != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyEncUDPSrcPort, Data: *info.KeyEncUDPSrcPort})
}
if info.KeyEncUDPSrcPortMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyEncUDPSrcPortMask, Data: *info.KeyEncUDPSrcPortMask})
}
if info.KeyEncUDPDstPort != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyEncUDPDstPort, Data: *info.KeyEncUDPDstPort})
}
if info.KeyEncUDPDstPortMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyEncUDPDstPortMask, Data: *info.KeyEncUDPDstPortMask})
}
if info.KeyFlags != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyFlags, Data: *info.KeyFlags})
}
if info.KeyFlagsMask != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyFlagsMask, Data: *info.KeyFlagsMask})
}
if info.KeyIcmpv4Code != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv4Code, Data: *info.KeyIcmpv4Code})
}
if info.KeyIcmpv4CodeMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv4CodeMask, Data: *info.KeyIcmpv4CodeMask})
}
if info.KeyIcmpv4Type != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv4Type, Data: *info.KeyIcmpv4Type})
}
if info.KeyIcmpv4TypeMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv4TypeMask, Data: *info.KeyIcmpv4TypeMask})
}
if info.KeyIcmpv6Code != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv6Code, Data: *info.KeyIcmpv6Code})
}
if info.KeyIcmpv6CodeMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIcmpv6CodeMask, Data: *info.KeyIcmpv6CodeMask})
}
if info.KeyArpSIP != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyArpSIP, Data: *info.KeyArpSIP})
}
if info.KeyArpSIPMask != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyArpSIPMask, Data: *info.KeyArpSIPMask})
}
if info.KeyArpTIP != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyArpTIP, Data: *info.KeyArpTIP})
}
if info.KeyArpTIPMask != nil {
options = append(options, tcOption{Interpretation: vtUint32Be, Type: tcaFlowerKeyArpTIPMask, Data: *info.KeyArpTIPMask})
}
if info.KeyArpOp != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyArpOp, Data: *info.KeyArpOp})
}
if info.KeyArpOpMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyArpOpMask, Data: *info.KeyArpOpMask})
}
if info.KeyMplsTTL != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyMplsTTL, Data: *info.KeyMplsTTL})
}
if info.KeyMplsBos != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyMplsBos, Data: *info.KeyMplsBos})
}
if info.KeyMplsTc != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyMplsTc, Data: *info.KeyMplsTc})
}
if info.KeyMplsLabel != nil {
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerKeyMplsLabel, Data: *info.KeyMplsLabel})
}
if info.KeyTCPFlags != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPFlags, Data: *info.KeyTCPFlags})
}
if info.KeyTCPFlagsMask != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyTCPFlagsMask, Data: *info.KeyTCPFlagsMask})
}
if info.KeyIPTOS != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIPTOS, Data: *info.KeyIPTOS})
}
if info.KeyIPTOSMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIPTOSMask, Data: *info.KeyIPTOSMask})
}
if info.KeyIPTTL != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIPTTL, Data: *info.KeyIPTTL})
}
if info.KeyIPTTLMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyIPTTLMask, Data: *info.KeyIPTTLMask})
}
if info.KeyCVlanID != nil {
options = append(options, tcOption{Interpretation: vtUint16, Type: tcaFlowerKeyCVlanID, Data: *info.KeyCVlanID})
}
if info.KeyCVlanPrio != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyCVlanPrio, Data: *info.KeyCVlanPrio})
}
if info.KeyCVlanEthType != nil {
options = append(options, tcOption{Interpretation: vtUint16Be, Type: tcaFlowerKeyCVlanEthType, Data: *info.KeyCVlanEthType})
}
if info.KeyEncIPTOS != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyEncIPTOS, Data: *info.KeyEncIPTOS})
}
if info.KeyEncIPTOSMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyEncIPTOSMask, Data: *info.KeyEncIPTOSMask})
}
if info.KeyEncIPTTL != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyEncIPTTL, Data: *info.KeyEncIPTTL})
}
if info.KeyEncIPTTLMask != nil {
options = append(options, tcOption{Interpretation: vtUint8, Type: tcaFlowerKeyEncIPTTLMask, Data: *info.KeyEncIPTTLMask})
}
if info.InHwCount != nil {
options = append(options, tcOption{Interpretation: vtUint32, Type: tcaFlowerInHwCount, Data: *info.InHwCount})
}
if multiError != nil {
return []byte{}, multiError
}
return marshalAttributes(options)
}