@@ -194,9 +194,14 @@ START_TEST(test_add_ra_options_rdnss)
194
194
ck_assert_msg (0 , "\n%s" , (char * )& buf );
195
195
#else
196
196
unsigned char expected [] = {
197
- 0x19 , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , 0xd2 , 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
198
- 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
199
- 0x00 , 0x02 , 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x03 ,
197
+ 0x19 , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , 0xd2 , // header
198
+ 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , // address 1
199
+ 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , // address 2
200
+ 0xff , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x03 , // address 3
201
+ 0x19 , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 , 0x11 , 0xd7 , // header
202
+ 0xff , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , // address 1
203
+ 0xff , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x05 , // address 2
204
+ 0xff , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x06 , // address 2
200
205
};
201
206
202
207
ck_assert_int_eq (sizeof (expected ), sb .used );
@@ -209,7 +214,8 @@ END_TEST
209
214
210
215
START_TEST (test_add_ra_options_rdnss2 )
211
216
{
212
- static struct Interface * iface = 0 ;
217
+ struct Interface * iface = 0 ;
218
+ ck_assert_ptr_eq (0 , iface );
213
219
iface = readin_config ("test/test_rdnss.conf" );
214
220
ck_assert_ptr_ne (0 , iface );
215
221
@@ -228,8 +234,54 @@ START_TEST(test_add_ra_options_rdnss2)
228
234
ck_assert_msg (0 , "\n%s" , (char * )& buf );
229
235
#else
230
236
unsigned char expected [] = {
231
- 0x19 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x2d , 0x12 , 0x34 , 0x04 , 0x23 ,
232
- 0xfe , 0xfe , 0x04 , 0x93 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 ,
237
+ 0x19 , 0x03 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x2d ,
238
+ // address 1
239
+ 0x12 , 0x34 , 0x04 , 0x23 , 0xfe , 0xfe , 0x04 , 0x93 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 ,
240
+ };
241
+
242
+ ck_assert_int_eq (sizeof (expected ), sb .used );
243
+ ck_assert_int_eq (0 , memcmp (expected , sb .buffer , sb .used ));
244
+ #endif
245
+
246
+ safe_buffer_free (& sb );
247
+ }
248
+ END_TEST
249
+
250
+ START_TEST (test_add_ra_options_rdnss3 )
251
+ {
252
+ struct Interface * iface = 0 ;
253
+ ck_assert_ptr_eq (0 , iface );
254
+ iface = readin_config ("test/test_rdnss_long.conf" );
255
+ ck_assert_ptr_ne (0 , iface );
256
+
257
+ struct safe_buffer_list * sbl = new_safe_buffer_list ();
258
+ struct safe_buffer sb = SAFE_BUFFER_INIT ;
259
+
260
+ add_ra_options_rdnss (sbl , iface , iface -> AdvRDNSSList , iface -> state_info .cease_adv , NULL );
261
+
262
+ safe_buffer_list_to_safe_buffer (sbl , & sb );
263
+ safe_buffer_list_free (sbl );
264
+ free_ifaces (iface );
265
+
266
+ #ifdef PRINT_SAFE_BUFFER
267
+ char buf [4096 ];
268
+ snprint_safe_buffer (buf , 4096 , & sb );
269
+ ck_assert_msg (0 , "\n%s" , (char * )& buf );
270
+ #else
271
+ unsigned char expected [] = {
272
+ //0x19, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, // header
273
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // address 1
274
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // address 2
275
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // address 3
276
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, // address 4
277
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, // address 5
278
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, // address 6
279
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, // address 7
280
+ //0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // address 8
281
+ 0x19 , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x2d , // header
282
+ 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , // address 1
283
+ 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , // address 2
284
+ 0x20 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x03 , // address 3
233
285
};
234
286
235
287
ck_assert_int_eq (sizeof (expected ), sb .used );
@@ -412,6 +464,7 @@ Suite *send_suite(void)
412
464
tcase_add_test (tc_build , test_add_ra_options_route );
413
465
tcase_add_test (tc_build , test_add_ra_options_rdnss );
414
466
tcase_add_test (tc_build , test_add_ra_options_rdnss2 );
467
+ tcase_add_test (tc_build , test_add_ra_options_rdnss3 );
415
468
tcase_add_test (tc_build , test_add_ra_options_dnssl );
416
469
tcase_add_test (tc_build , test_add_ra_option_mtu );
417
470
tcase_add_test (tc_build , test_add_ra_option_sllao );
0 commit comments