@@ -52,7 +52,7 @@ void test_emac_multicast_filter_cb(int opt)
5252 break ;
5353
5454 case 1 :
55- printf (" STEP 1: set ipv6 multicast filter, test if input message is filtered\r\n\r\n " );
55+ printf (" STEP 1: set ipv6 multicast filter to wrong address , test if input message is correctly filtered out (NOT received) \r\n\r\n " );
5656 {
5757 unsigned char filter[] = {0x33 , 0x33 , 0x1b , 0x1c , 0x1d , 0x1e };
5858 char forw_addr[] = {0x33 , 0x33 , 0x11 , 0x22 , 0x33 , 0x44 };
@@ -63,7 +63,7 @@ void test_emac_multicast_filter_cb(int opt)
6363 break ;
6464
6565 case 2 :
66- printf (" STEP 2: set ipv6 multicast filter, test that input message is not filtered \r\n\r\n " );
66+ printf (" STEP 2: set ipv6 multicast filter, test that input message is passed by mcast filter \r\n\r\n " );
6767 {
6868 unsigned char filter[] = {0x33 , 0x33 , 0xaa , 0xbb , 0xcc , 0xdd };
6969 emac_if_add_multicast_group (filter);
@@ -73,7 +73,7 @@ void test_emac_multicast_filter_cb(int opt)
7373 break ;
7474
7575 case 3 :
76- printf (" STEP 3: set ipv4 multicast filter, test if input message is filtered\r\n\r\n " );
76+ printf (" STEP 3: set ipv4 multicast filter to wrong address , test if input message is correctly filtered out (NOT received) \r\n\r\n " );
7777 {
7878 unsigned char filter[] = {0x01 , 0x00 , 0x5e , 0xa1 , 0xa2 , 0xa3 };
7979 char forw_addr[] = {0x01 , 0x00 , 0x5e , 0x11 , 0x22 , 0x33 };
@@ -84,7 +84,7 @@ void test_emac_multicast_filter_cb(int opt)
8484 break ;
8585
8686 case 4 :
87- printf (" STEP 4: set ipv4 multicast filter, test that input message is not filtered \r\n\r\n " );
87+ printf (" STEP 4: set ipv4 multicast filter, test that input message is passed by mcast filter \r\n\r\n " );
8888 {
8989 unsigned char filter[] = {0x01 , 0x00 , 0x5e , 0xa5 , 0xa6 , 0xa7 };
9090 emac_if_add_multicast_group (filter);
@@ -93,8 +93,45 @@ void test_emac_multicast_filter_cb(int opt)
9393 receive = true ;
9494 break ;
9595
96+
9697 case 5 :
97- printf (" STEP 5: set receive all multicast, verify that input messages are not filtered\r\n\r\n " );
98+ printf (" STEP 5: Remove last added mcast address, check that it no longer works\r\n\r\n " );
99+ {
100+ unsigned char filter[] = {0x01 , 0x00 , 0x5e , 0xa5 , 0xa6 , 0xa7 };
101+ emac_if_remove_multicast_group (filter);
102+ }
103+ receive = false ;
104+ break ;
105+
106+ case 6 :
107+ printf (" STEP 6: Check that second to last added mcast address still works\r\n\r\n " );
108+ {
109+ unsigned char filter[] = {0x01 , 0x00 , 0x5e , 0xa1 , 0xa2 , 0xa3 };
110+ memcpy (forward_addr, filter, 6 );
111+ }
112+ receive = true ;
113+ break ;
114+
115+ case 7 :
116+ printf (" STEP 7: Check that first added mcast address still works\r\n\r\n " );
117+ {
118+ unsigned char filter[] = {0x33 , 0x33 , 0xaa , 0xbb , 0xcc , 0xdd };
119+ memcpy (forward_addr, filter, 6 );
120+ }
121+ receive = true ;
122+ break ;
123+
124+ case 8 :
125+ printf (" STEP 8: Remove first added mcast address, check that it does not work now\r\n\r\n " );
126+ {
127+ unsigned char filter[] = {0x33 , 0x33 , 0xaa , 0xbb , 0xcc , 0xdd };
128+ emac_if_remove_multicast_group (filter);
129+ }
130+ receive = false ;
131+ break ;
132+
133+ case 9 :
134+ printf (" STEP 9: set receive all multicast, verify that all mcast addresses are passed now\r\n\r\n " );
98135 {
99136 emac_if_set_all_multicast (true );
100137 char forw_addr[] = {0x33 , 0x33 , 0x11 , 0x12 , 0x33 , 0x44 };
@@ -103,10 +140,11 @@ void test_emac_multicast_filter_cb(int opt)
103140 receive = true ;
104141 break ;
105142
106- case 6 :
143+ case 10 :
107144 // Test ended
108145 if (!multicasts_are_filtered) {
109146 printf (" multicast filtering was not enabled!!!\r\n\r\n " );
147+ SET_ERROR_FLAGS (TEST_FAILED);
110148 }
111149 END_TEST_LOOP;
112150 }
@@ -119,7 +157,7 @@ void test_emac_multicast_filter_cb(int opt)
119157 no_response_cnt = 0 ;
120158 } else if (opt == TIMEOUT) {
121159 if (++no_response_cnt > 5 ) {
122- if (++retries > 3 ) {
160+ if (++retries > 1 ) {
123161 if (receive) {
124162 printf (" too many retries\r\n\r\n " );
125163 SET_ERROR_FLAGS (TEST_FAILED);
@@ -137,23 +175,15 @@ void test_emac_multicast_filter_cb(int opt)
137175 // Echo response received
138176 if (opt == INPUT) {
139177 if (receive == false ) {
140- printf (" multicast was not filtered \r\n\r\n " );
178+ printf (" ERROR: multicast was received but should not have been! \r\n\r\n " );
141179 multicasts_are_filtered = false ;
142180 }
143181 next_step = true ;
144182 }
145183
146184 if (next_step) {
147185 RESET_OUTGOING_MSG_DATA;
148- #if (MBED_CONF_NETWORK_EMAC_NO_SUPPORT_FOR_IPV4_MULTICAST_FILTER == 1)
149- if (test_step == 2 ) {
150- test_step = 5 ;
151- } else {
152- test_step++;
153- }
154- #else
155186 test_step++;
156- #endif
157187 retries = 0 ;
158188 send_request = true ;
159189 }
@@ -165,7 +195,7 @@ void test_emac_multicast_filter()
165195 SET_TRACE_LEVEL (TRACE_SEND | TRACE_ETH_FRAMES | TRACE_SUCCESS | TRACE_FAILURE);
166196
167197 if (ECHO_SERVER_ADDRESS_KNOWN) {
168- START_TEST_LOOP (test_emac_multicast_filter_cb, 1s );
198+ START_TEST_LOOP (test_emac_multicast_filter_cb, 250ms );
169199 }
170200
171201 PRINT_ERROR_FLAGS;
0 commit comments