Print Autonomous System Number in ASDOT notation

The ASN (Autonomous System Number, and you can think it as port number) will be outputted in ASPLAIN format by default. However, if -b option is specified (code is here):

  1. ......
  2. case 'b':
  3. ++ndo->ndo_bflag;
  4. break;
  5. ......

The ASN will be displayed in ASDOT notation when the number is bigger than 65535 (code is here):

  1. static char *
  2. as_printf(netdissect_options *ndo,
  3. char *str, int size, u_int asnum)
  4. {
  5. if (!ndo->ndo_bflag || asnum <= 0xFFFF) {
  6. snprintf(str, size, "%u", asnum);
  7. } else {
  8. snprintf(str, size, "%u.%u", asnum >> 16, asnum & 0xFFFF);
  9. }
  10. return str;
  11. }