Skip to content

Commit 5d48a06

Browse files
committed
Added matchparser tests
1 parent 5d97951 commit 5d48a06

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

ovs/matchparser_test.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,22 @@ func Test_parseMatch(t *testing.T) {
230230
s: "tp_src=80",
231231
m: TransportSourcePort(80),
232232
},
233+
{
234+
s: "udp_dst=65536",
235+
invalid: true,
236+
},
237+
{
238+
s: "udp_dst=80",
239+
m: UdpDestinationPort(80),
240+
},
241+
{
242+
s: "udp_src=65536",
243+
invalid: true,
244+
},
245+
{
246+
s: "udp_src=80",
247+
m: UdpSourcePort(80),
248+
},
233249
{
234250
s: "vlan_tci=",
235251
invalid: true,
@@ -481,6 +497,56 @@ func Test_parseMatch(t *testing.T) {
481497
s: "tp_src=0xea60/0xffe0/0xdddd",
482498
invalid: true,
483499
},
500+
{
501+
desc: "udp_dst out of range 65536/0xffe0",
502+
s: "udp_dst=65536/0xffe0",
503+
invalid: true,
504+
},
505+
{
506+
desc: "udp_dst out of range 0x10000/0xffe0",
507+
s: "udp_dst=0x10000/0xffe0",
508+
invalid: true,
509+
},
510+
{
511+
desc: "udp_dst out of range 0xea60/0x10000",
512+
s: "udp_dst=0xea60/0x10000",
513+
invalid: true,
514+
},
515+
{
516+
desc: "udp_dst 0xea60/0xffe0",
517+
s: "udp_dst=0xea60/0xffe0",
518+
m: UdpDestinationMaskedPort(0xea60, 0xffe0),
519+
},
520+
{
521+
desc: "udp_dst 0xea60/0xffe0/0xdddd",
522+
s: "udp_dst=0xea60/0xffe0/0xdddd",
523+
invalid: true,
524+
},
525+
{
526+
desc: "udp_src out of range 65536/0xffe0",
527+
s: "udp_src=65536/0xffe0",
528+
invalid: true,
529+
},
530+
{
531+
desc: "udp_src out of range 0x10000/0xffe0",
532+
s: "udp_src=0x10000/0xffe0",
533+
invalid: true,
534+
},
535+
{
536+
desc: "udp_src out of range 0xea60/0x10000",
537+
s: "udp_src=0xea60/0x10000",
538+
invalid: true,
539+
},
540+
{
541+
desc: "udp_src 0xea60/0xffe0",
542+
s: "udp_src=0xea60/0xffe0",
543+
m: UdpSourceMaskedPort(0xea60, 0xffe0),
544+
},
545+
{
546+
desc: "udp_src 0xea60/0xffe0/0xdddd",
547+
s: "udp_src=0xea60/0xffe0/0xdddd",
548+
invalid: true,
549+
},
484550
}
485551

486552
for _, tt := range tests {

0 commit comments

Comments
 (0)