@@ -236,6 +236,11 @@ struct tim_t {
236236uint8_t bitmap [251 ];
237237};
238238
239+ struct meshid_t {
240+ u_int length ;
241+ u_char meshid [33 ]; /* 32 + 1 for null */
242+ };
243+
239244#define E_SSID 0
240245#define E_RATES 1
241246#define E_FH 2
@@ -260,6 +265,7 @@ struct tim_t {
260265/* reserved 19 */
261266/* reserved 16 */
262267/* reserved 16 */
268+ #define E_MESHID 114
263269
264270
265271struct mgmt_body_t {
@@ -287,6 +293,8 @@ struct mgmt_body_t {
287293struct fh_t fh ;
288294int tim_present ;
289295struct tim_t tim ;
296+ int meshid_present ;
297+ struct meshid_t meshid ;
290298};
291299
292300struct ctrl_control_wrapper_hdr_t {
@@ -420,6 +428,13 @@ struct meshcntl_t {
420428ND_PRINT("%s", \
421429 CAPABILITY_PRIVACY(p.capability_info) ? ", PRIVACY" : "");
422430
431+ #define PRINT_MESHID (p ) \
432+ if (p.meshid_present) { \
433+ ND_PRINT(" (MESHID: "); \
434+ fn_print_str(ndo, p.meshid.meshid); \
435+ ND_PRINT(")"); \
436+ }
437+
423438#define MAX_MCS_INDEX 76
424439
425440/*
@@ -1138,6 +1153,7 @@ parse_elements(netdissect_options *ndo,
11381153struct ds_t ds ;
11391154struct cf_t cf ;
11401155struct tim_t tim ;
1156+ struct meshid_t meshid ;
11411157
11421158/*
11431159 * We haven't seen any elements yet.
@@ -1148,6 +1164,7 @@ parse_elements(netdissect_options *ndo,
11481164pbody -> ds_present = 0 ;
11491165pbody -> cf_present = 0 ;
11501166pbody -> tim_present = 0 ;
1167+ pbody -> meshid_present = 0 ;
11511168
11521169while (length != 0 ) {
11531170/* Make sure we at least have the element ID and length. */
@@ -1336,6 +1353,30 @@ parse_elements(netdissect_options *ndo,
13361353pbody -> tim_present = 1 ;
13371354}
13381355break ;
1356+ case E_MESHID :
1357+ meshid .length = elementlen ;
1358+ offset += 2 ;
1359+ length -= 2 ;
1360+ if (meshid .length != 0 ) {
1361+ if (meshid .length > sizeof (meshid .meshid ) - 1 )
1362+ return 0 ;
1363+ memcpy (& meshid .meshid , p + offset , meshid .length );
1364+ offset += meshid .length ;
1365+ length -= meshid .length ;
1366+ }
1367+ meshid .meshid [meshid .length ] = '\0' ;
1368+ /*
1369+ * Present and not truncated.
1370+ *
1371+ * If we haven't already seen a MESHID IE,
1372+ * copy this one, otherwise ignore this one,
1373+ * so we later report the first one we saw.
1374+ */
1375+ if (!pbody -> meshid_present ) {
1376+ pbody -> meshid = meshid ;
1377+ pbody -> meshid_present = 1 ;
1378+ }
1379+ break ;
13391380default :
13401381#if 0
13411382ND_PRINT ("(1) unhandled element_id (%u) " ,
@@ -1389,6 +1430,7 @@ handle_beacon(netdissect_options *ndo,
13891430ND_PRINT (" %s" ,
13901431 CAPABILITY_ESS (pbody .capability_info ) ? "ESS" : "IBSS" );
13911432PRINT_DS_CHANNEL (pbody );
1433+ PRINT_MESHID (pbody );
13921434
13931435return ret ;
13941436trunc :
@@ -1553,6 +1595,7 @@ handle_probe_response(netdissect_options *ndo,
15531595PRINT_SSID (pbody );
15541596PRINT_RATES (pbody );
15551597PRINT_DS_CHANNEL (pbody );
1598+ PRINT_MESHID (pbody );
15561599
15571600return ret ;
15581601trunc :
0 commit comments