@@ -86,6 +86,7 @@ static const struct tok gre_flag_values[] = {
86
86
*/
87
87
#define GRE_CDP 0x2000 /* Cisco Discovery Protocol */
88
88
#define GRE_NHRP 0x2001 /* Next Hop Resolution Protocol */
89
+ #define GRE_MIKROTIK_EOIP 0x6400 /* MikroTik RouterBoard Ethernet over IP (EoIP) */
89
90
#define GRE_ERSPAN_III 0x22eb
90
91
#define GRE_WCCP 0x883e /* Web Cache C* Protocol */
91
92
#define GRE_ERSPAN_I_II 0x88be
@@ -348,6 +349,31 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length)
348
349
len -= 2 ;
349
350
bp += 2 ;
350
351
352
+ /*
353
+ * This version is used for two purposes:
354
+ *
355
+ * RFC 2637 PPTP;
356
+ * Some Mikrotik Ethernet-over-IP hack.
357
+ */
358
+ switch (prot ) {
359
+ case GRE_MIKROTIK_EOIP :
360
+ /*
361
+ * The MikroTik hack uses only the key field, and uses it
362
+ * for its own purposes. If anything other than the version
363
+ * and K bit are set, report an error and give up.
364
+ */
365
+ if ((flags & ~GRE_VERS_MASK ) != GRE_KP ) {
366
+ ND_PRINT (" unknown-eoip-flags-%04x!" , flags );
367
+ return ;
368
+ }
369
+ break ;
370
+ default :
371
+ /*
372
+ * XXX - what should we do if it's not ETHERTYPE_PPP?
373
+ */
374
+ break ;
375
+ }
376
+
351
377
if (flags & GRE_KP ) {
352
378
/* Skip payload length? */
353
379
ND_ICHECK_U (len , < , 2 );
@@ -356,7 +382,11 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length)
356
382
bp += 2 ;
357
383
358
384
ND_ICHECK_U (len , < , 2 );
359
- ND_PRINT (", call %u" , GET_BE_U_2 (bp ));
385
+ if (prot == GRE_MIKROTIK_EOIP ) {
386
+ /* Non-standard */
387
+ ND_PRINT (", tunnel-id %u" , GET_BE_U_2 (bp ));
388
+ } else
389
+ ND_PRINT (", call %u" , GET_BE_U_2 (bp ));
360
390
len -= 2 ;
361
391
bp += 2 ;
362
392
} else
@@ -376,7 +406,10 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length)
376
406
len -= 4 ;
377
407
}
378
408
379
- if ((flags & GRE_SP ) == 0 )
409
+ /*
410
+ * More non-standard EoIP behavior.
411
+ */
412
+ if (prot != GRE_MIKROTIK_EOIP && (flags & GRE_SP ) == 0 )
380
413
ND_PRINT (", no-payload" );
381
414
382
415
if (ndo -> ndo_eflag )
@@ -385,7 +418,10 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length)
385
418
386
419
ND_PRINT (", length %u" ,length );
387
420
388
- if ((flags & GRE_SP ) == 0 )
421
+ /*
422
+ * More non-standard EoIP behavior.
423
+ */
424
+ if (prot != GRE_MIKROTIK_EOIP && (flags & GRE_SP ) == 0 )
389
425
return ;
390
426
391
427
if (ndo -> ndo_vflag < 1 )
@@ -397,6 +433,13 @@ gre_print_1(netdissect_options *ndo, const u_char *bp, u_int length)
397
433
case ETHERTYPE_PPP :
398
434
ppp_print (ndo , bp , len );
399
435
break ;
436
+ case GRE_MIKROTIK_EOIP :
437
+ /* MikroTik RouterBoard Ethernet over IP (EoIP) */
438
+ if (len == 0 )
439
+ ND_PRINT ("keepalive" );
440
+ else
441
+ ether_print (ndo , bp , len , ND_BYTES_AVAILABLE_AFTER (bp ), NULL , NULL );
442
+ break ;
400
443
default :
401
444
ND_PRINT ("gre-proto-0x%x" , prot );
402
445
break ;
0 commit comments