Two fixes for code within #ifdef IFMEDIA_DEBUG: 1) Print the 'mode' part of the media word.
2) Only print media options which are set in the media word, rather than printing all available options. diff 23a4e4a1e8913390694e35727d2131b2938cb472 /usr/src blob - 5168b074cbdd5a95f9945134cdd47c0649ad76a1 file + sys/net/if_media.c --- sys/net/if_media.c +++ sys/net/if_media.c @@ -419,6 +419,9 @@ struct ifmedia_description ifm_type_descriptions[] = struct ifmedia_description ifm_subtype_descriptions[] = IFM_SUBTYPE_DESCRIPTIONS; +struct ifmedia_description ifm_mode_descriptions[] = + IFM_MODE_DESCRIPTIONS; + struct ifmedia_description ifm_option_descriptions[] = IFM_OPTION_DESCRIPTIONS; @@ -454,11 +457,23 @@ ifmedia_printword(uint64_t ifmw) else printf("%s", desc->ifmt_string); + /* Print the mode. */ + for (desc = ifm_mode_descriptions; desc->ifmt_string != NULL; + desc++) { + if (IFM_TYPE_MATCH(desc->ifmt_word, ifmw) && + IFM_MODE(desc->ifmt_word) == IFM_MODE(ifmw)) + break; + } + if (desc->ifmt_string == NULL) + printf(" <unknown mode>"); + else + printf(" mode %s", desc->ifmt_string); + /* Print any options. */ for (desc = ifm_option_descriptions; desc->ifmt_string != NULL; desc++) { if (IFM_TYPE_MATCH(desc->ifmt_word, ifmw) && - (ifmw & desc->ifmt_word) != 0 && + (IFM_OPTIONS(ifmw) & IFM_OPTIONS(desc->ifmt_word)) != 0 && (seen_option & IFM_OPTIONS(desc->ifmt_word)) == 0) { if (seen_option == 0) printf(" <");