@@ -95,13 +95,15 @@ func TestFlowMarshalText(t *testing.T) {
9595 Priority : 1500 ,
9696 Protocol : ProtocolICMPv4 ,
9797 Matches : []Match {
98+ ICMPType (3 ),
99+ ICMPCode (1 ),
98100 DataLinkSource ("00:11:22:33:44:55" ),
99101 },
100102 Actions : []Action {
101103 Resubmit (0 , 1 ),
102104 },
103105 },
104- s : "priority=1500,icmp,dl_src=00:11:22:33:44:55,table=0,idle_timeout=0,actions=resubmit(,1)" ,
106+ s : "priority=1500,icmp,icmp_type=3,icmp_code=1, dl_src=00:11:22:33:44:55,table=0,idle_timeout=0,actions=resubmit(,1)" ,
105107 },
106108 {
107109 desc : "ICMPv6 Flow" ,
@@ -110,7 +112,7 @@ func TestFlowMarshalText(t *testing.T) {
110112 Protocol : ProtocolICMPv6 ,
111113 InPort : 74 ,
112114 Matches : []Match {
113- ICMPType (135 ),
115+ ICMP6Type (135 ),
114116 IPv6Source ("fe80:aaaa:bbbb:cccc:dddd::1/124" ),
115117 NeighborDiscoverySourceLinkLayer (
116118 net.HardwareAddr {0x00 , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 },
@@ -123,7 +125,27 @@ func TestFlowMarshalText(t *testing.T) {
123125 Resubmit (0 , 1 ),
124126 },
125127 },
126- s : "priority=2024,icmp6,in_port=74,icmp_type=135,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,nd_sll=00:11:22:33:44:55,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
128+ s : "priority=2024,icmp6,in_port=74,icmpv6_type=135,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,nd_sll=00:11:22:33:44:55,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
129+ },
130+ {
131+ desc : "ICMPv6 Type and Code Flow" ,
132+ f : & Flow {
133+ Priority : 2024 ,
134+ Protocol : ProtocolICMPv6 ,
135+ InPort : 74 ,
136+ Matches : []Match {
137+ ICMP6Type (1 ),
138+ ICMP6Code (3 ),
139+ IPv6Source ("fe80:aaaa:bbbb:cccc:dddd::1/124" ),
140+ },
141+ Table : 0 ,
142+ IdleTimeout : 0 ,
143+ Actions : []Action {
144+ ModVLANVID (10 ),
145+ Resubmit (0 , 1 ),
146+ },
147+ },
148+ s : "priority=2024,icmp6,in_port=74,icmpv6_type=1,icmpv6_code=3,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
127149 },
128150 {
129151 desc : "IPv4 Flow" ,
@@ -493,11 +515,13 @@ func TestFlowUnmarshalText(t *testing.T) {
493515 },
494516 {
495517 desc : "ICMPv4 Flow" ,
496- s : "priority=1500,icmp,dl_src=00:11:22:33:44:55,table=0,idle_timeout=0,actions=resubmit(,1)" ,
518+ s : "priority=1500,icmp,icmp_type=3,icmp_code=1, dl_src=00:11:22:33:44:55,table=0,idle_timeout=0,actions=resubmit(,1)" ,
497519 f : & Flow {
498520 Priority : 1500 ,
499521 Protocol : ProtocolICMPv4 ,
500522 Matches : []Match {
523+ ICMPType (3 ),
524+ ICMPCode (1 ),
501525 DataLinkSource ("00:11:22:33:44:55" ),
502526 },
503527 Actions : []Action {
@@ -507,13 +531,13 @@ func TestFlowUnmarshalText(t *testing.T) {
507531 },
508532 {
509533 desc : "ICMPv6 Flow" ,
510- s : "priority=2024,icmp6,in_port=74,icmp_type =135,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,nd_sll=00:11:22:33:44:55,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
534+ s : "priority=2024,icmp6,in_port=74,icmpv6_type =135,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,nd_sll=00:11:22:33:44:55,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
511535 f : & Flow {
512536 Priority : 2024 ,
513537 Protocol : ProtocolICMPv6 ,
514538 InPort : 74 ,
515539 Matches : []Match {
516- ICMPType (135 ),
540+ ICMP6Type (135 ),
517541 IPv6Source ("fe80:aaaa:bbbb:cccc:dddd::1/124" ),
518542 NeighborDiscoverySourceLinkLayer (
519543 net.HardwareAddr {0x00 , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 },
@@ -527,6 +551,26 @@ func TestFlowUnmarshalText(t *testing.T) {
527551 },
528552 },
529553 },
554+ {
555+ desc : "ICMPv6 Type and Code Flow" ,
556+ s : "priority=2024,icmp6,in_port=74,icmpv6_type=1,icmpv6_code=3,ipv6_src=fe80:aaaa:bbbb:cccc:dddd::1/124,table=0,idle_timeout=0,actions=mod_vlan_vid:10,resubmit(,1)" ,
557+ f : & Flow {
558+ Priority : 2024 ,
559+ Protocol : ProtocolICMPv6 ,
560+ InPort : 74 ,
561+ Matches : []Match {
562+ ICMP6Type (1 ),
563+ ICMP6Code (3 ),
564+ IPv6Source ("fe80:aaaa:bbbb:cccc:dddd::1/124" ),
565+ },
566+ Table : 0 ,
567+ IdleTimeout : 0 ,
568+ Actions : []Action {
569+ ModVLANVID (10 ),
570+ Resubmit (0 , 1 ),
571+ },
572+ },
573+ },
530574 {
531575 desc : "IPv4 Flow" ,
532576 s : "priority=2020,ip,in_port=31,dl_src=00:11:22:33:44:55,nw_src=10.0.0.1,table=0,idle_timeout=0,actions=mod_vlan_vid:20,resubmit(,1)" ,
0 commit comments